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