1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.model.impl;
24  
25  import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26  import com.liferay.portal.kernel.util.GetterUtil;
27  import com.liferay.portal.kernel.util.StringPool;
28  import com.liferay.portal.model.PasswordPolicyRel;
29  import com.liferay.portal.model.PasswordPolicyRelSoap;
30  import com.liferay.portal.util.PortalUtil;
31  
32  import java.io.Serializable;
33  
34  import java.lang.reflect.Proxy;
35  
36  import java.sql.Types;
37  
38  import java.util.ArrayList;
39  import java.util.List;
40  
41  /**
42   * <a href="PasswordPolicyRelModelImpl.java.html"><b><i>View Source</i></b></a>
43   *
44   * <p>
45   * ServiceBuilder generated this class. Modifications in this class will be
46   * overwritten the next time is generated.
47   * </p>
48   *
49   * <p>
50   * This class is a model that represents the <code>PasswordPolicyRel</code> table
51   * in the database.
52   * </p>
53   *
54   * @author Brian Wing Shun Chan
55   *
56   * @see com.liferay.portal.model.PasswordPolicyRel
57   * @see com.liferay.portal.model.PasswordPolicyRelModel
58   * @see com.liferay.portal.model.impl.PasswordPolicyRelImpl
59   *
60   */
61  public class PasswordPolicyRelModelImpl extends BaseModelImpl<PasswordPolicyRel> {
62      public static final String TABLE_NAME = "PasswordPolicyRel";
63      public static final Object[][] TABLE_COLUMNS = {
64              { "passwordPolicyRelId", new Integer(Types.BIGINT) },
65              
66  
67              { "passwordPolicyId", new Integer(Types.BIGINT) },
68              
69  
70              { "classNameId", new Integer(Types.BIGINT) },
71              
72  
73              { "classPK", new Integer(Types.BIGINT) }
74          };
75      public static final String TABLE_SQL_CREATE = "create table PasswordPolicyRel (passwordPolicyRelId LONG not null primary key,passwordPolicyId LONG,classNameId LONG,classPK LONG)";
76      public static final String TABLE_SQL_DROP = "drop table PasswordPolicyRel";
77      public static final String DATA_SOURCE = "liferayDataSource";
78      public static final String SESSION_FACTORY = "liferaySessionFactory";
79      public static final String TX_MANAGER = "liferayTransactionManager";
80      public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
81                  "value.object.entity.cache.enabled.com.liferay.portal.model.PasswordPolicyRel"),
82              true);
83      public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
84                  "value.object.finder.cache.enabled.com.liferay.portal.model.PasswordPolicyRel"),
85              true);
86  
87      public static PasswordPolicyRel toModel(PasswordPolicyRelSoap soapModel) {
88          PasswordPolicyRel model = new PasswordPolicyRelImpl();
89  
90          model.setPasswordPolicyRelId(soapModel.getPasswordPolicyRelId());
91          model.setPasswordPolicyId(soapModel.getPasswordPolicyId());
92          model.setClassNameId(soapModel.getClassNameId());
93          model.setClassPK(soapModel.getClassPK());
94  
95          return model;
96      }
97  
98      public static List<PasswordPolicyRel> toModels(
99          PasswordPolicyRelSoap[] soapModels) {
100         List<PasswordPolicyRel> models = new ArrayList<PasswordPolicyRel>(soapModels.length);
101 
102         for (PasswordPolicyRelSoap soapModel : soapModels) {
103             models.add(toModel(soapModel));
104         }
105 
106         return models;
107     }
108 
109     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
110                 "lock.expiration.time.com.liferay.portal.model.PasswordPolicyRel"));
111 
112     public PasswordPolicyRelModelImpl() {
113     }
114 
115     public long getPrimaryKey() {
116         return _passwordPolicyRelId;
117     }
118 
119     public void setPrimaryKey(long pk) {
120         setPasswordPolicyRelId(pk);
121     }
122 
123     public Serializable getPrimaryKeyObj() {
124         return new Long(_passwordPolicyRelId);
125     }
126 
127     public long getPasswordPolicyRelId() {
128         return _passwordPolicyRelId;
129     }
130 
131     public void setPasswordPolicyRelId(long passwordPolicyRelId) {
132         _passwordPolicyRelId = passwordPolicyRelId;
133     }
134 
135     public long getPasswordPolicyId() {
136         return _passwordPolicyId;
137     }
138 
139     public void setPasswordPolicyId(long passwordPolicyId) {
140         _passwordPolicyId = passwordPolicyId;
141 
142         if (!_setOriginalPasswordPolicyId) {
143             _setOriginalPasswordPolicyId = true;
144 
145             _originalPasswordPolicyId = passwordPolicyId;
146         }
147     }
148 
149     public long getOriginalPasswordPolicyId() {
150         return _originalPasswordPolicyId;
151     }
152 
153     public String getClassName() {
154         if (getClassNameId() <= 0) {
155             return StringPool.BLANK;
156         }
157 
158         return PortalUtil.getClassName(getClassNameId());
159     }
160 
161     public long getClassNameId() {
162         return _classNameId;
163     }
164 
165     public void setClassNameId(long classNameId) {
166         _classNameId = classNameId;
167 
168         if (!_setOriginalClassNameId) {
169             _setOriginalClassNameId = true;
170 
171             _originalClassNameId = classNameId;
172         }
173     }
174 
175     public long getOriginalClassNameId() {
176         return _originalClassNameId;
177     }
178 
179     public long getClassPK() {
180         return _classPK;
181     }
182 
183     public void setClassPK(long classPK) {
184         _classPK = classPK;
185 
186         if (!_setOriginalClassPK) {
187             _setOriginalClassPK = true;
188 
189             _originalClassPK = classPK;
190         }
191     }
192 
193     public long getOriginalClassPK() {
194         return _originalClassPK;
195     }
196 
197     public PasswordPolicyRel toEscapedModel() {
198         if (isEscapedModel()) {
199             return (PasswordPolicyRel)this;
200         }
201         else {
202             PasswordPolicyRel model = new PasswordPolicyRelImpl();
203 
204             model.setNew(isNew());
205             model.setEscapedModel(true);
206 
207             model.setPasswordPolicyRelId(getPasswordPolicyRelId());
208             model.setPasswordPolicyId(getPasswordPolicyId());
209             model.setClassNameId(getClassNameId());
210             model.setClassPK(getClassPK());
211 
212             model = (PasswordPolicyRel)Proxy.newProxyInstance(PasswordPolicyRel.class.getClassLoader(),
213                     new Class[] { PasswordPolicyRel.class },
214                     new ReadOnlyBeanHandler(model));
215 
216             return model;
217         }
218     }
219 
220     public Object clone() {
221         PasswordPolicyRelImpl clone = new PasswordPolicyRelImpl();
222 
223         clone.setPasswordPolicyRelId(getPasswordPolicyRelId());
224         clone.setPasswordPolicyId(getPasswordPolicyId());
225         clone.setClassNameId(getClassNameId());
226         clone.setClassPK(getClassPK());
227 
228         return clone;
229     }
230 
231     public int compareTo(PasswordPolicyRel passwordPolicyRel) {
232         long pk = passwordPolicyRel.getPrimaryKey();
233 
234         if (getPrimaryKey() < pk) {
235             return -1;
236         }
237         else if (getPrimaryKey() > pk) {
238             return 1;
239         }
240         else {
241             return 0;
242         }
243     }
244 
245     public boolean equals(Object obj) {
246         if (obj == null) {
247             return false;
248         }
249 
250         PasswordPolicyRel passwordPolicyRel = null;
251 
252         try {
253             passwordPolicyRel = (PasswordPolicyRel)obj;
254         }
255         catch (ClassCastException cce) {
256             return false;
257         }
258 
259         long pk = passwordPolicyRel.getPrimaryKey();
260 
261         if (getPrimaryKey() == pk) {
262             return true;
263         }
264         else {
265             return false;
266         }
267     }
268 
269     public int hashCode() {
270         return (int)getPrimaryKey();
271     }
272 
273     public String toString() {
274         StringBuilder sb = new StringBuilder();
275 
276         sb.append("{passwordPolicyRelId=");
277         sb.append(getPasswordPolicyRelId());
278         sb.append(", passwordPolicyId=");
279         sb.append(getPasswordPolicyId());
280         sb.append(", classNameId=");
281         sb.append(getClassNameId());
282         sb.append(", classPK=");
283         sb.append(getClassPK());
284         sb.append("}");
285 
286         return sb.toString();
287     }
288 
289     public String toXmlString() {
290         StringBuilder sb = new StringBuilder();
291 
292         sb.append("<model><model-name>");
293         sb.append("com.liferay.portal.model.PasswordPolicyRel");
294         sb.append("</model-name>");
295 
296         sb.append(
297             "<column><column-name>passwordPolicyRelId</column-name><column-value><![CDATA[");
298         sb.append(getPasswordPolicyRelId());
299         sb.append("]]></column-value></column>");
300         sb.append(
301             "<column><column-name>passwordPolicyId</column-name><column-value><![CDATA[");
302         sb.append(getPasswordPolicyId());
303         sb.append("]]></column-value></column>");
304         sb.append(
305             "<column><column-name>classNameId</column-name><column-value><![CDATA[");
306         sb.append(getClassNameId());
307         sb.append("]]></column-value></column>");
308         sb.append(
309             "<column><column-name>classPK</column-name><column-value><![CDATA[");
310         sb.append(getClassPK());
311         sb.append("]]></column-value></column>");
312 
313         sb.append("</model>");
314 
315         return sb.toString();
316     }
317 
318     private long _passwordPolicyRelId;
319     private long _passwordPolicyId;
320     private long _originalPasswordPolicyId;
321     private boolean _setOriginalPasswordPolicyId;
322     private long _classNameId;
323     private long _originalClassNameId;
324     private boolean _setOriginalClassNameId;
325     private long _classPK;
326     private long _originalClassPK;
327     private boolean _setOriginalClassPK;
328 }