1   /**
2    * Copyright (c) 2000-2007 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.model.impl;
24  
25  import com.liferay.portal.kernel.util.GetterUtil;
26  import com.liferay.portal.model.impl.BaseModelImpl;
27  import com.liferay.portal.util.PropsUtil;
28  
29  import com.liferay.util.XSSUtil;
30  
31  import java.io.Serializable;
32  
33  import java.sql.Types;
34  
35  import java.util.Date;
36  
37  /**
38   * <a href="PasswordPolicyModelImpl.java.html"><b><i>View Source</i></b></a>
39   *
40   * <p>
41   * ServiceBuilder generated this class. Modifications in this class will be overwritten
42   * the next time is generated.
43   * </p>
44   *
45   * <p>
46   * This class is a model that represents the <code>PasswordPolicy</code> table in
47   * the database.
48   * </p>
49   *
50   * @author Brian Wing Shun Chan
51   *
52   * @see com.liferay.portal.service.model.PasswordPolicy
53   * @see com.liferay.portal.service.model.PasswordPolicyModel
54   * @see com.liferay.portal.service.model.impl.PasswordPolicyImpl
55   *
56   */
57  public class PasswordPolicyModelImpl extends BaseModelImpl {
58      public static String TABLE_NAME = "PasswordPolicy";
59      public static Object[][] TABLE_COLUMNS = {
60              { "passwordPolicyId", new Integer(Types.BIGINT) },
61              { "companyId", new Integer(Types.BIGINT) },
62              { "userId", new Integer(Types.BIGINT) },
63              { "userName", new Integer(Types.VARCHAR) },
64              { "createDate", new Integer(Types.TIMESTAMP) },
65              { "modifiedDate", new Integer(Types.TIMESTAMP) },
66              { "defaultPolicy", new Integer(Types.BOOLEAN) },
67              { "name", new Integer(Types.VARCHAR) },
68              { "description", new Integer(Types.VARCHAR) },
69              { "changeable", new Integer(Types.BOOLEAN) },
70              { "changeRequired", new Integer(Types.BOOLEAN) },
71              { "minAge", new Integer(Types.BIGINT) },
72              { "checkSyntax", new Integer(Types.BOOLEAN) },
73              { "allowDictionaryWords", new Integer(Types.BOOLEAN) },
74              { "minLength", new Integer(Types.INTEGER) },
75              { "history", new Integer(Types.BOOLEAN) },
76              { "historyCount", new Integer(Types.INTEGER) },
77              { "expireable", new Integer(Types.BOOLEAN) },
78              { "maxAge", new Integer(Types.BIGINT) },
79              { "warningTime", new Integer(Types.BIGINT) },
80              { "graceLimit", new Integer(Types.INTEGER) },
81              { "lockout", new Integer(Types.BOOLEAN) },
82              { "maxFailure", new Integer(Types.INTEGER) },
83              { "lockoutDuration", new Integer(Types.BIGINT) },
84              { "requireUnlock", new Integer(Types.BOOLEAN) },
85              { "resetFailureCount", new Integer(Types.BIGINT) }
86          };
87      public static String TABLE_SQL_CREATE = "create table PasswordPolicy (passwordPolicyId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,defaultPolicy BOOLEAN,name VARCHAR(75) null,description STRING null,changeable BOOLEAN,changeRequired BOOLEAN,minAge LONG,checkSyntax BOOLEAN,allowDictionaryWords BOOLEAN,minLength INTEGER,history BOOLEAN,historyCount INTEGER,expireable BOOLEAN,maxAge LONG,warningTime LONG,graceLimit INTEGER,lockout BOOLEAN,maxFailure INTEGER,lockoutDuration LONG,requireUnlock BOOLEAN,resetFailureCount LONG)";
88      public static String TABLE_SQL_DROP = "drop table PasswordPolicy";
89      public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
90                  "xss.allow.com.liferay.portal.model.PasswordPolicy"), XSS_ALLOW);
91      public static boolean XSS_ALLOW_USERNAME = GetterUtil.getBoolean(PropsUtil.get(
92                  "xss.allow.com.liferay.portal.model.PasswordPolicy.userName"),
93              XSS_ALLOW_BY_MODEL);
94      public static boolean XSS_ALLOW_NAME = GetterUtil.getBoolean(PropsUtil.get(
95                  "xss.allow.com.liferay.portal.model.PasswordPolicy.name"),
96              XSS_ALLOW_BY_MODEL);
97      public static boolean XSS_ALLOW_DESCRIPTION = GetterUtil.getBoolean(PropsUtil.get(
98                  "xss.allow.com.liferay.portal.model.PasswordPolicy.description"),
99              XSS_ALLOW_BY_MODEL);
100     public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
101                 "lock.expiration.time.com.liferay.portal.model.PasswordPolicyModel"));
102 
103     public PasswordPolicyModelImpl() {
104     }
105 
106     public long getPrimaryKey() {
107         return _passwordPolicyId;
108     }
109 
110     public void setPrimaryKey(long pk) {
111         setPasswordPolicyId(pk);
112     }
113 
114     public Serializable getPrimaryKeyObj() {
115         return new Long(_passwordPolicyId);
116     }
117 
118     public long getPasswordPolicyId() {
119         return _passwordPolicyId;
120     }
121 
122     public void setPasswordPolicyId(long passwordPolicyId) {
123         if (passwordPolicyId != _passwordPolicyId) {
124             _passwordPolicyId = passwordPolicyId;
125         }
126     }
127 
128     public long getCompanyId() {
129         return _companyId;
130     }
131 
132     public void setCompanyId(long companyId) {
133         if (companyId != _companyId) {
134             _companyId = companyId;
135         }
136     }
137 
138     public long getUserId() {
139         return _userId;
140     }
141 
142     public void setUserId(long userId) {
143         if (userId != _userId) {
144             _userId = userId;
145         }
146     }
147 
148     public String getUserName() {
149         return GetterUtil.getString(_userName);
150     }
151 
152     public void setUserName(String userName) {
153         if (((userName == null) && (_userName != null)) ||
154                 ((userName != null) && (_userName == null)) ||
155                 ((userName != null) && (_userName != null) &&
156                 !userName.equals(_userName))) {
157             if (!XSS_ALLOW_USERNAME) {
158                 userName = XSSUtil.strip(userName);
159             }
160 
161             _userName = userName;
162         }
163     }
164 
165     public Date getCreateDate() {
166         return _createDate;
167     }
168 
169     public void setCreateDate(Date createDate) {
170         if (((createDate == null) && (_createDate != null)) ||
171                 ((createDate != null) && (_createDate == null)) ||
172                 ((createDate != null) && (_createDate != null) &&
173                 !createDate.equals(_createDate))) {
174             _createDate = createDate;
175         }
176     }
177 
178     public Date getModifiedDate() {
179         return _modifiedDate;
180     }
181 
182     public void setModifiedDate(Date modifiedDate) {
183         if (((modifiedDate == null) && (_modifiedDate != null)) ||
184                 ((modifiedDate != null) && (_modifiedDate == null)) ||
185                 ((modifiedDate != null) && (_modifiedDate != null) &&
186                 !modifiedDate.equals(_modifiedDate))) {
187             _modifiedDate = modifiedDate;
188         }
189     }
190 
191     public boolean getDefaultPolicy() {
192         return _defaultPolicy;
193     }
194 
195     public boolean isDefaultPolicy() {
196         return _defaultPolicy;
197     }
198 
199     public void setDefaultPolicy(boolean defaultPolicy) {
200         if (defaultPolicy != _defaultPolicy) {
201             _defaultPolicy = defaultPolicy;
202         }
203     }
204 
205     public String getName() {
206         return GetterUtil.getString(_name);
207     }
208 
209     public void setName(String name) {
210         if (((name == null) && (_name != null)) ||
211                 ((name != null) && (_name == null)) ||
212                 ((name != null) && (_name != null) && !name.equals(_name))) {
213             if (!XSS_ALLOW_NAME) {
214                 name = XSSUtil.strip(name);
215             }
216 
217             _name = name;
218         }
219     }
220 
221     public String getDescription() {
222         return GetterUtil.getString(_description);
223     }
224 
225     public void setDescription(String description) {
226         if (((description == null) && (_description != null)) ||
227                 ((description != null) && (_description == null)) ||
228                 ((description != null) && (_description != null) &&
229                 !description.equals(_description))) {
230             if (!XSS_ALLOW_DESCRIPTION) {
231                 description = XSSUtil.strip(description);
232             }
233 
234             _description = description;
235         }
236     }
237 
238     public boolean getChangeable() {
239         return _changeable;
240     }
241 
242     public boolean isChangeable() {
243         return _changeable;
244     }
245 
246     public void setChangeable(boolean changeable) {
247         if (changeable != _changeable) {
248             _changeable = changeable;
249         }
250     }
251 
252     public boolean getChangeRequired() {
253         return _changeRequired;
254     }
255 
256     public boolean isChangeRequired() {
257         return _changeRequired;
258     }
259 
260     public void setChangeRequired(boolean changeRequired) {
261         if (changeRequired != _changeRequired) {
262             _changeRequired = changeRequired;
263         }
264     }
265 
266     public long getMinAge() {
267         return _minAge;
268     }
269 
270     public void setMinAge(long minAge) {
271         if (minAge != _minAge) {
272             _minAge = minAge;
273         }
274     }
275 
276     public boolean getCheckSyntax() {
277         return _checkSyntax;
278     }
279 
280     public boolean isCheckSyntax() {
281         return _checkSyntax;
282     }
283 
284     public void setCheckSyntax(boolean checkSyntax) {
285         if (checkSyntax != _checkSyntax) {
286             _checkSyntax = checkSyntax;
287         }
288     }
289 
290     public boolean getAllowDictionaryWords() {
291         return _allowDictionaryWords;
292     }
293 
294     public boolean isAllowDictionaryWords() {
295         return _allowDictionaryWords;
296     }
297 
298     public void setAllowDictionaryWords(boolean allowDictionaryWords) {
299         if (allowDictionaryWords != _allowDictionaryWords) {
300             _allowDictionaryWords = allowDictionaryWords;
301         }
302     }
303 
304     public int getMinLength() {
305         return _minLength;
306     }
307 
308     public void setMinLength(int minLength) {
309         if (minLength != _minLength) {
310             _minLength = minLength;
311         }
312     }
313 
314     public boolean getHistory() {
315         return _history;
316     }
317 
318     public boolean isHistory() {
319         return _history;
320     }
321 
322     public void setHistory(boolean history) {
323         if (history != _history) {
324             _history = history;
325         }
326     }
327 
328     public int getHistoryCount() {
329         return _historyCount;
330     }
331 
332     public void setHistoryCount(int historyCount) {
333         if (historyCount != _historyCount) {
334             _historyCount = historyCount;
335         }
336     }
337 
338     public boolean getExpireable() {
339         return _expireable;
340     }
341 
342     public boolean isExpireable() {
343         return _expireable;
344     }
345 
346     public void setExpireable(boolean expireable) {
347         if (expireable != _expireable) {
348             _expireable = expireable;
349         }
350     }
351 
352     public long getMaxAge() {
353         return _maxAge;
354     }
355 
356     public void setMaxAge(long maxAge) {
357         if (maxAge != _maxAge) {
358             _maxAge = maxAge;
359         }
360     }
361 
362     public long getWarningTime() {
363         return _warningTime;
364     }
365 
366     public void setWarningTime(long warningTime) {
367         if (warningTime != _warningTime) {
368             _warningTime = warningTime;
369         }
370     }
371 
372     public int getGraceLimit() {
373         return _graceLimit;
374     }
375 
376     public void setGraceLimit(int graceLimit) {
377         if (graceLimit != _graceLimit) {
378             _graceLimit = graceLimit;
379         }
380     }
381 
382     public boolean getLockout() {
383         return _lockout;
384     }
385 
386     public boolean isLockout() {
387         return _lockout;
388     }
389 
390     public void setLockout(boolean lockout) {
391         if (lockout != _lockout) {
392             _lockout = lockout;
393         }
394     }
395 
396     public int getMaxFailure() {
397         return _maxFailure;
398     }
399 
400     public void setMaxFailure(int maxFailure) {
401         if (maxFailure != _maxFailure) {
402             _maxFailure = maxFailure;
403         }
404     }
405 
406     public long getLockoutDuration() {
407         return _lockoutDuration;
408     }
409 
410     public void setLockoutDuration(long lockoutDuration) {
411         if (lockoutDuration != _lockoutDuration) {
412             _lockoutDuration = lockoutDuration;
413         }
414     }
415 
416     public boolean getRequireUnlock() {
417         return _requireUnlock;
418     }
419 
420     public boolean isRequireUnlock() {
421         return _requireUnlock;
422     }
423 
424     public void setRequireUnlock(boolean requireUnlock) {
425         if (requireUnlock != _requireUnlock) {
426             _requireUnlock = requireUnlock;
427         }
428     }
429 
430     public long getResetFailureCount() {
431         return _resetFailureCount;
432     }
433 
434     public void setResetFailureCount(long resetFailureCount) {
435         if (resetFailureCount != _resetFailureCount) {
436             _resetFailureCount = resetFailureCount;
437         }
438     }
439 
440     public Object clone() {
441         PasswordPolicyImpl clone = new PasswordPolicyImpl();
442         clone.setPasswordPolicyId(getPasswordPolicyId());
443         clone.setCompanyId(getCompanyId());
444         clone.setUserId(getUserId());
445         clone.setUserName(getUserName());
446         clone.setCreateDate(getCreateDate());
447         clone.setModifiedDate(getModifiedDate());
448         clone.setDefaultPolicy(getDefaultPolicy());
449         clone.setName(getName());
450         clone.setDescription(getDescription());
451         clone.setChangeable(getChangeable());
452         clone.setChangeRequired(getChangeRequired());
453         clone.setMinAge(getMinAge());
454         clone.setCheckSyntax(getCheckSyntax());
455         clone.setAllowDictionaryWords(getAllowDictionaryWords());
456         clone.setMinLength(getMinLength());
457         clone.setHistory(getHistory());
458         clone.setHistoryCount(getHistoryCount());
459         clone.setExpireable(getExpireable());
460         clone.setMaxAge(getMaxAge());
461         clone.setWarningTime(getWarningTime());
462         clone.setGraceLimit(getGraceLimit());
463         clone.setLockout(getLockout());
464         clone.setMaxFailure(getMaxFailure());
465         clone.setLockoutDuration(getLockoutDuration());
466         clone.setRequireUnlock(getRequireUnlock());
467         clone.setResetFailureCount(getResetFailureCount());
468 
469         return clone;
470     }
471 
472     public int compareTo(Object obj) {
473         if (obj == null) {
474             return -1;
475         }
476 
477         PasswordPolicyImpl passwordPolicy = (PasswordPolicyImpl)obj;
478         long pk = passwordPolicy.getPrimaryKey();
479 
480         if (getPrimaryKey() < pk) {
481             return -1;
482         }
483         else if (getPrimaryKey() > pk) {
484             return 1;
485         }
486         else {
487             return 0;
488         }
489     }
490 
491     public boolean equals(Object obj) {
492         if (obj == null) {
493             return false;
494         }
495 
496         PasswordPolicyImpl passwordPolicy = null;
497 
498         try {
499             passwordPolicy = (PasswordPolicyImpl)obj;
500         }
501         catch (ClassCastException cce) {
502             return false;
503         }
504 
505         long pk = passwordPolicy.getPrimaryKey();
506 
507         if (getPrimaryKey() == pk) {
508             return true;
509         }
510         else {
511             return false;
512         }
513     }
514 
515     public int hashCode() {
516         return (int)getPrimaryKey();
517     }
518 
519     private long _passwordPolicyId;
520     private long _companyId;
521     private long _userId;
522     private String _userName;
523     private Date _createDate;
524     private Date _modifiedDate;
525     private boolean _defaultPolicy;
526     private String _name;
527     private String _description;
528     private boolean _changeable;
529     private boolean _changeRequired;
530     private long _minAge;
531     private boolean _checkSyntax;
532     private boolean _allowDictionaryWords;
533     private int _minLength;
534     private boolean _history;
535     private int _historyCount;
536     private boolean _expireable;
537     private long _maxAge;
538     private long _warningTime;
539     private int _graceLimit;
540     private boolean _lockout;
541     private int _maxFailure;
542     private long _lockoutDuration;
543     private boolean _requireUnlock;
544     private long _resetFailureCount;
545 }