001    /**
002     * Copyright (c) 2000-present 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 aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
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.kernel.util.Validator;
025    import com.liferay.portal.model.CacheModel;
026    import com.liferay.portal.model.PasswordPolicyRel;
027    import com.liferay.portal.model.PasswordPolicyRelModel;
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.HashMap;
039    import java.util.Map;
040    
041    /**
042     * The base model implementation for the PasswordPolicyRel service. Represents a row in the "PasswordPolicyRel" database table, with each column mapped to a property of this class.
043     *
044     * <p>
045     * This implementation and its corresponding interface {@link PasswordPolicyRelModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link PasswordPolicyRelImpl}.
046     * </p>
047     *
048     * @author Brian Wing Shun Chan
049     * @see PasswordPolicyRelImpl
050     * @see PasswordPolicyRel
051     * @see PasswordPolicyRelModel
052     * @generated
053     */
054    @ProviderType
055    public class PasswordPolicyRelModelImpl extends BaseModelImpl<PasswordPolicyRel>
056            implements PasswordPolicyRelModel {
057            /*
058             * NOTE FOR DEVELOPERS:
059             *
060             * Never modify or reference this class directly. All methods that expect a password policy rel model instance should use the {@link PasswordPolicyRel} interface instead.
061             */
062            public static final String TABLE_NAME = "PasswordPolicyRel";
063            public static final Object[][] TABLE_COLUMNS = {
064                            { "mvccVersion", Types.BIGINT },
065                            { "passwordPolicyRelId", Types.BIGINT },
066                            { "companyId", Types.BIGINT },
067                            { "passwordPolicyId", Types.BIGINT },
068                            { "classNameId", Types.BIGINT },
069                            { "classPK", Types.BIGINT }
070                    };
071            public static final Map<String, Integer> TABLE_COLUMNS_MAP = new HashMap<String, Integer>();
072    
073            static {
074                    TABLE_COLUMNS_MAP.put("mvccVersion", Types.BIGINT);
075                    TABLE_COLUMNS_MAP.put("passwordPolicyRelId", Types.BIGINT);
076                    TABLE_COLUMNS_MAP.put("companyId", Types.BIGINT);
077                    TABLE_COLUMNS_MAP.put("passwordPolicyId", Types.BIGINT);
078                    TABLE_COLUMNS_MAP.put("classNameId", Types.BIGINT);
079                    TABLE_COLUMNS_MAP.put("classPK", Types.BIGINT);
080            }
081    
082            public static final String TABLE_SQL_CREATE = "create table PasswordPolicyRel (mvccVersion LONG default 0,passwordPolicyRelId LONG not null primary key,companyId LONG,passwordPolicyId LONG,classNameId LONG,classPK LONG)";
083            public static final String TABLE_SQL_DROP = "drop table PasswordPolicyRel";
084            public static final String ORDER_BY_JPQL = " ORDER BY passwordPolicyRel.passwordPolicyRelId ASC";
085            public static final String ORDER_BY_SQL = " ORDER BY PasswordPolicyRel.passwordPolicyRelId ASC";
086            public static final String DATA_SOURCE = "liferayDataSource";
087            public static final String SESSION_FACTORY = "liferaySessionFactory";
088            public static final String TX_MANAGER = "liferayTransactionManager";
089            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
090                                    "value.object.entity.cache.enabled.com.liferay.portal.model.PasswordPolicyRel"),
091                            true);
092            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
093                                    "value.object.finder.cache.enabled.com.liferay.portal.model.PasswordPolicyRel"),
094                            true);
095            public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
096                                    "value.object.column.bitmask.enabled.com.liferay.portal.model.PasswordPolicyRel"),
097                            true);
098            public static final long CLASSNAMEID_COLUMN_BITMASK = 1L;
099            public static final long CLASSPK_COLUMN_BITMASK = 2L;
100            public static final long PASSWORDPOLICYID_COLUMN_BITMASK = 4L;
101            public static final long PASSWORDPOLICYRELID_COLUMN_BITMASK = 8L;
102            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
103                                    "lock.expiration.time.com.liferay.portal.model.PasswordPolicyRel"));
104    
105            public PasswordPolicyRelModelImpl() {
106            }
107    
108            @Override
109            public long getPrimaryKey() {
110                    return _passwordPolicyRelId;
111            }
112    
113            @Override
114            public void setPrimaryKey(long primaryKey) {
115                    setPasswordPolicyRelId(primaryKey);
116            }
117    
118            @Override
119            public Serializable getPrimaryKeyObj() {
120                    return _passwordPolicyRelId;
121            }
122    
123            @Override
124            public void setPrimaryKeyObj(Serializable primaryKeyObj) {
125                    setPrimaryKey(((Long)primaryKeyObj).longValue());
126            }
127    
128            @Override
129            public Class<?> getModelClass() {
130                    return PasswordPolicyRel.class;
131            }
132    
133            @Override
134            public String getModelClassName() {
135                    return PasswordPolicyRel.class.getName();
136            }
137    
138            @Override
139            public Map<String, Object> getModelAttributes() {
140                    Map<String, Object> attributes = new HashMap<String, Object>();
141    
142                    attributes.put("mvccVersion", getMvccVersion());
143                    attributes.put("passwordPolicyRelId", getPasswordPolicyRelId());
144                    attributes.put("companyId", getCompanyId());
145                    attributes.put("passwordPolicyId", getPasswordPolicyId());
146                    attributes.put("classNameId", getClassNameId());
147                    attributes.put("classPK", getClassPK());
148    
149                    attributes.put("entityCacheEnabled", isEntityCacheEnabled());
150                    attributes.put("finderCacheEnabled", isFinderCacheEnabled());
151    
152                    return attributes;
153            }
154    
155            @Override
156            public void setModelAttributes(Map<String, Object> attributes) {
157                    Long mvccVersion = (Long)attributes.get("mvccVersion");
158    
159                    if (mvccVersion != null) {
160                            setMvccVersion(mvccVersion);
161                    }
162    
163                    Long passwordPolicyRelId = (Long)attributes.get("passwordPolicyRelId");
164    
165                    if (passwordPolicyRelId != null) {
166                            setPasswordPolicyRelId(passwordPolicyRelId);
167                    }
168    
169                    Long companyId = (Long)attributes.get("companyId");
170    
171                    if (companyId != null) {
172                            setCompanyId(companyId);
173                    }
174    
175                    Long passwordPolicyId = (Long)attributes.get("passwordPolicyId");
176    
177                    if (passwordPolicyId != null) {
178                            setPasswordPolicyId(passwordPolicyId);
179                    }
180    
181                    Long classNameId = (Long)attributes.get("classNameId");
182    
183                    if (classNameId != null) {
184                            setClassNameId(classNameId);
185                    }
186    
187                    Long classPK = (Long)attributes.get("classPK");
188    
189                    if (classPK != null) {
190                            setClassPK(classPK);
191                    }
192            }
193    
194            @Override
195            public long getMvccVersion() {
196                    return _mvccVersion;
197            }
198    
199            @Override
200            public void setMvccVersion(long mvccVersion) {
201                    _mvccVersion = mvccVersion;
202            }
203    
204            @Override
205            public long getPasswordPolicyRelId() {
206                    return _passwordPolicyRelId;
207            }
208    
209            @Override
210            public void setPasswordPolicyRelId(long passwordPolicyRelId) {
211                    _passwordPolicyRelId = passwordPolicyRelId;
212            }
213    
214            @Override
215            public long getCompanyId() {
216                    return _companyId;
217            }
218    
219            @Override
220            public void setCompanyId(long companyId) {
221                    _companyId = companyId;
222            }
223    
224            @Override
225            public long getPasswordPolicyId() {
226                    return _passwordPolicyId;
227            }
228    
229            @Override
230            public void setPasswordPolicyId(long passwordPolicyId) {
231                    _columnBitmask |= PASSWORDPOLICYID_COLUMN_BITMASK;
232    
233                    if (!_setOriginalPasswordPolicyId) {
234                            _setOriginalPasswordPolicyId = true;
235    
236                            _originalPasswordPolicyId = _passwordPolicyId;
237                    }
238    
239                    _passwordPolicyId = passwordPolicyId;
240            }
241    
242            public long getOriginalPasswordPolicyId() {
243                    return _originalPasswordPolicyId;
244            }
245    
246            @Override
247            public String getClassName() {
248                    if (getClassNameId() <= 0) {
249                            return StringPool.BLANK;
250                    }
251    
252                    return PortalUtil.getClassName(getClassNameId());
253            }
254    
255            @Override
256            public void setClassName(String className) {
257                    long classNameId = 0;
258    
259                    if (Validator.isNotNull(className)) {
260                            classNameId = PortalUtil.getClassNameId(className);
261                    }
262    
263                    setClassNameId(classNameId);
264            }
265    
266            @Override
267            public long getClassNameId() {
268                    return _classNameId;
269            }
270    
271            @Override
272            public void setClassNameId(long classNameId) {
273                    _columnBitmask |= CLASSNAMEID_COLUMN_BITMASK;
274    
275                    if (!_setOriginalClassNameId) {
276                            _setOriginalClassNameId = true;
277    
278                            _originalClassNameId = _classNameId;
279                    }
280    
281                    _classNameId = classNameId;
282            }
283    
284            public long getOriginalClassNameId() {
285                    return _originalClassNameId;
286            }
287    
288            @Override
289            public long getClassPK() {
290                    return _classPK;
291            }
292    
293            @Override
294            public void setClassPK(long classPK) {
295                    _columnBitmask |= CLASSPK_COLUMN_BITMASK;
296    
297                    if (!_setOriginalClassPK) {
298                            _setOriginalClassPK = true;
299    
300                            _originalClassPK = _classPK;
301                    }
302    
303                    _classPK = classPK;
304            }
305    
306            public long getOriginalClassPK() {
307                    return _originalClassPK;
308            }
309    
310            public long getColumnBitmask() {
311                    return _columnBitmask;
312            }
313    
314            @Override
315            public ExpandoBridge getExpandoBridge() {
316                    return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
317                            PasswordPolicyRel.class.getName(), getPrimaryKey());
318            }
319    
320            @Override
321            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
322                    ExpandoBridge expandoBridge = getExpandoBridge();
323    
324                    expandoBridge.setAttributes(serviceContext);
325            }
326    
327            @Override
328            public PasswordPolicyRel toEscapedModel() {
329                    if (_escapedModel == null) {
330                            _escapedModel = (PasswordPolicyRel)ProxyUtil.newProxyInstance(_classLoader,
331                                            _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
332                    }
333    
334                    return _escapedModel;
335            }
336    
337            @Override
338            public Object clone() {
339                    PasswordPolicyRelImpl passwordPolicyRelImpl = new PasswordPolicyRelImpl();
340    
341                    passwordPolicyRelImpl.setMvccVersion(getMvccVersion());
342                    passwordPolicyRelImpl.setPasswordPolicyRelId(getPasswordPolicyRelId());
343                    passwordPolicyRelImpl.setCompanyId(getCompanyId());
344                    passwordPolicyRelImpl.setPasswordPolicyId(getPasswordPolicyId());
345                    passwordPolicyRelImpl.setClassNameId(getClassNameId());
346                    passwordPolicyRelImpl.setClassPK(getClassPK());
347    
348                    passwordPolicyRelImpl.resetOriginalValues();
349    
350                    return passwordPolicyRelImpl;
351            }
352    
353            @Override
354            public int compareTo(PasswordPolicyRel passwordPolicyRel) {
355                    long primaryKey = passwordPolicyRel.getPrimaryKey();
356    
357                    if (getPrimaryKey() < primaryKey) {
358                            return -1;
359                    }
360                    else if (getPrimaryKey() > primaryKey) {
361                            return 1;
362                    }
363                    else {
364                            return 0;
365                    }
366            }
367    
368            @Override
369            public boolean equals(Object obj) {
370                    if (this == obj) {
371                            return true;
372                    }
373    
374                    if (!(obj instanceof PasswordPolicyRel)) {
375                            return false;
376                    }
377    
378                    PasswordPolicyRel passwordPolicyRel = (PasswordPolicyRel)obj;
379    
380                    long primaryKey = passwordPolicyRel.getPrimaryKey();
381    
382                    if (getPrimaryKey() == primaryKey) {
383                            return true;
384                    }
385                    else {
386                            return false;
387                    }
388            }
389    
390            @Override
391            public int hashCode() {
392                    return (int)getPrimaryKey();
393            }
394    
395            @Override
396            public boolean isEntityCacheEnabled() {
397                    return ENTITY_CACHE_ENABLED;
398            }
399    
400            @Override
401            public boolean isFinderCacheEnabled() {
402                    return FINDER_CACHE_ENABLED;
403            }
404    
405            @Override
406            public void resetOriginalValues() {
407                    PasswordPolicyRelModelImpl passwordPolicyRelModelImpl = this;
408    
409                    passwordPolicyRelModelImpl._originalPasswordPolicyId = passwordPolicyRelModelImpl._passwordPolicyId;
410    
411                    passwordPolicyRelModelImpl._setOriginalPasswordPolicyId = false;
412    
413                    passwordPolicyRelModelImpl._originalClassNameId = passwordPolicyRelModelImpl._classNameId;
414    
415                    passwordPolicyRelModelImpl._setOriginalClassNameId = false;
416    
417                    passwordPolicyRelModelImpl._originalClassPK = passwordPolicyRelModelImpl._classPK;
418    
419                    passwordPolicyRelModelImpl._setOriginalClassPK = false;
420    
421                    passwordPolicyRelModelImpl._columnBitmask = 0;
422            }
423    
424            @Override
425            public CacheModel<PasswordPolicyRel> toCacheModel() {
426                    PasswordPolicyRelCacheModel passwordPolicyRelCacheModel = new PasswordPolicyRelCacheModel();
427    
428                    passwordPolicyRelCacheModel.mvccVersion = getMvccVersion();
429    
430                    passwordPolicyRelCacheModel.passwordPolicyRelId = getPasswordPolicyRelId();
431    
432                    passwordPolicyRelCacheModel.companyId = getCompanyId();
433    
434                    passwordPolicyRelCacheModel.passwordPolicyId = getPasswordPolicyId();
435    
436                    passwordPolicyRelCacheModel.classNameId = getClassNameId();
437    
438                    passwordPolicyRelCacheModel.classPK = getClassPK();
439    
440                    return passwordPolicyRelCacheModel;
441            }
442    
443            @Override
444            public String toString() {
445                    StringBundler sb = new StringBundler(13);
446    
447                    sb.append("{mvccVersion=");
448                    sb.append(getMvccVersion());
449                    sb.append(", passwordPolicyRelId=");
450                    sb.append(getPasswordPolicyRelId());
451                    sb.append(", companyId=");
452                    sb.append(getCompanyId());
453                    sb.append(", passwordPolicyId=");
454                    sb.append(getPasswordPolicyId());
455                    sb.append(", classNameId=");
456                    sb.append(getClassNameId());
457                    sb.append(", classPK=");
458                    sb.append(getClassPK());
459                    sb.append("}");
460    
461                    return sb.toString();
462            }
463    
464            @Override
465            public String toXmlString() {
466                    StringBundler sb = new StringBundler(22);
467    
468                    sb.append("<model><model-name>");
469                    sb.append("com.liferay.portal.model.PasswordPolicyRel");
470                    sb.append("</model-name>");
471    
472                    sb.append(
473                            "<column><column-name>mvccVersion</column-name><column-value><![CDATA[");
474                    sb.append(getMvccVersion());
475                    sb.append("]]></column-value></column>");
476                    sb.append(
477                            "<column><column-name>passwordPolicyRelId</column-name><column-value><![CDATA[");
478                    sb.append(getPasswordPolicyRelId());
479                    sb.append("]]></column-value></column>");
480                    sb.append(
481                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
482                    sb.append(getCompanyId());
483                    sb.append("]]></column-value></column>");
484                    sb.append(
485                            "<column><column-name>passwordPolicyId</column-name><column-value><![CDATA[");
486                    sb.append(getPasswordPolicyId());
487                    sb.append("]]></column-value></column>");
488                    sb.append(
489                            "<column><column-name>classNameId</column-name><column-value><![CDATA[");
490                    sb.append(getClassNameId());
491                    sb.append("]]></column-value></column>");
492                    sb.append(
493                            "<column><column-name>classPK</column-name><column-value><![CDATA[");
494                    sb.append(getClassPK());
495                    sb.append("]]></column-value></column>");
496    
497                    sb.append("</model>");
498    
499                    return sb.toString();
500            }
501    
502            private static final ClassLoader _classLoader = PasswordPolicyRel.class.getClassLoader();
503            private static final Class<?>[] _escapedModelInterfaces = new Class[] {
504                            PasswordPolicyRel.class
505                    };
506            private long _mvccVersion;
507            private long _passwordPolicyRelId;
508            private long _companyId;
509            private long _passwordPolicyId;
510            private long _originalPasswordPolicyId;
511            private boolean _setOriginalPasswordPolicyId;
512            private long _classNameId;
513            private long _originalClassNameId;
514            private boolean _setOriginalClassNameId;
515            private long _classPK;
516            private long _originalClassPK;
517            private boolean _setOriginalClassPK;
518            private long _columnBitmask;
519            private PasswordPolicyRel _escapedModel;
520    }