001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.model.impl;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.util.StringBundler;
020    import com.liferay.portal.kernel.util.StringPool;
021    import com.liferay.portal.model.CacheModel;
022    import com.liferay.portal.model.MVCCModel;
023    import com.liferay.portal.model.PasswordPolicy;
024    
025    import java.io.Externalizable;
026    import java.io.IOException;
027    import java.io.ObjectInput;
028    import java.io.ObjectOutput;
029    
030    import java.util.Date;
031    
032    /**
033     * The cache model class for representing PasswordPolicy in entity cache.
034     *
035     * @author Brian Wing Shun Chan
036     * @see PasswordPolicy
037     * @generated
038     */
039    @ProviderType
040    public class PasswordPolicyCacheModel implements CacheModel<PasswordPolicy>,
041            Externalizable, MVCCModel {
042            @Override
043            public long getMvccVersion() {
044                    return mvccVersion;
045            }
046    
047            @Override
048            public void setMvccVersion(long mvccVersion) {
049                    this.mvccVersion = mvccVersion;
050            }
051    
052            @Override
053            public String toString() {
054                    StringBundler sb = new StringBundler(71);
055    
056                    sb.append("{mvccVersion=");
057                    sb.append(mvccVersion);
058                    sb.append(", uuid=");
059                    sb.append(uuid);
060                    sb.append(", passwordPolicyId=");
061                    sb.append(passwordPolicyId);
062                    sb.append(", companyId=");
063                    sb.append(companyId);
064                    sb.append(", userId=");
065                    sb.append(userId);
066                    sb.append(", userName=");
067                    sb.append(userName);
068                    sb.append(", createDate=");
069                    sb.append(createDate);
070                    sb.append(", modifiedDate=");
071                    sb.append(modifiedDate);
072                    sb.append(", defaultPolicy=");
073                    sb.append(defaultPolicy);
074                    sb.append(", name=");
075                    sb.append(name);
076                    sb.append(", description=");
077                    sb.append(description);
078                    sb.append(", changeable=");
079                    sb.append(changeable);
080                    sb.append(", changeRequired=");
081                    sb.append(changeRequired);
082                    sb.append(", minAge=");
083                    sb.append(minAge);
084                    sb.append(", checkSyntax=");
085                    sb.append(checkSyntax);
086                    sb.append(", allowDictionaryWords=");
087                    sb.append(allowDictionaryWords);
088                    sb.append(", minAlphanumeric=");
089                    sb.append(minAlphanumeric);
090                    sb.append(", minLength=");
091                    sb.append(minLength);
092                    sb.append(", minLowerCase=");
093                    sb.append(minLowerCase);
094                    sb.append(", minNumbers=");
095                    sb.append(minNumbers);
096                    sb.append(", minSymbols=");
097                    sb.append(minSymbols);
098                    sb.append(", minUpperCase=");
099                    sb.append(minUpperCase);
100                    sb.append(", regex=");
101                    sb.append(regex);
102                    sb.append(", history=");
103                    sb.append(history);
104                    sb.append(", historyCount=");
105                    sb.append(historyCount);
106                    sb.append(", expireable=");
107                    sb.append(expireable);
108                    sb.append(", maxAge=");
109                    sb.append(maxAge);
110                    sb.append(", warningTime=");
111                    sb.append(warningTime);
112                    sb.append(", graceLimit=");
113                    sb.append(graceLimit);
114                    sb.append(", lockout=");
115                    sb.append(lockout);
116                    sb.append(", maxFailure=");
117                    sb.append(maxFailure);
118                    sb.append(", lockoutDuration=");
119                    sb.append(lockoutDuration);
120                    sb.append(", requireUnlock=");
121                    sb.append(requireUnlock);
122                    sb.append(", resetFailureCount=");
123                    sb.append(resetFailureCount);
124                    sb.append(", resetTicketMaxAge=");
125                    sb.append(resetTicketMaxAge);
126                    sb.append("}");
127    
128                    return sb.toString();
129            }
130    
131            @Override
132            public PasswordPolicy toEntityModel() {
133                    PasswordPolicyImpl passwordPolicyImpl = new PasswordPolicyImpl();
134    
135                    passwordPolicyImpl.setMvccVersion(mvccVersion);
136    
137                    if (uuid == null) {
138                            passwordPolicyImpl.setUuid(StringPool.BLANK);
139                    }
140                    else {
141                            passwordPolicyImpl.setUuid(uuid);
142                    }
143    
144                    passwordPolicyImpl.setPasswordPolicyId(passwordPolicyId);
145                    passwordPolicyImpl.setCompanyId(companyId);
146                    passwordPolicyImpl.setUserId(userId);
147    
148                    if (userName == null) {
149                            passwordPolicyImpl.setUserName(StringPool.BLANK);
150                    }
151                    else {
152                            passwordPolicyImpl.setUserName(userName);
153                    }
154    
155                    if (createDate == Long.MIN_VALUE) {
156                            passwordPolicyImpl.setCreateDate(null);
157                    }
158                    else {
159                            passwordPolicyImpl.setCreateDate(new Date(createDate));
160                    }
161    
162                    if (modifiedDate == Long.MIN_VALUE) {
163                            passwordPolicyImpl.setModifiedDate(null);
164                    }
165                    else {
166                            passwordPolicyImpl.setModifiedDate(new Date(modifiedDate));
167                    }
168    
169                    passwordPolicyImpl.setDefaultPolicy(defaultPolicy);
170    
171                    if (name == null) {
172                            passwordPolicyImpl.setName(StringPool.BLANK);
173                    }
174                    else {
175                            passwordPolicyImpl.setName(name);
176                    }
177    
178                    if (description == null) {
179                            passwordPolicyImpl.setDescription(StringPool.BLANK);
180                    }
181                    else {
182                            passwordPolicyImpl.setDescription(description);
183                    }
184    
185                    passwordPolicyImpl.setChangeable(changeable);
186                    passwordPolicyImpl.setChangeRequired(changeRequired);
187                    passwordPolicyImpl.setMinAge(minAge);
188                    passwordPolicyImpl.setCheckSyntax(checkSyntax);
189                    passwordPolicyImpl.setAllowDictionaryWords(allowDictionaryWords);
190                    passwordPolicyImpl.setMinAlphanumeric(minAlphanumeric);
191                    passwordPolicyImpl.setMinLength(minLength);
192                    passwordPolicyImpl.setMinLowerCase(minLowerCase);
193                    passwordPolicyImpl.setMinNumbers(minNumbers);
194                    passwordPolicyImpl.setMinSymbols(minSymbols);
195                    passwordPolicyImpl.setMinUpperCase(minUpperCase);
196    
197                    if (regex == null) {
198                            passwordPolicyImpl.setRegex(StringPool.BLANK);
199                    }
200                    else {
201                            passwordPolicyImpl.setRegex(regex);
202                    }
203    
204                    passwordPolicyImpl.setHistory(history);
205                    passwordPolicyImpl.setHistoryCount(historyCount);
206                    passwordPolicyImpl.setExpireable(expireable);
207                    passwordPolicyImpl.setMaxAge(maxAge);
208                    passwordPolicyImpl.setWarningTime(warningTime);
209                    passwordPolicyImpl.setGraceLimit(graceLimit);
210                    passwordPolicyImpl.setLockout(lockout);
211                    passwordPolicyImpl.setMaxFailure(maxFailure);
212                    passwordPolicyImpl.setLockoutDuration(lockoutDuration);
213                    passwordPolicyImpl.setRequireUnlock(requireUnlock);
214                    passwordPolicyImpl.setResetFailureCount(resetFailureCount);
215                    passwordPolicyImpl.setResetTicketMaxAge(resetTicketMaxAge);
216    
217                    passwordPolicyImpl.resetOriginalValues();
218    
219                    return passwordPolicyImpl;
220            }
221    
222            @Override
223            public void readExternal(ObjectInput objectInput) throws IOException {
224                    mvccVersion = objectInput.readLong();
225                    uuid = objectInput.readUTF();
226                    passwordPolicyId = objectInput.readLong();
227                    companyId = objectInput.readLong();
228                    userId = objectInput.readLong();
229                    userName = objectInput.readUTF();
230                    createDate = objectInput.readLong();
231                    modifiedDate = objectInput.readLong();
232                    defaultPolicy = objectInput.readBoolean();
233                    name = objectInput.readUTF();
234                    description = objectInput.readUTF();
235                    changeable = objectInput.readBoolean();
236                    changeRequired = objectInput.readBoolean();
237                    minAge = objectInput.readLong();
238                    checkSyntax = objectInput.readBoolean();
239                    allowDictionaryWords = objectInput.readBoolean();
240                    minAlphanumeric = objectInput.readInt();
241                    minLength = objectInput.readInt();
242                    minLowerCase = objectInput.readInt();
243                    minNumbers = objectInput.readInt();
244                    minSymbols = objectInput.readInt();
245                    minUpperCase = objectInput.readInt();
246                    regex = objectInput.readUTF();
247                    history = objectInput.readBoolean();
248                    historyCount = objectInput.readInt();
249                    expireable = objectInput.readBoolean();
250                    maxAge = objectInput.readLong();
251                    warningTime = objectInput.readLong();
252                    graceLimit = objectInput.readInt();
253                    lockout = objectInput.readBoolean();
254                    maxFailure = objectInput.readInt();
255                    lockoutDuration = objectInput.readLong();
256                    requireUnlock = objectInput.readBoolean();
257                    resetFailureCount = objectInput.readLong();
258                    resetTicketMaxAge = objectInput.readLong();
259            }
260    
261            @Override
262            public void writeExternal(ObjectOutput objectOutput)
263                    throws IOException {
264                    objectOutput.writeLong(mvccVersion);
265    
266                    if (uuid == null) {
267                            objectOutput.writeUTF(StringPool.BLANK);
268                    }
269                    else {
270                            objectOutput.writeUTF(uuid);
271                    }
272    
273                    objectOutput.writeLong(passwordPolicyId);
274                    objectOutput.writeLong(companyId);
275                    objectOutput.writeLong(userId);
276    
277                    if (userName == null) {
278                            objectOutput.writeUTF(StringPool.BLANK);
279                    }
280                    else {
281                            objectOutput.writeUTF(userName);
282                    }
283    
284                    objectOutput.writeLong(createDate);
285                    objectOutput.writeLong(modifiedDate);
286                    objectOutput.writeBoolean(defaultPolicy);
287    
288                    if (name == null) {
289                            objectOutput.writeUTF(StringPool.BLANK);
290                    }
291                    else {
292                            objectOutput.writeUTF(name);
293                    }
294    
295                    if (description == null) {
296                            objectOutput.writeUTF(StringPool.BLANK);
297                    }
298                    else {
299                            objectOutput.writeUTF(description);
300                    }
301    
302                    objectOutput.writeBoolean(changeable);
303                    objectOutput.writeBoolean(changeRequired);
304                    objectOutput.writeLong(minAge);
305                    objectOutput.writeBoolean(checkSyntax);
306                    objectOutput.writeBoolean(allowDictionaryWords);
307                    objectOutput.writeInt(minAlphanumeric);
308                    objectOutput.writeInt(minLength);
309                    objectOutput.writeInt(minLowerCase);
310                    objectOutput.writeInt(minNumbers);
311                    objectOutput.writeInt(minSymbols);
312                    objectOutput.writeInt(minUpperCase);
313    
314                    if (regex == null) {
315                            objectOutput.writeUTF(StringPool.BLANK);
316                    }
317                    else {
318                            objectOutput.writeUTF(regex);
319                    }
320    
321                    objectOutput.writeBoolean(history);
322                    objectOutput.writeInt(historyCount);
323                    objectOutput.writeBoolean(expireable);
324                    objectOutput.writeLong(maxAge);
325                    objectOutput.writeLong(warningTime);
326                    objectOutput.writeInt(graceLimit);
327                    objectOutput.writeBoolean(lockout);
328                    objectOutput.writeInt(maxFailure);
329                    objectOutput.writeLong(lockoutDuration);
330                    objectOutput.writeBoolean(requireUnlock);
331                    objectOutput.writeLong(resetFailureCount);
332                    objectOutput.writeLong(resetTicketMaxAge);
333            }
334    
335            public long mvccVersion;
336            public String uuid;
337            public long passwordPolicyId;
338            public long companyId;
339            public long userId;
340            public String userName;
341            public long createDate;
342            public long modifiedDate;
343            public boolean defaultPolicy;
344            public String name;
345            public String description;
346            public boolean changeable;
347            public boolean changeRequired;
348            public long minAge;
349            public boolean checkSyntax;
350            public boolean allowDictionaryWords;
351            public int minAlphanumeric;
352            public int minLength;
353            public int minLowerCase;
354            public int minNumbers;
355            public int minSymbols;
356            public int minUpperCase;
357            public String regex;
358            public boolean history;
359            public int historyCount;
360            public boolean expireable;
361            public long maxAge;
362            public long warningTime;
363            public int graceLimit;
364            public boolean lockout;
365            public int maxFailure;
366            public long lockoutDuration;
367            public boolean requireUnlock;
368            public long resetFailureCount;
369            public long resetTicketMaxAge;
370    }