001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.model.impl;
016    
017    import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.kernel.json.JSON;
020    import com.liferay.portal.kernel.util.GetterUtil;
021    import com.liferay.portal.kernel.util.ProxyUtil;
022    import com.liferay.portal.kernel.util.StringBundler;
023    import com.liferay.portal.kernel.util.StringPool;
024    import com.liferay.portal.model.CacheModel;
025    import com.liferay.portal.model.PasswordPolicy;
026    import com.liferay.portal.model.PasswordPolicyModel;
027    import com.liferay.portal.model.PasswordPolicySoap;
028    import com.liferay.portal.service.ServiceContext;
029    import com.liferay.portal.util.PortalUtil;
030    
031    import com.liferay.portlet.expando.model.ExpandoBridge;
032    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
033    
034    import java.io.Serializable;
035    
036    import java.sql.Types;
037    
038    import java.util.ArrayList;
039    import java.util.Date;
040    import java.util.HashMap;
041    import java.util.List;
042    import java.util.Map;
043    
044    /**
045     * The base model implementation for the PasswordPolicy service. Represents a row in the "PasswordPolicy" database table, with each column mapped to a property of this class.
046     *
047     * <p>
048     * This implementation and its corresponding interface {@link com.liferay.portal.model.PasswordPolicyModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link PasswordPolicyImpl}.
049     * </p>
050     *
051     * @author Brian Wing Shun Chan
052     * @see PasswordPolicyImpl
053     * @see com.liferay.portal.model.PasswordPolicy
054     * @see com.liferay.portal.model.PasswordPolicyModel
055     * @generated
056     */
057    @JSON(strict = true)
058    public class PasswordPolicyModelImpl extends BaseModelImpl<PasswordPolicy>
059            implements PasswordPolicyModel {
060            /*
061             * NOTE FOR DEVELOPERS:
062             *
063             * Never modify or reference this class directly. All methods that expect a password policy model instance should use the {@link com.liferay.portal.model.PasswordPolicy} interface instead.
064             */
065            public static final String TABLE_NAME = "PasswordPolicy";
066            public static final Object[][] TABLE_COLUMNS = {
067                            { "passwordPolicyId", Types.BIGINT },
068                            { "companyId", Types.BIGINT },
069                            { "userId", Types.BIGINT },
070                            { "userName", Types.VARCHAR },
071                            { "createDate", Types.TIMESTAMP },
072                            { "modifiedDate", Types.TIMESTAMP },
073                            { "defaultPolicy", Types.BOOLEAN },
074                            { "name", Types.VARCHAR },
075                            { "description", Types.VARCHAR },
076                            { "changeable", Types.BOOLEAN },
077                            { "changeRequired", Types.BOOLEAN },
078                            { "minAge", Types.BIGINT },
079                            { "checkSyntax", Types.BOOLEAN },
080                            { "allowDictionaryWords", Types.BOOLEAN },
081                            { "minAlphanumeric", Types.INTEGER },
082                            { "minLength", Types.INTEGER },
083                            { "minLowerCase", Types.INTEGER },
084                            { "minNumbers", Types.INTEGER },
085                            { "minSymbols", Types.INTEGER },
086                            { "minUpperCase", Types.INTEGER },
087                            { "regex", Types.VARCHAR },
088                            { "history", Types.BOOLEAN },
089                            { "historyCount", Types.INTEGER },
090                            { "expireable", Types.BOOLEAN },
091                            { "maxAge", Types.BIGINT },
092                            { "warningTime", Types.BIGINT },
093                            { "graceLimit", Types.INTEGER },
094                            { "lockout", Types.BOOLEAN },
095                            { "maxFailure", Types.INTEGER },
096                            { "lockoutDuration", Types.BIGINT },
097                            { "requireUnlock", Types.BOOLEAN },
098                            { "resetFailureCount", Types.BIGINT },
099                            { "resetTicketMaxAge", Types.BIGINT }
100                    };
101            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,minAlphanumeric INTEGER,minLength INTEGER,minLowerCase INTEGER,minNumbers INTEGER,minSymbols INTEGER,minUpperCase INTEGER,regex VARCHAR(75) null,history BOOLEAN,historyCount INTEGER,expireable BOOLEAN,maxAge LONG,warningTime LONG,graceLimit INTEGER,lockout BOOLEAN,maxFailure INTEGER,lockoutDuration LONG,requireUnlock BOOLEAN,resetFailureCount LONG,resetTicketMaxAge LONG)";
102            public static final String TABLE_SQL_DROP = "drop table PasswordPolicy";
103            public static final String ORDER_BY_JPQL = " ORDER BY passwordPolicy.passwordPolicyId ASC";
104            public static final String ORDER_BY_SQL = " ORDER BY PasswordPolicy.passwordPolicyId ASC";
105            public static final String DATA_SOURCE = "liferayDataSource";
106            public static final String SESSION_FACTORY = "liferaySessionFactory";
107            public static final String TX_MANAGER = "liferayTransactionManager";
108            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
109                                    "value.object.entity.cache.enabled.com.liferay.portal.model.PasswordPolicy"),
110                            true);
111            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
112                                    "value.object.finder.cache.enabled.com.liferay.portal.model.PasswordPolicy"),
113                            true);
114            public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
115                                    "value.object.column.bitmask.enabled.com.liferay.portal.model.PasswordPolicy"),
116                            true);
117            public static long COMPANYID_COLUMN_BITMASK = 1L;
118            public static long DEFAULTPOLICY_COLUMN_BITMASK = 2L;
119            public static long NAME_COLUMN_BITMASK = 4L;
120            public static long PASSWORDPOLICYID_COLUMN_BITMASK = 8L;
121    
122            /**
123             * Converts the soap model instance into a normal model instance.
124             *
125             * @param soapModel the soap model instance to convert
126             * @return the normal model instance
127             */
128            public static PasswordPolicy toModel(PasswordPolicySoap soapModel) {
129                    if (soapModel == null) {
130                            return null;
131                    }
132    
133                    PasswordPolicy model = new PasswordPolicyImpl();
134    
135                    model.setPasswordPolicyId(soapModel.getPasswordPolicyId());
136                    model.setCompanyId(soapModel.getCompanyId());
137                    model.setUserId(soapModel.getUserId());
138                    model.setUserName(soapModel.getUserName());
139                    model.setCreateDate(soapModel.getCreateDate());
140                    model.setModifiedDate(soapModel.getModifiedDate());
141                    model.setDefaultPolicy(soapModel.getDefaultPolicy());
142                    model.setName(soapModel.getName());
143                    model.setDescription(soapModel.getDescription());
144                    model.setChangeable(soapModel.getChangeable());
145                    model.setChangeRequired(soapModel.getChangeRequired());
146                    model.setMinAge(soapModel.getMinAge());
147                    model.setCheckSyntax(soapModel.getCheckSyntax());
148                    model.setAllowDictionaryWords(soapModel.getAllowDictionaryWords());
149                    model.setMinAlphanumeric(soapModel.getMinAlphanumeric());
150                    model.setMinLength(soapModel.getMinLength());
151                    model.setMinLowerCase(soapModel.getMinLowerCase());
152                    model.setMinNumbers(soapModel.getMinNumbers());
153                    model.setMinSymbols(soapModel.getMinSymbols());
154                    model.setMinUpperCase(soapModel.getMinUpperCase());
155                    model.setRegex(soapModel.getRegex());
156                    model.setHistory(soapModel.getHistory());
157                    model.setHistoryCount(soapModel.getHistoryCount());
158                    model.setExpireable(soapModel.getExpireable());
159                    model.setMaxAge(soapModel.getMaxAge());
160                    model.setWarningTime(soapModel.getWarningTime());
161                    model.setGraceLimit(soapModel.getGraceLimit());
162                    model.setLockout(soapModel.getLockout());
163                    model.setMaxFailure(soapModel.getMaxFailure());
164                    model.setLockoutDuration(soapModel.getLockoutDuration());
165                    model.setRequireUnlock(soapModel.getRequireUnlock());
166                    model.setResetFailureCount(soapModel.getResetFailureCount());
167                    model.setResetTicketMaxAge(soapModel.getResetTicketMaxAge());
168    
169                    return model;
170            }
171    
172            /**
173             * Converts the soap model instances into normal model instances.
174             *
175             * @param soapModels the soap model instances to convert
176             * @return the normal model instances
177             */
178            public static List<PasswordPolicy> toModels(PasswordPolicySoap[] soapModels) {
179                    if (soapModels == null) {
180                            return null;
181                    }
182    
183                    List<PasswordPolicy> models = new ArrayList<PasswordPolicy>(soapModels.length);
184    
185                    for (PasswordPolicySoap soapModel : soapModels) {
186                            models.add(toModel(soapModel));
187                    }
188    
189                    return models;
190            }
191    
192            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
193                                    "lock.expiration.time.com.liferay.portal.model.PasswordPolicy"));
194    
195            public PasswordPolicyModelImpl() {
196            }
197    
198            public long getPrimaryKey() {
199                    return _passwordPolicyId;
200            }
201    
202            public void setPrimaryKey(long primaryKey) {
203                    setPasswordPolicyId(primaryKey);
204            }
205    
206            public Serializable getPrimaryKeyObj() {
207                    return _passwordPolicyId;
208            }
209    
210            public void setPrimaryKeyObj(Serializable primaryKeyObj) {
211                    setPrimaryKey(((Long)primaryKeyObj).longValue());
212            }
213    
214            public Class<?> getModelClass() {
215                    return PasswordPolicy.class;
216            }
217    
218            public String getModelClassName() {
219                    return PasswordPolicy.class.getName();
220            }
221    
222            @Override
223            public Map<String, Object> getModelAttributes() {
224                    Map<String, Object> attributes = new HashMap<String, Object>();
225    
226                    attributes.put("passwordPolicyId", getPasswordPolicyId());
227                    attributes.put("companyId", getCompanyId());
228                    attributes.put("userId", getUserId());
229                    attributes.put("userName", getUserName());
230                    attributes.put("createDate", getCreateDate());
231                    attributes.put("modifiedDate", getModifiedDate());
232                    attributes.put("defaultPolicy", getDefaultPolicy());
233                    attributes.put("name", getName());
234                    attributes.put("description", getDescription());
235                    attributes.put("changeable", getChangeable());
236                    attributes.put("changeRequired", getChangeRequired());
237                    attributes.put("minAge", getMinAge());
238                    attributes.put("checkSyntax", getCheckSyntax());
239                    attributes.put("allowDictionaryWords", getAllowDictionaryWords());
240                    attributes.put("minAlphanumeric", getMinAlphanumeric());
241                    attributes.put("minLength", getMinLength());
242                    attributes.put("minLowerCase", getMinLowerCase());
243                    attributes.put("minNumbers", getMinNumbers());
244                    attributes.put("minSymbols", getMinSymbols());
245                    attributes.put("minUpperCase", getMinUpperCase());
246                    attributes.put("regex", getRegex());
247                    attributes.put("history", getHistory());
248                    attributes.put("historyCount", getHistoryCount());
249                    attributes.put("expireable", getExpireable());
250                    attributes.put("maxAge", getMaxAge());
251                    attributes.put("warningTime", getWarningTime());
252                    attributes.put("graceLimit", getGraceLimit());
253                    attributes.put("lockout", getLockout());
254                    attributes.put("maxFailure", getMaxFailure());
255                    attributes.put("lockoutDuration", getLockoutDuration());
256                    attributes.put("requireUnlock", getRequireUnlock());
257                    attributes.put("resetFailureCount", getResetFailureCount());
258                    attributes.put("resetTicketMaxAge", getResetTicketMaxAge());
259    
260                    return attributes;
261            }
262    
263            @Override
264            public void setModelAttributes(Map<String, Object> attributes) {
265                    Long passwordPolicyId = (Long)attributes.get("passwordPolicyId");
266    
267                    if (passwordPolicyId != null) {
268                            setPasswordPolicyId(passwordPolicyId);
269                    }
270    
271                    Long companyId = (Long)attributes.get("companyId");
272    
273                    if (companyId != null) {
274                            setCompanyId(companyId);
275                    }
276    
277                    Long userId = (Long)attributes.get("userId");
278    
279                    if (userId != null) {
280                            setUserId(userId);
281                    }
282    
283                    String userName = (String)attributes.get("userName");
284    
285                    if (userName != null) {
286                            setUserName(userName);
287                    }
288    
289                    Date createDate = (Date)attributes.get("createDate");
290    
291                    if (createDate != null) {
292                            setCreateDate(createDate);
293                    }
294    
295                    Date modifiedDate = (Date)attributes.get("modifiedDate");
296    
297                    if (modifiedDate != null) {
298                            setModifiedDate(modifiedDate);
299                    }
300    
301                    Boolean defaultPolicy = (Boolean)attributes.get("defaultPolicy");
302    
303                    if (defaultPolicy != null) {
304                            setDefaultPolicy(defaultPolicy);
305                    }
306    
307                    String name = (String)attributes.get("name");
308    
309                    if (name != null) {
310                            setName(name);
311                    }
312    
313                    String description = (String)attributes.get("description");
314    
315                    if (description != null) {
316                            setDescription(description);
317                    }
318    
319                    Boolean changeable = (Boolean)attributes.get("changeable");
320    
321                    if (changeable != null) {
322                            setChangeable(changeable);
323                    }
324    
325                    Boolean changeRequired = (Boolean)attributes.get("changeRequired");
326    
327                    if (changeRequired != null) {
328                            setChangeRequired(changeRequired);
329                    }
330    
331                    Long minAge = (Long)attributes.get("minAge");
332    
333                    if (minAge != null) {
334                            setMinAge(minAge);
335                    }
336    
337                    Boolean checkSyntax = (Boolean)attributes.get("checkSyntax");
338    
339                    if (checkSyntax != null) {
340                            setCheckSyntax(checkSyntax);
341                    }
342    
343                    Boolean allowDictionaryWords = (Boolean)attributes.get(
344                                    "allowDictionaryWords");
345    
346                    if (allowDictionaryWords != null) {
347                            setAllowDictionaryWords(allowDictionaryWords);
348                    }
349    
350                    Integer minAlphanumeric = (Integer)attributes.get("minAlphanumeric");
351    
352                    if (minAlphanumeric != null) {
353                            setMinAlphanumeric(minAlphanumeric);
354                    }
355    
356                    Integer minLength = (Integer)attributes.get("minLength");
357    
358                    if (minLength != null) {
359                            setMinLength(minLength);
360                    }
361    
362                    Integer minLowerCase = (Integer)attributes.get("minLowerCase");
363    
364                    if (minLowerCase != null) {
365                            setMinLowerCase(minLowerCase);
366                    }
367    
368                    Integer minNumbers = (Integer)attributes.get("minNumbers");
369    
370                    if (minNumbers != null) {
371                            setMinNumbers(minNumbers);
372                    }
373    
374                    Integer minSymbols = (Integer)attributes.get("minSymbols");
375    
376                    if (minSymbols != null) {
377                            setMinSymbols(minSymbols);
378                    }
379    
380                    Integer minUpperCase = (Integer)attributes.get("minUpperCase");
381    
382                    if (minUpperCase != null) {
383                            setMinUpperCase(minUpperCase);
384                    }
385    
386                    String regex = (String)attributes.get("regex");
387    
388                    if (regex != null) {
389                            setRegex(regex);
390                    }
391    
392                    Boolean history = (Boolean)attributes.get("history");
393    
394                    if (history != null) {
395                            setHistory(history);
396                    }
397    
398                    Integer historyCount = (Integer)attributes.get("historyCount");
399    
400                    if (historyCount != null) {
401                            setHistoryCount(historyCount);
402                    }
403    
404                    Boolean expireable = (Boolean)attributes.get("expireable");
405    
406                    if (expireable != null) {
407                            setExpireable(expireable);
408                    }
409    
410                    Long maxAge = (Long)attributes.get("maxAge");
411    
412                    if (maxAge != null) {
413                            setMaxAge(maxAge);
414                    }
415    
416                    Long warningTime = (Long)attributes.get("warningTime");
417    
418                    if (warningTime != null) {
419                            setWarningTime(warningTime);
420                    }
421    
422                    Integer graceLimit = (Integer)attributes.get("graceLimit");
423    
424                    if (graceLimit != null) {
425                            setGraceLimit(graceLimit);
426                    }
427    
428                    Boolean lockout = (Boolean)attributes.get("lockout");
429    
430                    if (lockout != null) {
431                            setLockout(lockout);
432                    }
433    
434                    Integer maxFailure = (Integer)attributes.get("maxFailure");
435    
436                    if (maxFailure != null) {
437                            setMaxFailure(maxFailure);
438                    }
439    
440                    Long lockoutDuration = (Long)attributes.get("lockoutDuration");
441    
442                    if (lockoutDuration != null) {
443                            setLockoutDuration(lockoutDuration);
444                    }
445    
446                    Boolean requireUnlock = (Boolean)attributes.get("requireUnlock");
447    
448                    if (requireUnlock != null) {
449                            setRequireUnlock(requireUnlock);
450                    }
451    
452                    Long resetFailureCount = (Long)attributes.get("resetFailureCount");
453    
454                    if (resetFailureCount != null) {
455                            setResetFailureCount(resetFailureCount);
456                    }
457    
458                    Long resetTicketMaxAge = (Long)attributes.get("resetTicketMaxAge");
459    
460                    if (resetTicketMaxAge != null) {
461                            setResetTicketMaxAge(resetTicketMaxAge);
462                    }
463            }
464    
465            @JSON
466            public long getPasswordPolicyId() {
467                    return _passwordPolicyId;
468            }
469    
470            public void setPasswordPolicyId(long passwordPolicyId) {
471                    _passwordPolicyId = passwordPolicyId;
472            }
473    
474            @JSON
475            public long getCompanyId() {
476                    return _companyId;
477            }
478    
479            public void setCompanyId(long companyId) {
480                    _columnBitmask |= COMPANYID_COLUMN_BITMASK;
481    
482                    if (!_setOriginalCompanyId) {
483                            _setOriginalCompanyId = true;
484    
485                            _originalCompanyId = _companyId;
486                    }
487    
488                    _companyId = companyId;
489            }
490    
491            public long getOriginalCompanyId() {
492                    return _originalCompanyId;
493            }
494    
495            @JSON
496            public long getUserId() {
497                    return _userId;
498            }
499    
500            public void setUserId(long userId) {
501                    _userId = userId;
502            }
503    
504            public String getUserUuid() throws SystemException {
505                    return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
506            }
507    
508            public void setUserUuid(String userUuid) {
509                    _userUuid = userUuid;
510            }
511    
512            @JSON
513            public String getUserName() {
514                    if (_userName == null) {
515                            return StringPool.BLANK;
516                    }
517                    else {
518                            return _userName;
519                    }
520            }
521    
522            public void setUserName(String userName) {
523                    _userName = userName;
524            }
525    
526            @JSON
527            public Date getCreateDate() {
528                    return _createDate;
529            }
530    
531            public void setCreateDate(Date createDate) {
532                    _createDate = createDate;
533            }
534    
535            @JSON
536            public Date getModifiedDate() {
537                    return _modifiedDate;
538            }
539    
540            public void setModifiedDate(Date modifiedDate) {
541                    _modifiedDate = modifiedDate;
542            }
543    
544            @JSON
545            public boolean getDefaultPolicy() {
546                    return _defaultPolicy;
547            }
548    
549            public boolean isDefaultPolicy() {
550                    return _defaultPolicy;
551            }
552    
553            public void setDefaultPolicy(boolean defaultPolicy) {
554                    _columnBitmask |= DEFAULTPOLICY_COLUMN_BITMASK;
555    
556                    if (!_setOriginalDefaultPolicy) {
557                            _setOriginalDefaultPolicy = true;
558    
559                            _originalDefaultPolicy = _defaultPolicy;
560                    }
561    
562                    _defaultPolicy = defaultPolicy;
563            }
564    
565            public boolean getOriginalDefaultPolicy() {
566                    return _originalDefaultPolicy;
567            }
568    
569            @JSON
570            public String getName() {
571                    if (_name == null) {
572                            return StringPool.BLANK;
573                    }
574                    else {
575                            return _name;
576                    }
577            }
578    
579            public void setName(String name) {
580                    _columnBitmask |= NAME_COLUMN_BITMASK;
581    
582                    if (_originalName == null) {
583                            _originalName = _name;
584                    }
585    
586                    _name = name;
587            }
588    
589            public String getOriginalName() {
590                    return GetterUtil.getString(_originalName);
591            }
592    
593            @JSON
594            public String getDescription() {
595                    if (_description == null) {
596                            return StringPool.BLANK;
597                    }
598                    else {
599                            return _description;
600                    }
601            }
602    
603            public void setDescription(String description) {
604                    _description = description;
605            }
606    
607            @JSON
608            public boolean getChangeable() {
609                    return _changeable;
610            }
611    
612            public boolean isChangeable() {
613                    return _changeable;
614            }
615    
616            public void setChangeable(boolean changeable) {
617                    _changeable = changeable;
618            }
619    
620            @JSON
621            public boolean getChangeRequired() {
622                    return _changeRequired;
623            }
624    
625            public boolean isChangeRequired() {
626                    return _changeRequired;
627            }
628    
629            public void setChangeRequired(boolean changeRequired) {
630                    _changeRequired = changeRequired;
631            }
632    
633            @JSON
634            public long getMinAge() {
635                    return _minAge;
636            }
637    
638            public void setMinAge(long minAge) {
639                    _minAge = minAge;
640            }
641    
642            @JSON
643            public boolean getCheckSyntax() {
644                    return _checkSyntax;
645            }
646    
647            public boolean isCheckSyntax() {
648                    return _checkSyntax;
649            }
650    
651            public void setCheckSyntax(boolean checkSyntax) {
652                    _checkSyntax = checkSyntax;
653            }
654    
655            @JSON
656            public boolean getAllowDictionaryWords() {
657                    return _allowDictionaryWords;
658            }
659    
660            public boolean isAllowDictionaryWords() {
661                    return _allowDictionaryWords;
662            }
663    
664            public void setAllowDictionaryWords(boolean allowDictionaryWords) {
665                    _allowDictionaryWords = allowDictionaryWords;
666            }
667    
668            @JSON
669            public int getMinAlphanumeric() {
670                    return _minAlphanumeric;
671            }
672    
673            public void setMinAlphanumeric(int minAlphanumeric) {
674                    _minAlphanumeric = minAlphanumeric;
675            }
676    
677            @JSON
678            public int getMinLength() {
679                    return _minLength;
680            }
681    
682            public void setMinLength(int minLength) {
683                    _minLength = minLength;
684            }
685    
686            @JSON
687            public int getMinLowerCase() {
688                    return _minLowerCase;
689            }
690    
691            public void setMinLowerCase(int minLowerCase) {
692                    _minLowerCase = minLowerCase;
693            }
694    
695            @JSON
696            public int getMinNumbers() {
697                    return _minNumbers;
698            }
699    
700            public void setMinNumbers(int minNumbers) {
701                    _minNumbers = minNumbers;
702            }
703    
704            @JSON
705            public int getMinSymbols() {
706                    return _minSymbols;
707            }
708    
709            public void setMinSymbols(int minSymbols) {
710                    _minSymbols = minSymbols;
711            }
712    
713            @JSON
714            public int getMinUpperCase() {
715                    return _minUpperCase;
716            }
717    
718            public void setMinUpperCase(int minUpperCase) {
719                    _minUpperCase = minUpperCase;
720            }
721    
722            @JSON
723            public String getRegex() {
724                    if (_regex == null) {
725                            return StringPool.BLANK;
726                    }
727                    else {
728                            return _regex;
729                    }
730            }
731    
732            public void setRegex(String regex) {
733                    _regex = regex;
734            }
735    
736            @JSON
737            public boolean getHistory() {
738                    return _history;
739            }
740    
741            public boolean isHistory() {
742                    return _history;
743            }
744    
745            public void setHistory(boolean history) {
746                    _history = history;
747            }
748    
749            @JSON
750            public int getHistoryCount() {
751                    return _historyCount;
752            }
753    
754            public void setHistoryCount(int historyCount) {
755                    _historyCount = historyCount;
756            }
757    
758            @JSON
759            public boolean getExpireable() {
760                    return _expireable;
761            }
762    
763            public boolean isExpireable() {
764                    return _expireable;
765            }
766    
767            public void setExpireable(boolean expireable) {
768                    _expireable = expireable;
769            }
770    
771            @JSON
772            public long getMaxAge() {
773                    return _maxAge;
774            }
775    
776            public void setMaxAge(long maxAge) {
777                    _maxAge = maxAge;
778            }
779    
780            @JSON
781            public long getWarningTime() {
782                    return _warningTime;
783            }
784    
785            public void setWarningTime(long warningTime) {
786                    _warningTime = warningTime;
787            }
788    
789            @JSON
790            public int getGraceLimit() {
791                    return _graceLimit;
792            }
793    
794            public void setGraceLimit(int graceLimit) {
795                    _graceLimit = graceLimit;
796            }
797    
798            @JSON
799            public boolean getLockout() {
800                    return _lockout;
801            }
802    
803            public boolean isLockout() {
804                    return _lockout;
805            }
806    
807            public void setLockout(boolean lockout) {
808                    _lockout = lockout;
809            }
810    
811            @JSON
812            public int getMaxFailure() {
813                    return _maxFailure;
814            }
815    
816            public void setMaxFailure(int maxFailure) {
817                    _maxFailure = maxFailure;
818            }
819    
820            @JSON
821            public long getLockoutDuration() {
822                    return _lockoutDuration;
823            }
824    
825            public void setLockoutDuration(long lockoutDuration) {
826                    _lockoutDuration = lockoutDuration;
827            }
828    
829            @JSON
830            public boolean getRequireUnlock() {
831                    return _requireUnlock;
832            }
833    
834            public boolean isRequireUnlock() {
835                    return _requireUnlock;
836            }
837    
838            public void setRequireUnlock(boolean requireUnlock) {
839                    _requireUnlock = requireUnlock;
840            }
841    
842            @JSON
843            public long getResetFailureCount() {
844                    return _resetFailureCount;
845            }
846    
847            public void setResetFailureCount(long resetFailureCount) {
848                    _resetFailureCount = resetFailureCount;
849            }
850    
851            @JSON
852            public long getResetTicketMaxAge() {
853                    return _resetTicketMaxAge;
854            }
855    
856            public void setResetTicketMaxAge(long resetTicketMaxAge) {
857                    _resetTicketMaxAge = resetTicketMaxAge;
858            }
859    
860            public long getColumnBitmask() {
861                    return _columnBitmask;
862            }
863    
864            @Override
865            public ExpandoBridge getExpandoBridge() {
866                    return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
867                            PasswordPolicy.class.getName(), getPrimaryKey());
868            }
869    
870            @Override
871            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
872                    ExpandoBridge expandoBridge = getExpandoBridge();
873    
874                    expandoBridge.setAttributes(serviceContext);
875            }
876    
877            @Override
878            public PasswordPolicy toEscapedModel() {
879                    if (_escapedModel == null) {
880                            _escapedModel = (PasswordPolicy)ProxyUtil.newProxyInstance(_classLoader,
881                                            _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
882                    }
883    
884                    return _escapedModel;
885            }
886    
887            @Override
888            public Object clone() {
889                    PasswordPolicyImpl passwordPolicyImpl = new PasswordPolicyImpl();
890    
891                    passwordPolicyImpl.setPasswordPolicyId(getPasswordPolicyId());
892                    passwordPolicyImpl.setCompanyId(getCompanyId());
893                    passwordPolicyImpl.setUserId(getUserId());
894                    passwordPolicyImpl.setUserName(getUserName());
895                    passwordPolicyImpl.setCreateDate(getCreateDate());
896                    passwordPolicyImpl.setModifiedDate(getModifiedDate());
897                    passwordPolicyImpl.setDefaultPolicy(getDefaultPolicy());
898                    passwordPolicyImpl.setName(getName());
899                    passwordPolicyImpl.setDescription(getDescription());
900                    passwordPolicyImpl.setChangeable(getChangeable());
901                    passwordPolicyImpl.setChangeRequired(getChangeRequired());
902                    passwordPolicyImpl.setMinAge(getMinAge());
903                    passwordPolicyImpl.setCheckSyntax(getCheckSyntax());
904                    passwordPolicyImpl.setAllowDictionaryWords(getAllowDictionaryWords());
905                    passwordPolicyImpl.setMinAlphanumeric(getMinAlphanumeric());
906                    passwordPolicyImpl.setMinLength(getMinLength());
907                    passwordPolicyImpl.setMinLowerCase(getMinLowerCase());
908                    passwordPolicyImpl.setMinNumbers(getMinNumbers());
909                    passwordPolicyImpl.setMinSymbols(getMinSymbols());
910                    passwordPolicyImpl.setMinUpperCase(getMinUpperCase());
911                    passwordPolicyImpl.setRegex(getRegex());
912                    passwordPolicyImpl.setHistory(getHistory());
913                    passwordPolicyImpl.setHistoryCount(getHistoryCount());
914                    passwordPolicyImpl.setExpireable(getExpireable());
915                    passwordPolicyImpl.setMaxAge(getMaxAge());
916                    passwordPolicyImpl.setWarningTime(getWarningTime());
917                    passwordPolicyImpl.setGraceLimit(getGraceLimit());
918                    passwordPolicyImpl.setLockout(getLockout());
919                    passwordPolicyImpl.setMaxFailure(getMaxFailure());
920                    passwordPolicyImpl.setLockoutDuration(getLockoutDuration());
921                    passwordPolicyImpl.setRequireUnlock(getRequireUnlock());
922                    passwordPolicyImpl.setResetFailureCount(getResetFailureCount());
923                    passwordPolicyImpl.setResetTicketMaxAge(getResetTicketMaxAge());
924    
925                    passwordPolicyImpl.resetOriginalValues();
926    
927                    return passwordPolicyImpl;
928            }
929    
930            public int compareTo(PasswordPolicy passwordPolicy) {
931                    long primaryKey = passwordPolicy.getPrimaryKey();
932    
933                    if (getPrimaryKey() < primaryKey) {
934                            return -1;
935                    }
936                    else if (getPrimaryKey() > primaryKey) {
937                            return 1;
938                    }
939                    else {
940                            return 0;
941                    }
942            }
943    
944            @Override
945            public boolean equals(Object obj) {
946                    if (obj == null) {
947                            return false;
948                    }
949    
950                    PasswordPolicy passwordPolicy = null;
951    
952                    try {
953                            passwordPolicy = (PasswordPolicy)obj;
954                    }
955                    catch (ClassCastException cce) {
956                            return false;
957                    }
958    
959                    long primaryKey = passwordPolicy.getPrimaryKey();
960    
961                    if (getPrimaryKey() == primaryKey) {
962                            return true;
963                    }
964                    else {
965                            return false;
966                    }
967            }
968    
969            @Override
970            public int hashCode() {
971                    return (int)getPrimaryKey();
972            }
973    
974            @Override
975            public void resetOriginalValues() {
976                    PasswordPolicyModelImpl passwordPolicyModelImpl = this;
977    
978                    passwordPolicyModelImpl._originalCompanyId = passwordPolicyModelImpl._companyId;
979    
980                    passwordPolicyModelImpl._setOriginalCompanyId = false;
981    
982                    passwordPolicyModelImpl._originalDefaultPolicy = passwordPolicyModelImpl._defaultPolicy;
983    
984                    passwordPolicyModelImpl._setOriginalDefaultPolicy = false;
985    
986                    passwordPolicyModelImpl._originalName = passwordPolicyModelImpl._name;
987    
988                    passwordPolicyModelImpl._columnBitmask = 0;
989            }
990    
991            @Override
992            public CacheModel<PasswordPolicy> toCacheModel() {
993                    PasswordPolicyCacheModel passwordPolicyCacheModel = new PasswordPolicyCacheModel();
994    
995                    passwordPolicyCacheModel.passwordPolicyId = getPasswordPolicyId();
996    
997                    passwordPolicyCacheModel.companyId = getCompanyId();
998    
999                    passwordPolicyCacheModel.userId = getUserId();
1000    
1001                    passwordPolicyCacheModel.userName = getUserName();
1002    
1003                    String userName = passwordPolicyCacheModel.userName;
1004    
1005                    if ((userName != null) && (userName.length() == 0)) {
1006                            passwordPolicyCacheModel.userName = null;
1007                    }
1008    
1009                    Date createDate = getCreateDate();
1010    
1011                    if (createDate != null) {
1012                            passwordPolicyCacheModel.createDate = createDate.getTime();
1013                    }
1014                    else {
1015                            passwordPolicyCacheModel.createDate = Long.MIN_VALUE;
1016                    }
1017    
1018                    Date modifiedDate = getModifiedDate();
1019    
1020                    if (modifiedDate != null) {
1021                            passwordPolicyCacheModel.modifiedDate = modifiedDate.getTime();
1022                    }
1023                    else {
1024                            passwordPolicyCacheModel.modifiedDate = Long.MIN_VALUE;
1025                    }
1026    
1027                    passwordPolicyCacheModel.defaultPolicy = getDefaultPolicy();
1028    
1029                    passwordPolicyCacheModel.name = getName();
1030    
1031                    String name = passwordPolicyCacheModel.name;
1032    
1033                    if ((name != null) && (name.length() == 0)) {
1034                            passwordPolicyCacheModel.name = null;
1035                    }
1036    
1037                    passwordPolicyCacheModel.description = getDescription();
1038    
1039                    String description = passwordPolicyCacheModel.description;
1040    
1041                    if ((description != null) && (description.length() == 0)) {
1042                            passwordPolicyCacheModel.description = null;
1043                    }
1044    
1045                    passwordPolicyCacheModel.changeable = getChangeable();
1046    
1047                    passwordPolicyCacheModel.changeRequired = getChangeRequired();
1048    
1049                    passwordPolicyCacheModel.minAge = getMinAge();
1050    
1051                    passwordPolicyCacheModel.checkSyntax = getCheckSyntax();
1052    
1053                    passwordPolicyCacheModel.allowDictionaryWords = getAllowDictionaryWords();
1054    
1055                    passwordPolicyCacheModel.minAlphanumeric = getMinAlphanumeric();
1056    
1057                    passwordPolicyCacheModel.minLength = getMinLength();
1058    
1059                    passwordPolicyCacheModel.minLowerCase = getMinLowerCase();
1060    
1061                    passwordPolicyCacheModel.minNumbers = getMinNumbers();
1062    
1063                    passwordPolicyCacheModel.minSymbols = getMinSymbols();
1064    
1065                    passwordPolicyCacheModel.minUpperCase = getMinUpperCase();
1066    
1067                    passwordPolicyCacheModel.regex = getRegex();
1068    
1069                    String regex = passwordPolicyCacheModel.regex;
1070    
1071                    if ((regex != null) && (regex.length() == 0)) {
1072                            passwordPolicyCacheModel.regex = null;
1073                    }
1074    
1075                    passwordPolicyCacheModel.history = getHistory();
1076    
1077                    passwordPolicyCacheModel.historyCount = getHistoryCount();
1078    
1079                    passwordPolicyCacheModel.expireable = getExpireable();
1080    
1081                    passwordPolicyCacheModel.maxAge = getMaxAge();
1082    
1083                    passwordPolicyCacheModel.warningTime = getWarningTime();
1084    
1085                    passwordPolicyCacheModel.graceLimit = getGraceLimit();
1086    
1087                    passwordPolicyCacheModel.lockout = getLockout();
1088    
1089                    passwordPolicyCacheModel.maxFailure = getMaxFailure();
1090    
1091                    passwordPolicyCacheModel.lockoutDuration = getLockoutDuration();
1092    
1093                    passwordPolicyCacheModel.requireUnlock = getRequireUnlock();
1094    
1095                    passwordPolicyCacheModel.resetFailureCount = getResetFailureCount();
1096    
1097                    passwordPolicyCacheModel.resetTicketMaxAge = getResetTicketMaxAge();
1098    
1099                    return passwordPolicyCacheModel;
1100            }
1101    
1102            @Override
1103            public String toString() {
1104                    StringBundler sb = new StringBundler(67);
1105    
1106                    sb.append("{passwordPolicyId=");
1107                    sb.append(getPasswordPolicyId());
1108                    sb.append(", companyId=");
1109                    sb.append(getCompanyId());
1110                    sb.append(", userId=");
1111                    sb.append(getUserId());
1112                    sb.append(", userName=");
1113                    sb.append(getUserName());
1114                    sb.append(", createDate=");
1115                    sb.append(getCreateDate());
1116                    sb.append(", modifiedDate=");
1117                    sb.append(getModifiedDate());
1118                    sb.append(", defaultPolicy=");
1119                    sb.append(getDefaultPolicy());
1120                    sb.append(", name=");
1121                    sb.append(getName());
1122                    sb.append(", description=");
1123                    sb.append(getDescription());
1124                    sb.append(", changeable=");
1125                    sb.append(getChangeable());
1126                    sb.append(", changeRequired=");
1127                    sb.append(getChangeRequired());
1128                    sb.append(", minAge=");
1129                    sb.append(getMinAge());
1130                    sb.append(", checkSyntax=");
1131                    sb.append(getCheckSyntax());
1132                    sb.append(", allowDictionaryWords=");
1133                    sb.append(getAllowDictionaryWords());
1134                    sb.append(", minAlphanumeric=");
1135                    sb.append(getMinAlphanumeric());
1136                    sb.append(", minLength=");
1137                    sb.append(getMinLength());
1138                    sb.append(", minLowerCase=");
1139                    sb.append(getMinLowerCase());
1140                    sb.append(", minNumbers=");
1141                    sb.append(getMinNumbers());
1142                    sb.append(", minSymbols=");
1143                    sb.append(getMinSymbols());
1144                    sb.append(", minUpperCase=");
1145                    sb.append(getMinUpperCase());
1146                    sb.append(", regex=");
1147                    sb.append(getRegex());
1148                    sb.append(", history=");
1149                    sb.append(getHistory());
1150                    sb.append(", historyCount=");
1151                    sb.append(getHistoryCount());
1152                    sb.append(", expireable=");
1153                    sb.append(getExpireable());
1154                    sb.append(", maxAge=");
1155                    sb.append(getMaxAge());
1156                    sb.append(", warningTime=");
1157                    sb.append(getWarningTime());
1158                    sb.append(", graceLimit=");
1159                    sb.append(getGraceLimit());
1160                    sb.append(", lockout=");
1161                    sb.append(getLockout());
1162                    sb.append(", maxFailure=");
1163                    sb.append(getMaxFailure());
1164                    sb.append(", lockoutDuration=");
1165                    sb.append(getLockoutDuration());
1166                    sb.append(", requireUnlock=");
1167                    sb.append(getRequireUnlock());
1168                    sb.append(", resetFailureCount=");
1169                    sb.append(getResetFailureCount());
1170                    sb.append(", resetTicketMaxAge=");
1171                    sb.append(getResetTicketMaxAge());
1172                    sb.append("}");
1173    
1174                    return sb.toString();
1175            }
1176    
1177            public String toXmlString() {
1178                    StringBundler sb = new StringBundler(103);
1179    
1180                    sb.append("<model><model-name>");
1181                    sb.append("com.liferay.portal.model.PasswordPolicy");
1182                    sb.append("</model-name>");
1183    
1184                    sb.append(
1185                            "<column><column-name>passwordPolicyId</column-name><column-value><![CDATA[");
1186                    sb.append(getPasswordPolicyId());
1187                    sb.append("]]></column-value></column>");
1188                    sb.append(
1189                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
1190                    sb.append(getCompanyId());
1191                    sb.append("]]></column-value></column>");
1192                    sb.append(
1193                            "<column><column-name>userId</column-name><column-value><![CDATA[");
1194                    sb.append(getUserId());
1195                    sb.append("]]></column-value></column>");
1196                    sb.append(
1197                            "<column><column-name>userName</column-name><column-value><![CDATA[");
1198                    sb.append(getUserName());
1199                    sb.append("]]></column-value></column>");
1200                    sb.append(
1201                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
1202                    sb.append(getCreateDate());
1203                    sb.append("]]></column-value></column>");
1204                    sb.append(
1205                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
1206                    sb.append(getModifiedDate());
1207                    sb.append("]]></column-value></column>");
1208                    sb.append(
1209                            "<column><column-name>defaultPolicy</column-name><column-value><![CDATA[");
1210                    sb.append(getDefaultPolicy());
1211                    sb.append("]]></column-value></column>");
1212                    sb.append(
1213                            "<column><column-name>name</column-name><column-value><![CDATA[");
1214                    sb.append(getName());
1215                    sb.append("]]></column-value></column>");
1216                    sb.append(
1217                            "<column><column-name>description</column-name><column-value><![CDATA[");
1218                    sb.append(getDescription());
1219                    sb.append("]]></column-value></column>");
1220                    sb.append(
1221                            "<column><column-name>changeable</column-name><column-value><![CDATA[");
1222                    sb.append(getChangeable());
1223                    sb.append("]]></column-value></column>");
1224                    sb.append(
1225                            "<column><column-name>changeRequired</column-name><column-value><![CDATA[");
1226                    sb.append(getChangeRequired());
1227                    sb.append("]]></column-value></column>");
1228                    sb.append(
1229                            "<column><column-name>minAge</column-name><column-value><![CDATA[");
1230                    sb.append(getMinAge());
1231                    sb.append("]]></column-value></column>");
1232                    sb.append(
1233                            "<column><column-name>checkSyntax</column-name><column-value><![CDATA[");
1234                    sb.append(getCheckSyntax());
1235                    sb.append("]]></column-value></column>");
1236                    sb.append(
1237                            "<column><column-name>allowDictionaryWords</column-name><column-value><![CDATA[");
1238                    sb.append(getAllowDictionaryWords());
1239                    sb.append("]]></column-value></column>");
1240                    sb.append(
1241                            "<column><column-name>minAlphanumeric</column-name><column-value><![CDATA[");
1242                    sb.append(getMinAlphanumeric());
1243                    sb.append("]]></column-value></column>");
1244                    sb.append(
1245                            "<column><column-name>minLength</column-name><column-value><![CDATA[");
1246                    sb.append(getMinLength());
1247                    sb.append("]]></column-value></column>");
1248                    sb.append(
1249                            "<column><column-name>minLowerCase</column-name><column-value><![CDATA[");
1250                    sb.append(getMinLowerCase());
1251                    sb.append("]]></column-value></column>");
1252                    sb.append(
1253                            "<column><column-name>minNumbers</column-name><column-value><![CDATA[");
1254                    sb.append(getMinNumbers());
1255                    sb.append("]]></column-value></column>");
1256                    sb.append(
1257                            "<column><column-name>minSymbols</column-name><column-value><![CDATA[");
1258                    sb.append(getMinSymbols());
1259                    sb.append("]]></column-value></column>");
1260                    sb.append(
1261                            "<column><column-name>minUpperCase</column-name><column-value><![CDATA[");
1262                    sb.append(getMinUpperCase());
1263                    sb.append("]]></column-value></column>");
1264                    sb.append(
1265                            "<column><column-name>regex</column-name><column-value><![CDATA[");
1266                    sb.append(getRegex());
1267                    sb.append("]]></column-value></column>");
1268                    sb.append(
1269                            "<column><column-name>history</column-name><column-value><![CDATA[");
1270                    sb.append(getHistory());
1271                    sb.append("]]></column-value></column>");
1272                    sb.append(
1273                            "<column><column-name>historyCount</column-name><column-value><![CDATA[");
1274                    sb.append(getHistoryCount());
1275                    sb.append("]]></column-value></column>");
1276                    sb.append(
1277                            "<column><column-name>expireable</column-name><column-value><![CDATA[");
1278                    sb.append(getExpireable());
1279                    sb.append("]]></column-value></column>");
1280                    sb.append(
1281                            "<column><column-name>maxAge</column-name><column-value><![CDATA[");
1282                    sb.append(getMaxAge());
1283                    sb.append("]]></column-value></column>");
1284                    sb.append(
1285                            "<column><column-name>warningTime</column-name><column-value><![CDATA[");
1286                    sb.append(getWarningTime());
1287                    sb.append("]]></column-value></column>");
1288                    sb.append(
1289                            "<column><column-name>graceLimit</column-name><column-value><![CDATA[");
1290                    sb.append(getGraceLimit());
1291                    sb.append("]]></column-value></column>");
1292                    sb.append(
1293                            "<column><column-name>lockout</column-name><column-value><![CDATA[");
1294                    sb.append(getLockout());
1295                    sb.append("]]></column-value></column>");
1296                    sb.append(
1297                            "<column><column-name>maxFailure</column-name><column-value><![CDATA[");
1298                    sb.append(getMaxFailure());
1299                    sb.append("]]></column-value></column>");
1300                    sb.append(
1301                            "<column><column-name>lockoutDuration</column-name><column-value><![CDATA[");
1302                    sb.append(getLockoutDuration());
1303                    sb.append("]]></column-value></column>");
1304                    sb.append(
1305                            "<column><column-name>requireUnlock</column-name><column-value><![CDATA[");
1306                    sb.append(getRequireUnlock());
1307                    sb.append("]]></column-value></column>");
1308                    sb.append(
1309                            "<column><column-name>resetFailureCount</column-name><column-value><![CDATA[");
1310                    sb.append(getResetFailureCount());
1311                    sb.append("]]></column-value></column>");
1312                    sb.append(
1313                            "<column><column-name>resetTicketMaxAge</column-name><column-value><![CDATA[");
1314                    sb.append(getResetTicketMaxAge());
1315                    sb.append("]]></column-value></column>");
1316    
1317                    sb.append("</model>");
1318    
1319                    return sb.toString();
1320            }
1321    
1322            private static ClassLoader _classLoader = PasswordPolicy.class.getClassLoader();
1323            private static Class<?>[] _escapedModelInterfaces = new Class[] {
1324                            PasswordPolicy.class
1325                    };
1326            private long _passwordPolicyId;
1327            private long _companyId;
1328            private long _originalCompanyId;
1329            private boolean _setOriginalCompanyId;
1330            private long _userId;
1331            private String _userUuid;
1332            private String _userName;
1333            private Date _createDate;
1334            private Date _modifiedDate;
1335            private boolean _defaultPolicy;
1336            private boolean _originalDefaultPolicy;
1337            private boolean _setOriginalDefaultPolicy;
1338            private String _name;
1339            private String _originalName;
1340            private String _description;
1341            private boolean _changeable;
1342            private boolean _changeRequired;
1343            private long _minAge;
1344            private boolean _checkSyntax;
1345            private boolean _allowDictionaryWords;
1346            private int _minAlphanumeric;
1347            private int _minLength;
1348            private int _minLowerCase;
1349            private int _minNumbers;
1350            private int _minSymbols;
1351            private int _minUpperCase;
1352            private String _regex;
1353            private boolean _history;
1354            private int _historyCount;
1355            private boolean _expireable;
1356            private long _maxAge;
1357            private long _warningTime;
1358            private int _graceLimit;
1359            private boolean _lockout;
1360            private int _maxFailure;
1361            private long _lockoutDuration;
1362            private boolean _requireUnlock;
1363            private long _resetFailureCount;
1364            private long _resetTicketMaxAge;
1365            private long _columnBitmask;
1366            private PasswordPolicy _escapedModel;
1367    }