1   /**
2    * Copyright (c) 2000-2008 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 {
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 CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
81                  "value.object.finder.cache.enabled.com.liferay.portal.model.PasswordPolicyRel"),
82              true);
83  
84      public static PasswordPolicyRel toModel(PasswordPolicyRelSoap soapModel) {
85          PasswordPolicyRel model = new PasswordPolicyRelImpl();
86  
87          model.setPasswordPolicyRelId(soapModel.getPasswordPolicyRelId());
88          model.setPasswordPolicyId(soapModel.getPasswordPolicyId());
89          model.setClassNameId(soapModel.getClassNameId());
90          model.setClassPK(soapModel.getClassPK());
91  
92          return model;
93      }
94  
95      public static List<PasswordPolicyRel> toModels(
96          PasswordPolicyRelSoap[] soapModels) {
97          List<PasswordPolicyRel> models = new ArrayList<PasswordPolicyRel>(soapModels.length);
98  
99          for (PasswordPolicyRelSoap soapModel : soapModels) {
100             models.add(toModel(soapModel));
101         }
102 
103         return models;
104     }
105 
106     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
107                 "lock.expiration.time.com.liferay.portal.model.PasswordPolicyRel"));
108 
109     public PasswordPolicyRelModelImpl() {
110     }
111 
112     public long getPrimaryKey() {
113         return _passwordPolicyRelId;
114     }
115 
116     public void setPrimaryKey(long pk) {
117         setPasswordPolicyRelId(pk);
118     }
119 
120     public Serializable getPrimaryKeyObj() {
121         return new Long(_passwordPolicyRelId);
122     }
123 
124     public long getPasswordPolicyRelId() {
125         return _passwordPolicyRelId;
126     }
127 
128     public void setPasswordPolicyRelId(long passwordPolicyRelId) {
129         if (passwordPolicyRelId != _passwordPolicyRelId) {
130             _passwordPolicyRelId = passwordPolicyRelId;
131         }
132     }
133 
134     public long getPasswordPolicyId() {
135         return _passwordPolicyId;
136     }
137 
138     public void setPasswordPolicyId(long passwordPolicyId) {
139         if (passwordPolicyId != _passwordPolicyId) {
140             _passwordPolicyId = passwordPolicyId;
141         }
142     }
143 
144     public String getClassName() {
145         if (getClassNameId() <= 0) {
146             return StringPool.BLANK;
147         }
148 
149         return PortalUtil.getClassName(getClassNameId());
150     }
151 
152     public long getClassNameId() {
153         return _classNameId;
154     }
155 
156     public void setClassNameId(long classNameId) {
157         if (classNameId != _classNameId) {
158             _classNameId = classNameId;
159         }
160     }
161 
162     public long getClassPK() {
163         return _classPK;
164     }
165 
166     public void setClassPK(long classPK) {
167         if (classPK != _classPK) {
168             _classPK = classPK;
169         }
170     }
171 
172     public PasswordPolicyRel toEscapedModel() {
173         if (isEscapedModel()) {
174             return (PasswordPolicyRel)this;
175         }
176         else {
177             PasswordPolicyRel model = new PasswordPolicyRelImpl();
178 
179             model.setNew(isNew());
180             model.setEscapedModel(true);
181 
182             model.setPasswordPolicyRelId(getPasswordPolicyRelId());
183             model.setPasswordPolicyId(getPasswordPolicyId());
184             model.setClassNameId(getClassNameId());
185             model.setClassPK(getClassPK());
186 
187             model = (PasswordPolicyRel)Proxy.newProxyInstance(PasswordPolicyRel.class.getClassLoader(),
188                     new Class[] { PasswordPolicyRel.class },
189                     new ReadOnlyBeanHandler(model));
190 
191             return model;
192         }
193     }
194 
195     public Object clone() {
196         PasswordPolicyRelImpl clone = new PasswordPolicyRelImpl();
197 
198         clone.setPasswordPolicyRelId(getPasswordPolicyRelId());
199         clone.setPasswordPolicyId(getPasswordPolicyId());
200         clone.setClassNameId(getClassNameId());
201         clone.setClassPK(getClassPK());
202 
203         return clone;
204     }
205 
206     public int compareTo(Object obj) {
207         if (obj == null) {
208             return -1;
209         }
210 
211         PasswordPolicyRelImpl passwordPolicyRel = (PasswordPolicyRelImpl)obj;
212 
213         long pk = passwordPolicyRel.getPrimaryKey();
214 
215         if (getPrimaryKey() < pk) {
216             return -1;
217         }
218         else if (getPrimaryKey() > pk) {
219             return 1;
220         }
221         else {
222             return 0;
223         }
224     }
225 
226     public boolean equals(Object obj) {
227         if (obj == null) {
228             return false;
229         }
230 
231         PasswordPolicyRelImpl passwordPolicyRel = null;
232 
233         try {
234             passwordPolicyRel = (PasswordPolicyRelImpl)obj;
235         }
236         catch (ClassCastException cce) {
237             return false;
238         }
239 
240         long pk = passwordPolicyRel.getPrimaryKey();
241 
242         if (getPrimaryKey() == pk) {
243             return true;
244         }
245         else {
246             return false;
247         }
248     }
249 
250     public int hashCode() {
251         return (int)getPrimaryKey();
252     }
253 
254     private long _passwordPolicyRelId;
255     private long _passwordPolicyId;
256     private long _classNameId;
257     private long _classPK;
258 }