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