1   /**
2    * Copyright (c) 2000-2008 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.bean.ReadOnlyBeanHandler;
26  import com.liferay.portal.kernel.util.GetterUtil;
27  import com.liferay.portal.model.PasswordPolicy;
28  import com.liferay.portal.util.PropsUtil;
29  
30  import com.liferay.util.Html;
31  
32  import java.io.Serializable;
33  
34  import java.lang.reflect.Proxy;
35  
36  import java.sql.Types;
37  
38  import java.util.Date;
39  
40  /**
41   * <a href="PasswordPolicyModelImpl.java.html"><b><i>View Source</i></b></a>
42   *
43   * <p>
44   * ServiceBuilder generated this class. Modifications in this class will be
45   * overwritten the next time is generated.
46   * </p>
47   *
48   * <p>
49   * This class is a model that represents the <code>PasswordPolicy</code> table
50   * in the database.
51   * </p>
52   *
53   * @author Brian Wing Shun Chan
54   *
55   * @see com.liferay.portal.service.model.PasswordPolicy
56   * @see com.liferay.portal.service.model.PasswordPolicyModel
57   * @see com.liferay.portal.service.model.impl.PasswordPolicyImpl
58   *
59   */
60  public class PasswordPolicyModelImpl extends BaseModelImpl {
61      public static final String TABLE_NAME = "PasswordPolicy";
62      public static final Object[][] TABLE_COLUMNS = {
63              { "passwordPolicyId", new Integer(Types.BIGINT) },
64              
65  
66              { "companyId", new Integer(Types.BIGINT) },
67              
68  
69              { "userId", new Integer(Types.BIGINT) },
70              
71  
72              { "userName", new Integer(Types.VARCHAR) },
73              
74  
75              { "createDate", new Integer(Types.TIMESTAMP) },
76              
77  
78              { "modifiedDate", new Integer(Types.TIMESTAMP) },
79              
80  
81              { "defaultPolicy", new Integer(Types.BOOLEAN) },
82              
83  
84              { "name", new Integer(Types.VARCHAR) },
85              
86  
87              { "description", new Integer(Types.VARCHAR) },
88              
89  
90              { "changeable", new Integer(Types.BOOLEAN) },
91              
92  
93              { "changeRequired", new Integer(Types.BOOLEAN) },
94              
95  
96              { "minAge", new Integer(Types.BIGINT) },
97              
98  
99              { "checkSyntax", new Integer(Types.BOOLEAN) },
100             
101 
102             { "allowDictionaryWords", new Integer(Types.BOOLEAN) },
103             
104 
105             { "minLength", new Integer(Types.INTEGER) },
106             
107 
108             { "history", new Integer(Types.BOOLEAN) },
109             
110 
111             { "historyCount", new Integer(Types.INTEGER) },
112             
113 
114             { "expireable", new Integer(Types.BOOLEAN) },
115             
116 
117             { "maxAge", new Integer(Types.BIGINT) },
118             
119 
120             { "warningTime", new Integer(Types.BIGINT) },
121             
122 
123             { "graceLimit", new Integer(Types.INTEGER) },
124             
125 
126             { "lockout", new Integer(Types.BOOLEAN) },
127             
128 
129             { "maxFailure", new Integer(Types.INTEGER) },
130             
131 
132             { "lockoutDuration", new Integer(Types.BIGINT) },
133             
134 
135             { "requireUnlock", new Integer(Types.BOOLEAN) },
136             
137 
138             { "resetFailureCount", new Integer(Types.BIGINT) }
139         };
140     public static final 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)";
141     public static final String TABLE_SQL_DROP = "drop table PasswordPolicy";
142     public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
143                 "value.object.finder.cache.enabled.com.liferay.portal.model.PasswordPolicy"),
144             true);
145     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
146                 "lock.expiration.time.com.liferay.portal.model.PasswordPolicy"));
147 
148     public PasswordPolicyModelImpl() {
149     }
150 
151     public long getPrimaryKey() {
152         return _passwordPolicyId;
153     }
154 
155     public void setPrimaryKey(long pk) {
156         setPasswordPolicyId(pk);
157     }
158 
159     public Serializable getPrimaryKeyObj() {
160         return new Long(_passwordPolicyId);
161     }
162 
163     public long getPasswordPolicyId() {
164         return _passwordPolicyId;
165     }
166 
167     public void setPasswordPolicyId(long passwordPolicyId) {
168         if (passwordPolicyId != _passwordPolicyId) {
169             _passwordPolicyId = passwordPolicyId;
170         }
171     }
172 
173     public long getCompanyId() {
174         return _companyId;
175     }
176 
177     public void setCompanyId(long companyId) {
178         if (companyId != _companyId) {
179             _companyId = companyId;
180         }
181     }
182 
183     public long getUserId() {
184         return _userId;
185     }
186 
187     public void setUserId(long userId) {
188         if (userId != _userId) {
189             _userId = userId;
190         }
191     }
192 
193     public String getUserName() {
194         return GetterUtil.getString(_userName);
195     }
196 
197     public void setUserName(String userName) {
198         if (((userName == null) && (_userName != null)) ||
199                 ((userName != null) && (_userName == null)) ||
200                 ((userName != null) && (_userName != null) &&
201                 !userName.equals(_userName))) {
202             _userName = userName;
203         }
204     }
205 
206     public Date getCreateDate() {
207         return _createDate;
208     }
209 
210     public void setCreateDate(Date createDate) {
211         if (((createDate == null) && (_createDate != null)) ||
212                 ((createDate != null) && (_createDate == null)) ||
213                 ((createDate != null) && (_createDate != null) &&
214                 !createDate.equals(_createDate))) {
215             _createDate = createDate;
216         }
217     }
218 
219     public Date getModifiedDate() {
220         return _modifiedDate;
221     }
222 
223     public void setModifiedDate(Date modifiedDate) {
224         if (((modifiedDate == null) && (_modifiedDate != null)) ||
225                 ((modifiedDate != null) && (_modifiedDate == null)) ||
226                 ((modifiedDate != null) && (_modifiedDate != null) &&
227                 !modifiedDate.equals(_modifiedDate))) {
228             _modifiedDate = modifiedDate;
229         }
230     }
231 
232     public boolean getDefaultPolicy() {
233         return _defaultPolicy;
234     }
235 
236     public boolean isDefaultPolicy() {
237         return _defaultPolicy;
238     }
239 
240     public void setDefaultPolicy(boolean defaultPolicy) {
241         if (defaultPolicy != _defaultPolicy) {
242             _defaultPolicy = defaultPolicy;
243         }
244     }
245 
246     public String getName() {
247         return GetterUtil.getString(_name);
248     }
249 
250     public void setName(String name) {
251         if (((name == null) && (_name != null)) ||
252                 ((name != null) && (_name == null)) ||
253                 ((name != null) && (_name != null) && !name.equals(_name))) {
254             _name = name;
255         }
256     }
257 
258     public String getDescription() {
259         return GetterUtil.getString(_description);
260     }
261 
262     public void setDescription(String description) {
263         if (((description == null) && (_description != null)) ||
264                 ((description != null) && (_description == null)) ||
265                 ((description != null) && (_description != null) &&
266                 !description.equals(_description))) {
267             _description = description;
268         }
269     }
270 
271     public boolean getChangeable() {
272         return _changeable;
273     }
274 
275     public boolean isChangeable() {
276         return _changeable;
277     }
278 
279     public void setChangeable(boolean changeable) {
280         if (changeable != _changeable) {
281             _changeable = changeable;
282         }
283     }
284 
285     public boolean getChangeRequired() {
286         return _changeRequired;
287     }
288 
289     public boolean isChangeRequired() {
290         return _changeRequired;
291     }
292 
293     public void setChangeRequired(boolean changeRequired) {
294         if (changeRequired != _changeRequired) {
295             _changeRequired = changeRequired;
296         }
297     }
298 
299     public long getMinAge() {
300         return _minAge;
301     }
302 
303     public void setMinAge(long minAge) {
304         if (minAge != _minAge) {
305             _minAge = minAge;
306         }
307     }
308 
309     public boolean getCheckSyntax() {
310         return _checkSyntax;
311     }
312 
313     public boolean isCheckSyntax() {
314         return _checkSyntax;
315     }
316 
317     public void setCheckSyntax(boolean checkSyntax) {
318         if (checkSyntax != _checkSyntax) {
319             _checkSyntax = checkSyntax;
320         }
321     }
322 
323     public boolean getAllowDictionaryWords() {
324         return _allowDictionaryWords;
325     }
326 
327     public boolean isAllowDictionaryWords() {
328         return _allowDictionaryWords;
329     }
330 
331     public void setAllowDictionaryWords(boolean allowDictionaryWords) {
332         if (allowDictionaryWords != _allowDictionaryWords) {
333             _allowDictionaryWords = allowDictionaryWords;
334         }
335     }
336 
337     public int getMinLength() {
338         return _minLength;
339     }
340 
341     public void setMinLength(int minLength) {
342         if (minLength != _minLength) {
343             _minLength = minLength;
344         }
345     }
346 
347     public boolean getHistory() {
348         return _history;
349     }
350 
351     public boolean isHistory() {
352         return _history;
353     }
354 
355     public void setHistory(boolean history) {
356         if (history != _history) {
357             _history = history;
358         }
359     }
360 
361     public int getHistoryCount() {
362         return _historyCount;
363     }
364 
365     public void setHistoryCount(int historyCount) {
366         if (historyCount != _historyCount) {
367             _historyCount = historyCount;
368         }
369     }
370 
371     public boolean getExpireable() {
372         return _expireable;
373     }
374 
375     public boolean isExpireable() {
376         return _expireable;
377     }
378 
379     public void setExpireable(boolean expireable) {
380         if (expireable != _expireable) {
381             _expireable = expireable;
382         }
383     }
384 
385     public long getMaxAge() {
386         return _maxAge;
387     }
388 
389     public void setMaxAge(long maxAge) {
390         if (maxAge != _maxAge) {
391             _maxAge = maxAge;
392         }
393     }
394 
395     public long getWarningTime() {
396         return _warningTime;
397     }
398 
399     public void setWarningTime(long warningTime) {
400         if (warningTime != _warningTime) {
401             _warningTime = warningTime;
402         }
403     }
404 
405     public int getGraceLimit() {
406         return _graceLimit;
407     }
408 
409     public void setGraceLimit(int graceLimit) {
410         if (graceLimit != _graceLimit) {
411             _graceLimit = graceLimit;
412         }
413     }
414 
415     public boolean getLockout() {
416         return _lockout;
417     }
418 
419     public boolean isLockout() {
420         return _lockout;
421     }
422 
423     public void setLockout(boolean lockout) {
424         if (lockout != _lockout) {
425             _lockout = lockout;
426         }
427     }
428 
429     public int getMaxFailure() {
430         return _maxFailure;
431     }
432 
433     public void setMaxFailure(int maxFailure) {
434         if (maxFailure != _maxFailure) {
435             _maxFailure = maxFailure;
436         }
437     }
438 
439     public long getLockoutDuration() {
440         return _lockoutDuration;
441     }
442 
443     public void setLockoutDuration(long lockoutDuration) {
444         if (lockoutDuration != _lockoutDuration) {
445             _lockoutDuration = lockoutDuration;
446         }
447     }
448 
449     public boolean getRequireUnlock() {
450         return _requireUnlock;
451     }
452 
453     public boolean isRequireUnlock() {
454         return _requireUnlock;
455     }
456 
457     public void setRequireUnlock(boolean requireUnlock) {
458         if (requireUnlock != _requireUnlock) {
459             _requireUnlock = requireUnlock;
460         }
461     }
462 
463     public long getResetFailureCount() {
464         return _resetFailureCount;
465     }
466 
467     public void setResetFailureCount(long resetFailureCount) {
468         if (resetFailureCount != _resetFailureCount) {
469             _resetFailureCount = resetFailureCount;
470         }
471     }
472 
473     public PasswordPolicy toEscapedModel() {
474         if (isEscapedModel()) {
475             return (PasswordPolicy)this;
476         }
477         else {
478             PasswordPolicy model = new PasswordPolicyImpl();
479 
480             model.setEscapedModel(true);
481 
482             model.setPasswordPolicyId(getPasswordPolicyId());
483             model.setCompanyId(getCompanyId());
484             model.setUserId(getUserId());
485             model.setUserName(Html.escape(getUserName()));
486             model.setCreateDate(getCreateDate());
487             model.setModifiedDate(getModifiedDate());
488             model.setDefaultPolicy(getDefaultPolicy());
489             model.setName(Html.escape(getName()));
490             model.setDescription(Html.escape(getDescription()));
491             model.setChangeable(getChangeable());
492             model.setChangeRequired(getChangeRequired());
493             model.setMinAge(getMinAge());
494             model.setCheckSyntax(getCheckSyntax());
495             model.setAllowDictionaryWords(getAllowDictionaryWords());
496             model.setMinLength(getMinLength());
497             model.setHistory(getHistory());
498             model.setHistoryCount(getHistoryCount());
499             model.setExpireable(getExpireable());
500             model.setMaxAge(getMaxAge());
501             model.setWarningTime(getWarningTime());
502             model.setGraceLimit(getGraceLimit());
503             model.setLockout(getLockout());
504             model.setMaxFailure(getMaxFailure());
505             model.setLockoutDuration(getLockoutDuration());
506             model.setRequireUnlock(getRequireUnlock());
507             model.setResetFailureCount(getResetFailureCount());
508 
509             model = (PasswordPolicy)Proxy.newProxyInstance(PasswordPolicy.class.getClassLoader(),
510                     new Class[] { PasswordPolicy.class },
511                     new ReadOnlyBeanHandler(model));
512 
513             return model;
514         }
515     }
516 
517     public Object clone() {
518         PasswordPolicyImpl clone = new PasswordPolicyImpl();
519 
520         clone.setPasswordPolicyId(getPasswordPolicyId());
521         clone.setCompanyId(getCompanyId());
522         clone.setUserId(getUserId());
523         clone.setUserName(getUserName());
524         clone.setCreateDate(getCreateDate());
525         clone.setModifiedDate(getModifiedDate());
526         clone.setDefaultPolicy(getDefaultPolicy());
527         clone.setName(getName());
528         clone.setDescription(getDescription());
529         clone.setChangeable(getChangeable());
530         clone.setChangeRequired(getChangeRequired());
531         clone.setMinAge(getMinAge());
532         clone.setCheckSyntax(getCheckSyntax());
533         clone.setAllowDictionaryWords(getAllowDictionaryWords());
534         clone.setMinLength(getMinLength());
535         clone.setHistory(getHistory());
536         clone.setHistoryCount(getHistoryCount());
537         clone.setExpireable(getExpireable());
538         clone.setMaxAge(getMaxAge());
539         clone.setWarningTime(getWarningTime());
540         clone.setGraceLimit(getGraceLimit());
541         clone.setLockout(getLockout());
542         clone.setMaxFailure(getMaxFailure());
543         clone.setLockoutDuration(getLockoutDuration());
544         clone.setRequireUnlock(getRequireUnlock());
545         clone.setResetFailureCount(getResetFailureCount());
546 
547         return clone;
548     }
549 
550     public int compareTo(Object obj) {
551         if (obj == null) {
552             return -1;
553         }
554 
555         PasswordPolicyImpl passwordPolicy = (PasswordPolicyImpl)obj;
556 
557         long pk = passwordPolicy.getPrimaryKey();
558 
559         if (getPrimaryKey() < pk) {
560             return -1;
561         }
562         else if (getPrimaryKey() > pk) {
563             return 1;
564         }
565         else {
566             return 0;
567         }
568     }
569 
570     public boolean equals(Object obj) {
571         if (obj == null) {
572             return false;
573         }
574 
575         PasswordPolicyImpl passwordPolicy = null;
576 
577         try {
578             passwordPolicy = (PasswordPolicyImpl)obj;
579         }
580         catch (ClassCastException cce) {
581             return false;
582         }
583 
584         long pk = passwordPolicy.getPrimaryKey();
585 
586         if (getPrimaryKey() == pk) {
587             return true;
588         }
589         else {
590             return false;
591         }
592     }
593 
594     public int hashCode() {
595         return (int)getPrimaryKey();
596     }
597 
598     private long _passwordPolicyId;
599     private long _companyId;
600     private long _userId;
601     private String _userName;
602     private Date _createDate;
603     private Date _modifiedDate;
604     private boolean _defaultPolicy;
605     private String _name;
606     private String _description;
607     private boolean _changeable;
608     private boolean _changeRequired;
609     private long _minAge;
610     private boolean _checkSyntax;
611     private boolean _allowDictionaryWords;
612     private int _minLength;
613     private boolean _history;
614     private int _historyCount;
615     private boolean _expireable;
616     private long _maxAge;
617     private long _warningTime;
618     private int _graceLimit;
619     private boolean _lockout;
620     private int _maxFailure;
621     private long _lockoutDuration;
622     private boolean _requireUnlock;
623     private long _resetFailureCount;
624 }