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