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