1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
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.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             PasswordPolicyRel model = new PasswordPolicyRelImpl();
193 
194             model.setNew(isNew());
195             model.setEscapedModel(true);
196 
197             model.setPasswordPolicyRelId(getPasswordPolicyRelId());
198             model.setPasswordPolicyId(getPasswordPolicyId());
199             model.setClassNameId(getClassNameId());
200             model.setClassPK(getClassPK());
201 
202             model = (PasswordPolicyRel)Proxy.newProxyInstance(PasswordPolicyRel.class.getClassLoader(),
203                     new Class[] { PasswordPolicyRel.class },
204                     new ReadOnlyBeanHandler(model));
205 
206             return model;
207         }
208     }
209 
210     public ExpandoBridge getExpandoBridge() {
211         if (_expandoBridge == null) {
212             _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(0,
213                     PasswordPolicyRel.class.getName(), getPrimaryKey());
214         }
215 
216         return _expandoBridge;
217     }
218 
219     public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
220         getExpandoBridge().setAttributes(serviceContext);
221     }
222 
223     public Object clone() {
224         PasswordPolicyRelImpl clone = new PasswordPolicyRelImpl();
225 
226         clone.setPasswordPolicyRelId(getPasswordPolicyRelId());
227         clone.setPasswordPolicyId(getPasswordPolicyId());
228         clone.setClassNameId(getClassNameId());
229         clone.setClassPK(getClassPK());
230 
231         return clone;
232     }
233 
234     public int compareTo(PasswordPolicyRel passwordPolicyRel) {
235         long pk = passwordPolicyRel.getPrimaryKey();
236 
237         if (getPrimaryKey() < pk) {
238             return -1;
239         }
240         else if (getPrimaryKey() > pk) {
241             return 1;
242         }
243         else {
244             return 0;
245         }
246     }
247 
248     public boolean equals(Object obj) {
249         if (obj == null) {
250             return false;
251         }
252 
253         PasswordPolicyRel passwordPolicyRel = null;
254 
255         try {
256             passwordPolicyRel = (PasswordPolicyRel)obj;
257         }
258         catch (ClassCastException cce) {
259             return false;
260         }
261 
262         long pk = passwordPolicyRel.getPrimaryKey();
263 
264         if (getPrimaryKey() == pk) {
265             return true;
266         }
267         else {
268             return false;
269         }
270     }
271 
272     public int hashCode() {
273         return (int)getPrimaryKey();
274     }
275 
276     public String toString() {
277         StringBundler sb = new StringBundler(9);
278 
279         sb.append("{passwordPolicyRelId=");
280         sb.append(getPasswordPolicyRelId());
281         sb.append(", passwordPolicyId=");
282         sb.append(getPasswordPolicyId());
283         sb.append(", classNameId=");
284         sb.append(getClassNameId());
285         sb.append(", classPK=");
286         sb.append(getClassPK());
287         sb.append("}");
288 
289         return sb.toString();
290     }
291 
292     public String toXmlString() {
293         StringBundler sb = new StringBundler(16);
294 
295         sb.append("<model><model-name>");
296         sb.append("com.liferay.portal.model.PasswordPolicyRel");
297         sb.append("</model-name>");
298 
299         sb.append(
300             "<column><column-name>passwordPolicyRelId</column-name><column-value><![CDATA[");
301         sb.append(getPasswordPolicyRelId());
302         sb.append("]]></column-value></column>");
303         sb.append(
304             "<column><column-name>passwordPolicyId</column-name><column-value><![CDATA[");
305         sb.append(getPasswordPolicyId());
306         sb.append("]]></column-value></column>");
307         sb.append(
308             "<column><column-name>classNameId</column-name><column-value><![CDATA[");
309         sb.append(getClassNameId());
310         sb.append("]]></column-value></column>");
311         sb.append(
312             "<column><column-name>classPK</column-name><column-value><![CDATA[");
313         sb.append(getClassPK());
314         sb.append("]]></column-value></column>");
315 
316         sb.append("</model>");
317 
318         return sb.toString();
319     }
320 
321     private long _passwordPolicyRelId;
322     private long _passwordPolicyId;
323     private long _originalPasswordPolicyId;
324     private boolean _setOriginalPasswordPolicyId;
325     private long _classNameId;
326     private long _originalClassNameId;
327     private boolean _setOriginalClassNameId;
328     private long _classPK;
329     private long _originalClassPK;
330     private boolean _setOriginalClassPK;
331     private transient ExpandoBridge _expandoBridge;
332 }