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