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