001    /**
002     * Copyright (c) 2000-2010 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                    _passwordPolicyId = passwordPolicyId;
104    
105                    if (!_setOriginalPasswordPolicyId) {
106                            _setOriginalPasswordPolicyId = true;
107    
108                            _originalPasswordPolicyId = passwordPolicyId;
109                    }
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                    _classNameId = classNameId;
130    
131                    if (!_setOriginalClassNameId) {
132                            _setOriginalClassNameId = true;
133    
134                            _originalClassNameId = classNameId;
135                    }
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                    _classPK = classPK;
148    
149                    if (!_setOriginalClassPK) {
150                            _setOriginalClassPK = true;
151    
152                            _originalClassPK = classPK;
153                    }
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 clone = new PasswordPolicyRelImpl();
186    
187                    clone.setPasswordPolicyRelId(getPasswordPolicyRelId());
188                    clone.setPasswordPolicyId(getPasswordPolicyId());
189                    clone.setClassNameId(getClassNameId());
190                    clone.setClassPK(getClassPK());
191    
192                    return clone;
193            }
194    
195            public int compareTo(PasswordPolicyRel passwordPolicyRel) {
196                    long pk = passwordPolicyRel.getPrimaryKey();
197    
198                    if (getPrimaryKey() < pk) {
199                            return -1;
200                    }
201                    else if (getPrimaryKey() > pk) {
202                            return 1;
203                    }
204                    else {
205                            return 0;
206                    }
207            }
208    
209            public boolean equals(Object obj) {
210                    if (obj == null) {
211                            return false;
212                    }
213    
214                    PasswordPolicyRel passwordPolicyRel = null;
215    
216                    try {
217                            passwordPolicyRel = (PasswordPolicyRel)obj;
218                    }
219                    catch (ClassCastException cce) {
220                            return false;
221                    }
222    
223                    long pk = passwordPolicyRel.getPrimaryKey();
224    
225                    if (getPrimaryKey() == pk) {
226                            return true;
227                    }
228                    else {
229                            return false;
230                    }
231            }
232    
233            public int hashCode() {
234                    return (int)getPrimaryKey();
235            }
236    
237            public String toString() {
238                    StringBundler sb = new StringBundler(9);
239    
240                    sb.append("{passwordPolicyRelId=");
241                    sb.append(getPasswordPolicyRelId());
242                    sb.append(", passwordPolicyId=");
243                    sb.append(getPasswordPolicyId());
244                    sb.append(", classNameId=");
245                    sb.append(getClassNameId());
246                    sb.append(", classPK=");
247                    sb.append(getClassPK());
248                    sb.append("}");
249    
250                    return sb.toString();
251            }
252    
253            public String toXmlString() {
254                    StringBundler sb = new StringBundler(16);
255    
256                    sb.append("<model><model-name>");
257                    sb.append("com.liferay.portal.model.PasswordPolicyRel");
258                    sb.append("</model-name>");
259    
260                    sb.append(
261                            "<column><column-name>passwordPolicyRelId</column-name><column-value><![CDATA[");
262                    sb.append(getPasswordPolicyRelId());
263                    sb.append("]]></column-value></column>");
264                    sb.append(
265                            "<column><column-name>passwordPolicyId</column-name><column-value><![CDATA[");
266                    sb.append(getPasswordPolicyId());
267                    sb.append("]]></column-value></column>");
268                    sb.append(
269                            "<column><column-name>classNameId</column-name><column-value><![CDATA[");
270                    sb.append(getClassNameId());
271                    sb.append("]]></column-value></column>");
272                    sb.append(
273                            "<column><column-name>classPK</column-name><column-value><![CDATA[");
274                    sb.append(getClassPK());
275                    sb.append("]]></column-value></column>");
276    
277                    sb.append("</model>");
278    
279                    return sb.toString();
280            }
281    
282            private long _passwordPolicyRelId;
283            private long _passwordPolicyId;
284            private long _originalPasswordPolicyId;
285            private boolean _setOriginalPasswordPolicyId;
286            private long _classNameId;
287            private long _originalClassNameId;
288            private boolean _setOriginalClassNameId;
289            private long _classPK;
290            private long _originalClassPK;
291            private boolean _setOriginalClassPK;
292            private transient ExpandoBridge _expandoBridge;
293    }