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