001    /**
002     * Copyright (c) 2000-2011 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.util.GetterUtil;
019    import com.liferay.portal.kernel.util.StringBundler;
020    import com.liferay.portal.kernel.util.StringPool;
021    import com.liferay.portal.model.PasswordPolicyRel;
022    import com.liferay.portal.model.PasswordPolicyRelModel;
023    import com.liferay.portal.service.ServiceContext;
024    import com.liferay.portal.util.PortalUtil;
025    
026    import com.liferay.portlet.expando.model.ExpandoBridge;
027    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
028    
029    import java.io.Serializable;
030    
031    import java.lang.reflect.Proxy;
032    
033    import java.sql.Types;
034    
035    /**
036     * 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.
037     *
038     * <p>
039     * This implementation and its corresponding interface {@link com.liferay.portal.model.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}.
040     * </p>
041     *
042     * <p>
043     * Never modify or reference this class directly. All methods that expect a password policy rel model instance should use the {@link com.liferay.portal.model.PasswordPolicyRel} interface instead.
044     * </p>
045     *
046     * @author Brian Wing Shun Chan
047     * @see PasswordPolicyRelImpl
048     * @see com.liferay.portal.model.PasswordPolicyRel
049     * @see com.liferay.portal.model.PasswordPolicyRelModel
050     * @generated
051     */
052    public class PasswordPolicyRelModelImpl extends BaseModelImpl<PasswordPolicyRel>
053            implements PasswordPolicyRelModel {
054            public static final String TABLE_NAME = "PasswordPolicyRel";
055            public static final Object[][] TABLE_COLUMNS = {
056                            { "passwordPolicyRelId", new Integer(Types.BIGINT) },
057                            { "passwordPolicyId", new Integer(Types.BIGINT) },
058                            { "classNameId", new Integer(Types.BIGINT) },
059                            { "classPK", new Integer(Types.BIGINT) }
060                    };
061            public static final String TABLE_SQL_CREATE = "create table PasswordPolicyRel (passwordPolicyRelId LONG not null primary key,passwordPolicyId LONG,classNameId LONG,classPK LONG)";
062            public static final String TABLE_SQL_DROP = "drop table PasswordPolicyRel";
063            public static final String DATA_SOURCE = "liferayDataSource";
064            public static final String SESSION_FACTORY = "liferaySessionFactory";
065            public static final String TX_MANAGER = "liferayTransactionManager";
066            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
067                                    "value.object.entity.cache.enabled.com.liferay.portal.model.PasswordPolicyRel"),
068                            true);
069            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
070                                    "value.object.finder.cache.enabled.com.liferay.portal.model.PasswordPolicyRel"),
071                            true);
072            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
073                                    "lock.expiration.time.com.liferay.portal.model.PasswordPolicyRel"));
074    
075            public PasswordPolicyRelModelImpl() {
076            }
077    
078            public long getPrimaryKey() {
079                    return _passwordPolicyRelId;
080            }
081    
082            public void setPrimaryKey(long pk) {
083                    setPasswordPolicyRelId(pk);
084            }
085    
086            public Serializable getPrimaryKeyObj() {
087                    return new Long(_passwordPolicyRelId);
088            }
089    
090            public long getPasswordPolicyRelId() {
091                    return _passwordPolicyRelId;
092            }
093    
094            public void setPasswordPolicyRelId(long passwordPolicyRelId) {
095                    _passwordPolicyRelId = passwordPolicyRelId;
096            }
097    
098            public long getPasswordPolicyId() {
099                    return _passwordPolicyId;
100            }
101    
102            public void setPasswordPolicyId(long passwordPolicyId) {
103                    if (!_setOriginalPasswordPolicyId) {
104                            _setOriginalPasswordPolicyId = true;
105    
106                            _originalPasswordPolicyId = _passwordPolicyId;
107                    }
108    
109                    _passwordPolicyId = passwordPolicyId;
110            }
111    
112            public long getOriginalPasswordPolicyId() {
113                    return _originalPasswordPolicyId;
114            }
115    
116            public String getClassName() {
117                    if (getClassNameId() <= 0) {
118                            return StringPool.BLANK;
119                    }
120    
121                    return PortalUtil.getClassName(getClassNameId());
122            }
123    
124            public long getClassNameId() {
125                    return _classNameId;
126            }
127    
128            public void setClassNameId(long classNameId) {
129                    if (!_setOriginalClassNameId) {
130                            _setOriginalClassNameId = true;
131    
132                            _originalClassNameId = _classNameId;
133                    }
134    
135                    _classNameId = classNameId;
136            }
137    
138            public long getOriginalClassNameId() {
139                    return _originalClassNameId;
140            }
141    
142            public long getClassPK() {
143                    return _classPK;
144            }
145    
146            public void setClassPK(long classPK) {
147                    if (!_setOriginalClassPK) {
148                            _setOriginalClassPK = true;
149    
150                            _originalClassPK = _classPK;
151                    }
152    
153                    _classPK = classPK;
154            }
155    
156            public long getOriginalClassPK() {
157                    return _originalClassPK;
158            }
159    
160            public PasswordPolicyRel toEscapedModel() {
161                    if (isEscapedModel()) {
162                            return (PasswordPolicyRel)this;
163                    }
164                    else {
165                            return (PasswordPolicyRel)Proxy.newProxyInstance(PasswordPolicyRel.class.getClassLoader(),
166                                    new Class[] { PasswordPolicyRel.class },
167                                    new AutoEscapeBeanHandler(this));
168                    }
169            }
170    
171            public ExpandoBridge getExpandoBridge() {
172                    if (_expandoBridge == null) {
173                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(0,
174                                            PasswordPolicyRel.class.getName(), getPrimaryKey());
175                    }
176    
177                    return _expandoBridge;
178            }
179    
180            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
181                    getExpandoBridge().setAttributes(serviceContext);
182            }
183    
184            public Object clone() {
185                    PasswordPolicyRelImpl passwordPolicyRelImpl = new PasswordPolicyRelImpl();
186    
187                    passwordPolicyRelImpl.setPasswordPolicyRelId(getPasswordPolicyRelId());
188    
189                    passwordPolicyRelImpl.setPasswordPolicyId(getPasswordPolicyId());
190    
191                    PasswordPolicyRelModelImpl passwordPolicyRelModelImpl = passwordPolicyRelImpl;
192    
193                    passwordPolicyRelModelImpl._originalPasswordPolicyId = passwordPolicyRelModelImpl._passwordPolicyId;
194    
195                    passwordPolicyRelModelImpl._setOriginalPasswordPolicyId = false;
196                    passwordPolicyRelImpl.setClassNameId(getClassNameId());
197    
198                    passwordPolicyRelModelImpl._originalClassNameId = passwordPolicyRelModelImpl._classNameId;
199    
200                    passwordPolicyRelModelImpl._setOriginalClassNameId = false;
201                    passwordPolicyRelImpl.setClassPK(getClassPK());
202    
203                    passwordPolicyRelModelImpl._originalClassPK = passwordPolicyRelModelImpl._classPK;
204    
205                    passwordPolicyRelModelImpl._setOriginalClassPK = false;
206    
207                    return passwordPolicyRelImpl;
208            }
209    
210            public int compareTo(PasswordPolicyRel passwordPolicyRel) {
211                    long pk = passwordPolicyRel.getPrimaryKey();
212    
213                    if (getPrimaryKey() < pk) {
214                            return -1;
215                    }
216                    else if (getPrimaryKey() > pk) {
217                            return 1;
218                    }
219                    else {
220                            return 0;
221                    }
222            }
223    
224            public boolean equals(Object obj) {
225                    if (obj == null) {
226                            return false;
227                    }
228    
229                    PasswordPolicyRel passwordPolicyRel = null;
230    
231                    try {
232                            passwordPolicyRel = (PasswordPolicyRel)obj;
233                    }
234                    catch (ClassCastException cce) {
235                            return false;
236                    }
237    
238                    long pk = passwordPolicyRel.getPrimaryKey();
239    
240                    if (getPrimaryKey() == pk) {
241                            return true;
242                    }
243                    else {
244                            return false;
245                    }
246            }
247    
248            public int hashCode() {
249                    return (int)getPrimaryKey();
250            }
251    
252            public String toString() {
253                    StringBundler sb = new StringBundler(9);
254    
255                    sb.append("{passwordPolicyRelId=");
256                    sb.append(getPasswordPolicyRelId());
257                    sb.append(", passwordPolicyId=");
258                    sb.append(getPasswordPolicyId());
259                    sb.append(", classNameId=");
260                    sb.append(getClassNameId());
261                    sb.append(", classPK=");
262                    sb.append(getClassPK());
263                    sb.append("}");
264    
265                    return sb.toString();
266            }
267    
268            public String toXmlString() {
269                    StringBundler sb = new StringBundler(16);
270    
271                    sb.append("<model><model-name>");
272                    sb.append("com.liferay.portal.model.PasswordPolicyRel");
273                    sb.append("</model-name>");
274    
275                    sb.append(
276                            "<column><column-name>passwordPolicyRelId</column-name><column-value><![CDATA[");
277                    sb.append(getPasswordPolicyRelId());
278                    sb.append("]]></column-value></column>");
279                    sb.append(
280                            "<column><column-name>passwordPolicyId</column-name><column-value><![CDATA[");
281                    sb.append(getPasswordPolicyId());
282                    sb.append("]]></column-value></column>");
283                    sb.append(
284                            "<column><column-name>classNameId</column-name><column-value><![CDATA[");
285                    sb.append(getClassNameId());
286                    sb.append("]]></column-value></column>");
287                    sb.append(
288                            "<column><column-name>classPK</column-name><column-value><![CDATA[");
289                    sb.append(getClassPK());
290                    sb.append("]]></column-value></column>");
291    
292                    sb.append("</model>");
293    
294                    return sb.toString();
295            }
296    
297            private long _passwordPolicyRelId;
298            private long _passwordPolicyId;
299            private long _originalPasswordPolicyId;
300            private boolean _setOriginalPasswordPolicyId;
301            private long _classNameId;
302            private long _originalClassNameId;
303            private boolean _setOriginalClassNameId;
304            private long _classPK;
305            private long _originalClassPK;
306            private boolean _setOriginalClassPK;
307            private transient ExpandoBridge _expandoBridge;
308    }