001    /**
002     * Copyright (c) 2000-2012 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 com.liferay.portal.kernel.util.StringBundler;
018    import com.liferay.portal.kernel.util.StringPool;
019    import com.liferay.portal.model.CacheModel;
020    import com.liferay.portal.model.PasswordPolicy;
021    
022    import java.io.Externalizable;
023    import java.io.IOException;
024    import java.io.ObjectInput;
025    import java.io.ObjectOutput;
026    
027    import java.util.Date;
028    
029    /**
030     * The cache model class for representing PasswordPolicy in entity cache.
031     *
032     * @author Brian Wing Shun Chan
033     * @see PasswordPolicy
034     * @generated
035     */
036    public class PasswordPolicyCacheModel implements CacheModel<PasswordPolicy>,
037            Externalizable {
038            @Override
039            public String toString() {
040                    StringBundler sb = new StringBundler(65);
041    
042                    sb.append("{passwordPolicyId=");
043                    sb.append(passwordPolicyId);
044                    sb.append(", companyId=");
045                    sb.append(companyId);
046                    sb.append(", userId=");
047                    sb.append(userId);
048                    sb.append(", userName=");
049                    sb.append(userName);
050                    sb.append(", createDate=");
051                    sb.append(createDate);
052                    sb.append(", modifiedDate=");
053                    sb.append(modifiedDate);
054                    sb.append(", defaultPolicy=");
055                    sb.append(defaultPolicy);
056                    sb.append(", name=");
057                    sb.append(name);
058                    sb.append(", description=");
059                    sb.append(description);
060                    sb.append(", changeable=");
061                    sb.append(changeable);
062                    sb.append(", changeRequired=");
063                    sb.append(changeRequired);
064                    sb.append(", minAge=");
065                    sb.append(minAge);
066                    sb.append(", checkSyntax=");
067                    sb.append(checkSyntax);
068                    sb.append(", allowDictionaryWords=");
069                    sb.append(allowDictionaryWords);
070                    sb.append(", minAlphanumeric=");
071                    sb.append(minAlphanumeric);
072                    sb.append(", minLength=");
073                    sb.append(minLength);
074                    sb.append(", minLowerCase=");
075                    sb.append(minLowerCase);
076                    sb.append(", minNumbers=");
077                    sb.append(minNumbers);
078                    sb.append(", minSymbols=");
079                    sb.append(minSymbols);
080                    sb.append(", minUpperCase=");
081                    sb.append(minUpperCase);
082                    sb.append(", history=");
083                    sb.append(history);
084                    sb.append(", historyCount=");
085                    sb.append(historyCount);
086                    sb.append(", expireable=");
087                    sb.append(expireable);
088                    sb.append(", maxAge=");
089                    sb.append(maxAge);
090                    sb.append(", warningTime=");
091                    sb.append(warningTime);
092                    sb.append(", graceLimit=");
093                    sb.append(graceLimit);
094                    sb.append(", lockout=");
095                    sb.append(lockout);
096                    sb.append(", maxFailure=");
097                    sb.append(maxFailure);
098                    sb.append(", lockoutDuration=");
099                    sb.append(lockoutDuration);
100                    sb.append(", requireUnlock=");
101                    sb.append(requireUnlock);
102                    sb.append(", resetFailureCount=");
103                    sb.append(resetFailureCount);
104                    sb.append(", resetTicketMaxAge=");
105                    sb.append(resetTicketMaxAge);
106                    sb.append("}");
107    
108                    return sb.toString();
109            }
110    
111            public PasswordPolicy toEntityModel() {
112                    PasswordPolicyImpl passwordPolicyImpl = new PasswordPolicyImpl();
113    
114                    passwordPolicyImpl.setPasswordPolicyId(passwordPolicyId);
115                    passwordPolicyImpl.setCompanyId(companyId);
116                    passwordPolicyImpl.setUserId(userId);
117    
118                    if (userName == null) {
119                            passwordPolicyImpl.setUserName(StringPool.BLANK);
120                    }
121                    else {
122                            passwordPolicyImpl.setUserName(userName);
123                    }
124    
125                    if (createDate == Long.MIN_VALUE) {
126                            passwordPolicyImpl.setCreateDate(null);
127                    }
128                    else {
129                            passwordPolicyImpl.setCreateDate(new Date(createDate));
130                    }
131    
132                    if (modifiedDate == Long.MIN_VALUE) {
133                            passwordPolicyImpl.setModifiedDate(null);
134                    }
135                    else {
136                            passwordPolicyImpl.setModifiedDate(new Date(modifiedDate));
137                    }
138    
139                    passwordPolicyImpl.setDefaultPolicy(defaultPolicy);
140    
141                    if (name == null) {
142                            passwordPolicyImpl.setName(StringPool.BLANK);
143                    }
144                    else {
145                            passwordPolicyImpl.setName(name);
146                    }
147    
148                    if (description == null) {
149                            passwordPolicyImpl.setDescription(StringPool.BLANK);
150                    }
151                    else {
152                            passwordPolicyImpl.setDescription(description);
153                    }
154    
155                    passwordPolicyImpl.setChangeable(changeable);
156                    passwordPolicyImpl.setChangeRequired(changeRequired);
157                    passwordPolicyImpl.setMinAge(minAge);
158                    passwordPolicyImpl.setCheckSyntax(checkSyntax);
159                    passwordPolicyImpl.setAllowDictionaryWords(allowDictionaryWords);
160                    passwordPolicyImpl.setMinAlphanumeric(minAlphanumeric);
161                    passwordPolicyImpl.setMinLength(minLength);
162                    passwordPolicyImpl.setMinLowerCase(minLowerCase);
163                    passwordPolicyImpl.setMinNumbers(minNumbers);
164                    passwordPolicyImpl.setMinSymbols(minSymbols);
165                    passwordPolicyImpl.setMinUpperCase(minUpperCase);
166                    passwordPolicyImpl.setHistory(history);
167                    passwordPolicyImpl.setHistoryCount(historyCount);
168                    passwordPolicyImpl.setExpireable(expireable);
169                    passwordPolicyImpl.setMaxAge(maxAge);
170                    passwordPolicyImpl.setWarningTime(warningTime);
171                    passwordPolicyImpl.setGraceLimit(graceLimit);
172                    passwordPolicyImpl.setLockout(lockout);
173                    passwordPolicyImpl.setMaxFailure(maxFailure);
174                    passwordPolicyImpl.setLockoutDuration(lockoutDuration);
175                    passwordPolicyImpl.setRequireUnlock(requireUnlock);
176                    passwordPolicyImpl.setResetFailureCount(resetFailureCount);
177                    passwordPolicyImpl.setResetTicketMaxAge(resetTicketMaxAge);
178    
179                    passwordPolicyImpl.resetOriginalValues();
180    
181                    return passwordPolicyImpl;
182            }
183    
184            public void readExternal(ObjectInput objectInput) throws IOException {
185                    passwordPolicyId = objectInput.readLong();
186                    companyId = objectInput.readLong();
187                    userId = objectInput.readLong();
188                    userName = objectInput.readUTF();
189                    createDate = objectInput.readLong();
190                    modifiedDate = objectInput.readLong();
191                    defaultPolicy = objectInput.readBoolean();
192                    name = objectInput.readUTF();
193                    description = objectInput.readUTF();
194                    changeable = objectInput.readBoolean();
195                    changeRequired = objectInput.readBoolean();
196                    minAge = objectInput.readLong();
197                    checkSyntax = objectInput.readBoolean();
198                    allowDictionaryWords = objectInput.readBoolean();
199                    minAlphanumeric = objectInput.readInt();
200                    minLength = objectInput.readInt();
201                    minLowerCase = objectInput.readInt();
202                    minNumbers = objectInput.readInt();
203                    minSymbols = objectInput.readInt();
204                    minUpperCase = objectInput.readInt();
205                    history = objectInput.readBoolean();
206                    historyCount = objectInput.readInt();
207                    expireable = objectInput.readBoolean();
208                    maxAge = objectInput.readLong();
209                    warningTime = objectInput.readLong();
210                    graceLimit = objectInput.readInt();
211                    lockout = objectInput.readBoolean();
212                    maxFailure = objectInput.readInt();
213                    lockoutDuration = objectInput.readLong();
214                    requireUnlock = objectInput.readBoolean();
215                    resetFailureCount = objectInput.readLong();
216                    resetTicketMaxAge = objectInput.readLong();
217            }
218    
219            public void writeExternal(ObjectOutput objectOutput)
220                    throws IOException {
221                    objectOutput.writeLong(passwordPolicyId);
222                    objectOutput.writeLong(companyId);
223                    objectOutput.writeLong(userId);
224    
225                    if (userName == null) {
226                            objectOutput.writeUTF(StringPool.BLANK);
227                    }
228                    else {
229                            objectOutput.writeUTF(userName);
230                    }
231    
232                    objectOutput.writeLong(createDate);
233                    objectOutput.writeLong(modifiedDate);
234                    objectOutput.writeBoolean(defaultPolicy);
235    
236                    if (name == null) {
237                            objectOutput.writeUTF(StringPool.BLANK);
238                    }
239                    else {
240                            objectOutput.writeUTF(name);
241                    }
242    
243                    if (description == null) {
244                            objectOutput.writeUTF(StringPool.BLANK);
245                    }
246                    else {
247                            objectOutput.writeUTF(description);
248                    }
249    
250                    objectOutput.writeBoolean(changeable);
251                    objectOutput.writeBoolean(changeRequired);
252                    objectOutput.writeLong(minAge);
253                    objectOutput.writeBoolean(checkSyntax);
254                    objectOutput.writeBoolean(allowDictionaryWords);
255                    objectOutput.writeInt(minAlphanumeric);
256                    objectOutput.writeInt(minLength);
257                    objectOutput.writeInt(minLowerCase);
258                    objectOutput.writeInt(minNumbers);
259                    objectOutput.writeInt(minSymbols);
260                    objectOutput.writeInt(minUpperCase);
261                    objectOutput.writeBoolean(history);
262                    objectOutput.writeInt(historyCount);
263                    objectOutput.writeBoolean(expireable);
264                    objectOutput.writeLong(maxAge);
265                    objectOutput.writeLong(warningTime);
266                    objectOutput.writeInt(graceLimit);
267                    objectOutput.writeBoolean(lockout);
268                    objectOutput.writeInt(maxFailure);
269                    objectOutput.writeLong(lockoutDuration);
270                    objectOutput.writeBoolean(requireUnlock);
271                    objectOutput.writeLong(resetFailureCount);
272                    objectOutput.writeLong(resetTicketMaxAge);
273            }
274    
275            public long passwordPolicyId;
276            public long companyId;
277            public long userId;
278            public String userName;
279            public long createDate;
280            public long modifiedDate;
281            public boolean defaultPolicy;
282            public String name;
283            public String description;
284            public boolean changeable;
285            public boolean changeRequired;
286            public long minAge;
287            public boolean checkSyntax;
288            public boolean allowDictionaryWords;
289            public int minAlphanumeric;
290            public int minLength;
291            public int minLowerCase;
292            public int minNumbers;
293            public int minSymbols;
294            public int minUpperCase;
295            public boolean history;
296            public int historyCount;
297            public boolean expireable;
298            public long maxAge;
299            public long warningTime;
300            public int graceLimit;
301            public boolean lockout;
302            public int maxFailure;
303            public long lockoutDuration;
304            public boolean requireUnlock;
305            public long resetFailureCount;
306            public long resetTicketMaxAge;
307    }