1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.model.impl;
16  
17  import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
18  import com.liferay.portal.kernel.util.GetterUtil;
19  import com.liferay.portal.kernel.util.StringBundler;
20  import com.liferay.portal.kernel.util.StringPool;
21  import com.liferay.portal.model.PasswordPolicyRel;
22  import com.liferay.portal.model.PasswordPolicyRelSoap;
23  import com.liferay.portal.service.ServiceContext;
24  import com.liferay.portal.util.PortalUtil;
25  
26  import com.liferay.portlet.expando.model.ExpandoBridge;
27  import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
28  
29  import java.io.Serializable;
30  
31  import java.lang.reflect.Proxy;
32  
33  import java.sql.Types;
34  
35  import java.util.ArrayList;
36  import java.util.List;
37  
38  /**
39   * <a href="PasswordPolicyRelModelImpl.java.html"><b><i>View Source</i></b></a>
40   *
41   * <p>
42   * ServiceBuilder generated this class. Modifications in this class will be
43   * overwritten the next time is generated.
44   * </p>
45   *
46   * <p>
47   * This interface is a model that represents the PasswordPolicyRel table in the
48   * database.
49   * </p>
50   *
51   * @author    Brian Wing Shun Chan
52   * @see       PasswordPolicyRelImpl
53   * @see       com.liferay.portal.model.PasswordPolicyRel
54   * @see       com.liferay.portal.model.PasswordPolicyRelModel
55   * @generated
56   */
57  public class PasswordPolicyRelModelImpl extends BaseModelImpl<PasswordPolicyRel> {
58      public static final String TABLE_NAME = "PasswordPolicyRel";
59      public static final Object[][] TABLE_COLUMNS = {
60              { "passwordPolicyRelId", new Integer(Types.BIGINT) },
61              { "passwordPolicyId", new Integer(Types.BIGINT) },
62              { "classNameId", new Integer(Types.BIGINT) },
63              { "classPK", new Integer(Types.BIGINT) }
64          };
65      public static final String TABLE_SQL_CREATE = "create table PasswordPolicyRel (passwordPolicyRelId LONG not null primary key,passwordPolicyId LONG,classNameId LONG,classPK LONG)";
66      public static final String TABLE_SQL_DROP = "drop table PasswordPolicyRel";
67      public static final String DATA_SOURCE = "liferayDataSource";
68      public static final String SESSION_FACTORY = "liferaySessionFactory";
69      public static final String TX_MANAGER = "liferayTransactionManager";
70      public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
71                  "value.object.entity.cache.enabled.com.liferay.portal.model.PasswordPolicyRel"),
72              true);
73      public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
74                  "value.object.finder.cache.enabled.com.liferay.portal.model.PasswordPolicyRel"),
75              true);
76  
77      public static PasswordPolicyRel toModel(PasswordPolicyRelSoap soapModel) {
78          PasswordPolicyRel model = new PasswordPolicyRelImpl();
79  
80          model.setPasswordPolicyRelId(soapModel.getPasswordPolicyRelId());
81          model.setPasswordPolicyId(soapModel.getPasswordPolicyId());
82          model.setClassNameId(soapModel.getClassNameId());
83          model.setClassPK(soapModel.getClassPK());
84  
85          return model;
86      }
87  
88      public static List<PasswordPolicyRel> toModels(
89          PasswordPolicyRelSoap[] soapModels) {
90          List<PasswordPolicyRel> models = new ArrayList<PasswordPolicyRel>(soapModels.length);
91  
92          for (PasswordPolicyRelSoap soapModel : soapModels) {
93              models.add(toModel(soapModel));
94          }
95  
96          return models;
97      }
98  
99      public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
100                 "lock.expiration.time.com.liferay.portal.model.PasswordPolicyRel"));
101 
102     public PasswordPolicyRelModelImpl() {
103     }
104 
105     public long getPrimaryKey() {
106         return _passwordPolicyRelId;
107     }
108 
109     public void setPrimaryKey(long pk) {
110         setPasswordPolicyRelId(pk);
111     }
112 
113     public Serializable getPrimaryKeyObj() {
114         return new Long(_passwordPolicyRelId);
115     }
116 
117     public long getPasswordPolicyRelId() {
118         return _passwordPolicyRelId;
119     }
120 
121     public void setPasswordPolicyRelId(long passwordPolicyRelId) {
122         _passwordPolicyRelId = passwordPolicyRelId;
123     }
124 
125     public long getPasswordPolicyId() {
126         return _passwordPolicyId;
127     }
128 
129     public void setPasswordPolicyId(long passwordPolicyId) {
130         _passwordPolicyId = passwordPolicyId;
131 
132         if (!_setOriginalPasswordPolicyId) {
133             _setOriginalPasswordPolicyId = true;
134 
135             _originalPasswordPolicyId = passwordPolicyId;
136         }
137     }
138 
139     public long getOriginalPasswordPolicyId() {
140         return _originalPasswordPolicyId;
141     }
142 
143     public String getClassName() {
144         if (getClassNameId() <= 0) {
145             return StringPool.BLANK;
146         }
147 
148         return PortalUtil.getClassName(getClassNameId());
149     }
150 
151     public long getClassNameId() {
152         return _classNameId;
153     }
154 
155     public void setClassNameId(long classNameId) {
156         _classNameId = classNameId;
157 
158         if (!_setOriginalClassNameId) {
159             _setOriginalClassNameId = true;
160 
161             _originalClassNameId = classNameId;
162         }
163     }
164 
165     public long getOriginalClassNameId() {
166         return _originalClassNameId;
167     }
168 
169     public long getClassPK() {
170         return _classPK;
171     }
172 
173     public void setClassPK(long classPK) {
174         _classPK = classPK;
175 
176         if (!_setOriginalClassPK) {
177             _setOriginalClassPK = true;
178 
179             _originalClassPK = classPK;
180         }
181     }
182 
183     public long getOriginalClassPK() {
184         return _originalClassPK;
185     }
186 
187     public PasswordPolicyRel toEscapedModel() {
188         if (isEscapedModel()) {
189             return (PasswordPolicyRel)this;
190         }
191         else {
192             return (PasswordPolicyRel)Proxy.newProxyInstance(PasswordPolicyRel.class.getClassLoader(),
193                 new Class[] { PasswordPolicyRel.class },
194                 new AutoEscapeBeanHandler(this));
195         }
196     }
197 
198     public ExpandoBridge getExpandoBridge() {
199         if (_expandoBridge == null) {
200             _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(PasswordPolicyRel.class.getName(),
201                     getPrimaryKey());
202         }
203 
204         return _expandoBridge;
205     }
206 
207     public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
208         getExpandoBridge().setAttributes(serviceContext);
209     }
210 
211     public Object clone() {
212         PasswordPolicyRelImpl clone = new PasswordPolicyRelImpl();
213 
214         clone.setPasswordPolicyRelId(getPasswordPolicyRelId());
215         clone.setPasswordPolicyId(getPasswordPolicyId());
216         clone.setClassNameId(getClassNameId());
217         clone.setClassPK(getClassPK());
218 
219         return clone;
220     }
221 
222     public int compareTo(PasswordPolicyRel passwordPolicyRel) {
223         long pk = passwordPolicyRel.getPrimaryKey();
224 
225         if (getPrimaryKey() < pk) {
226             return -1;
227         }
228         else if (getPrimaryKey() > pk) {
229             return 1;
230         }
231         else {
232             return 0;
233         }
234     }
235 
236     public boolean equals(Object obj) {
237         if (obj == null) {
238             return false;
239         }
240 
241         PasswordPolicyRel passwordPolicyRel = null;
242 
243         try {
244             passwordPolicyRel = (PasswordPolicyRel)obj;
245         }
246         catch (ClassCastException cce) {
247             return false;
248         }
249 
250         long pk = passwordPolicyRel.getPrimaryKey();
251 
252         if (getPrimaryKey() == pk) {
253             return true;
254         }
255         else {
256             return false;
257         }
258     }
259 
260     public int hashCode() {
261         return (int)getPrimaryKey();
262     }
263 
264     public String toString() {
265         StringBundler sb = new StringBundler(9);
266 
267         sb.append("{passwordPolicyRelId=");
268         sb.append(getPasswordPolicyRelId());
269         sb.append(", passwordPolicyId=");
270         sb.append(getPasswordPolicyId());
271         sb.append(", classNameId=");
272         sb.append(getClassNameId());
273         sb.append(", classPK=");
274         sb.append(getClassPK());
275         sb.append("}");
276 
277         return sb.toString();
278     }
279 
280     public String toXmlString() {
281         StringBundler sb = new StringBundler(16);
282 
283         sb.append("<model><model-name>");
284         sb.append("com.liferay.portal.model.PasswordPolicyRel");
285         sb.append("</model-name>");
286 
287         sb.append(
288             "<column><column-name>passwordPolicyRelId</column-name><column-value><![CDATA[");
289         sb.append(getPasswordPolicyRelId());
290         sb.append("]]></column-value></column>");
291         sb.append(
292             "<column><column-name>passwordPolicyId</column-name><column-value><![CDATA[");
293         sb.append(getPasswordPolicyId());
294         sb.append("]]></column-value></column>");
295         sb.append(
296             "<column><column-name>classNameId</column-name><column-value><![CDATA[");
297         sb.append(getClassNameId());
298         sb.append("]]></column-value></column>");
299         sb.append(
300             "<column><column-name>classPK</column-name><column-value><![CDATA[");
301         sb.append(getClassPK());
302         sb.append("]]></column-value></column>");
303 
304         sb.append("</model>");
305 
306         return sb.toString();
307     }
308 
309     private long _passwordPolicyRelId;
310     private long _passwordPolicyId;
311     private long _originalPasswordPolicyId;
312     private boolean _setOriginalPasswordPolicyId;
313     private long _classNameId;
314     private long _originalClassNameId;
315     private boolean _setOriginalClassNameId;
316     private long _classPK;
317     private long _originalClassPK;
318     private boolean _setOriginalClassPK;
319     private transient ExpandoBridge _expandoBridge;
320 }