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.Serializable;
023    
024    import java.util.Date;
025    
026    /**
027     * The cache model class for representing PasswordPolicy in entity cache.
028     *
029     * @author Brian Wing Shun Chan
030     * @see PasswordPolicy
031     * @generated
032     */
033    public class PasswordPolicyCacheModel implements CacheModel<PasswordPolicy>,
034            Serializable {
035            @Override
036            public String toString() {
037                    StringBundler sb = new StringBundler(65);
038    
039                    sb.append("{passwordPolicyId=");
040                    sb.append(passwordPolicyId);
041                    sb.append(", companyId=");
042                    sb.append(companyId);
043                    sb.append(", userId=");
044                    sb.append(userId);
045                    sb.append(", userName=");
046                    sb.append(userName);
047                    sb.append(", createDate=");
048                    sb.append(createDate);
049                    sb.append(", modifiedDate=");
050                    sb.append(modifiedDate);
051                    sb.append(", defaultPolicy=");
052                    sb.append(defaultPolicy);
053                    sb.append(", name=");
054                    sb.append(name);
055                    sb.append(", description=");
056                    sb.append(description);
057                    sb.append(", changeable=");
058                    sb.append(changeable);
059                    sb.append(", changeRequired=");
060                    sb.append(changeRequired);
061                    sb.append(", minAge=");
062                    sb.append(minAge);
063                    sb.append(", checkSyntax=");
064                    sb.append(checkSyntax);
065                    sb.append(", allowDictionaryWords=");
066                    sb.append(allowDictionaryWords);
067                    sb.append(", minAlphanumeric=");
068                    sb.append(minAlphanumeric);
069                    sb.append(", minLength=");
070                    sb.append(minLength);
071                    sb.append(", minLowerCase=");
072                    sb.append(minLowerCase);
073                    sb.append(", minNumbers=");
074                    sb.append(minNumbers);
075                    sb.append(", minSymbols=");
076                    sb.append(minSymbols);
077                    sb.append(", minUpperCase=");
078                    sb.append(minUpperCase);
079                    sb.append(", history=");
080                    sb.append(history);
081                    sb.append(", historyCount=");
082                    sb.append(historyCount);
083                    sb.append(", expireable=");
084                    sb.append(expireable);
085                    sb.append(", maxAge=");
086                    sb.append(maxAge);
087                    sb.append(", warningTime=");
088                    sb.append(warningTime);
089                    sb.append(", graceLimit=");
090                    sb.append(graceLimit);
091                    sb.append(", lockout=");
092                    sb.append(lockout);
093                    sb.append(", maxFailure=");
094                    sb.append(maxFailure);
095                    sb.append(", lockoutDuration=");
096                    sb.append(lockoutDuration);
097                    sb.append(", requireUnlock=");
098                    sb.append(requireUnlock);
099                    sb.append(", resetFailureCount=");
100                    sb.append(resetFailureCount);
101                    sb.append(", resetTicketMaxAge=");
102                    sb.append(resetTicketMaxAge);
103                    sb.append("}");
104    
105                    return sb.toString();
106            }
107    
108            public PasswordPolicy toEntityModel() {
109                    PasswordPolicyImpl passwordPolicyImpl = new PasswordPolicyImpl();
110    
111                    passwordPolicyImpl.setPasswordPolicyId(passwordPolicyId);
112                    passwordPolicyImpl.setCompanyId(companyId);
113                    passwordPolicyImpl.setUserId(userId);
114    
115                    if (userName == null) {
116                            passwordPolicyImpl.setUserName(StringPool.BLANK);
117                    }
118                    else {
119                            passwordPolicyImpl.setUserName(userName);
120                    }
121    
122                    if (createDate == Long.MIN_VALUE) {
123                            passwordPolicyImpl.setCreateDate(null);
124                    }
125                    else {
126                            passwordPolicyImpl.setCreateDate(new Date(createDate));
127                    }
128    
129                    if (modifiedDate == Long.MIN_VALUE) {
130                            passwordPolicyImpl.setModifiedDate(null);
131                    }
132                    else {
133                            passwordPolicyImpl.setModifiedDate(new Date(modifiedDate));
134                    }
135    
136                    passwordPolicyImpl.setDefaultPolicy(defaultPolicy);
137    
138                    if (name == null) {
139                            passwordPolicyImpl.setName(StringPool.BLANK);
140                    }
141                    else {
142                            passwordPolicyImpl.setName(name);
143                    }
144    
145                    if (description == null) {
146                            passwordPolicyImpl.setDescription(StringPool.BLANK);
147                    }
148                    else {
149                            passwordPolicyImpl.setDescription(description);
150                    }
151    
152                    passwordPolicyImpl.setChangeable(changeable);
153                    passwordPolicyImpl.setChangeRequired(changeRequired);
154                    passwordPolicyImpl.setMinAge(minAge);
155                    passwordPolicyImpl.setCheckSyntax(checkSyntax);
156                    passwordPolicyImpl.setAllowDictionaryWords(allowDictionaryWords);
157                    passwordPolicyImpl.setMinAlphanumeric(minAlphanumeric);
158                    passwordPolicyImpl.setMinLength(minLength);
159                    passwordPolicyImpl.setMinLowerCase(minLowerCase);
160                    passwordPolicyImpl.setMinNumbers(minNumbers);
161                    passwordPolicyImpl.setMinSymbols(minSymbols);
162                    passwordPolicyImpl.setMinUpperCase(minUpperCase);
163                    passwordPolicyImpl.setHistory(history);
164                    passwordPolicyImpl.setHistoryCount(historyCount);
165                    passwordPolicyImpl.setExpireable(expireable);
166                    passwordPolicyImpl.setMaxAge(maxAge);
167                    passwordPolicyImpl.setWarningTime(warningTime);
168                    passwordPolicyImpl.setGraceLimit(graceLimit);
169                    passwordPolicyImpl.setLockout(lockout);
170                    passwordPolicyImpl.setMaxFailure(maxFailure);
171                    passwordPolicyImpl.setLockoutDuration(lockoutDuration);
172                    passwordPolicyImpl.setRequireUnlock(requireUnlock);
173                    passwordPolicyImpl.setResetFailureCount(resetFailureCount);
174                    passwordPolicyImpl.setResetTicketMaxAge(resetTicketMaxAge);
175    
176                    passwordPolicyImpl.resetOriginalValues();
177    
178                    return passwordPolicyImpl;
179            }
180    
181            public long passwordPolicyId;
182            public long companyId;
183            public long userId;
184            public String userName;
185            public long createDate;
186            public long modifiedDate;
187            public boolean defaultPolicy;
188            public String name;
189            public String description;
190            public boolean changeable;
191            public boolean changeRequired;
192            public long minAge;
193            public boolean checkSyntax;
194            public boolean allowDictionaryWords;
195            public int minAlphanumeric;
196            public int minLength;
197            public int minLowerCase;
198            public int minNumbers;
199            public int minSymbols;
200            public int minUpperCase;
201            public boolean history;
202            public int historyCount;
203            public boolean expireable;
204            public long maxAge;
205            public long warningTime;
206            public int graceLimit;
207            public boolean lockout;
208            public int maxFailure;
209            public long lockoutDuration;
210            public boolean requireUnlock;
211            public long resetFailureCount;
212            public long resetTicketMaxAge;
213    }