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