1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portal.model.impl;
21  
22  import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
23  import com.liferay.portal.kernel.util.GetterUtil;
24  import com.liferay.portal.kernel.util.StringPool;
25  import com.liferay.portal.model.PasswordPolicyRel;
26  import com.liferay.portal.model.PasswordPolicyRelSoap;
27  import com.liferay.portal.util.PortalUtil;
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 class is a model that represents the <code>PasswordPolicyRel</code> table
48   * in the database.
49   * </p>
50   *
51   * @author Brian Wing Shun Chan
52   *
53   * @see com.liferay.portal.model.PasswordPolicyRel
54   * @see com.liferay.portal.model.PasswordPolicyRelModel
55   * @see com.liferay.portal.model.impl.PasswordPolicyRelImpl
56   *
57   */
58  public class PasswordPolicyRelModelImpl extends BaseModelImpl {
59      public static final String TABLE_NAME = "PasswordPolicyRel";
60      public static final Object[][] TABLE_COLUMNS = {
61              { "passwordPolicyRelId", new Integer(Types.BIGINT) },
62              
63  
64              { "passwordPolicyId", new Integer(Types.BIGINT) },
65              
66  
67              { "classNameId", new Integer(Types.BIGINT) },
68              
69  
70              { "classPK", new Integer(Types.BIGINT) }
71          };
72      public static final String TABLE_SQL_CREATE = "create table PasswordPolicyRel (passwordPolicyRelId LONG not null primary key,passwordPolicyId LONG,classNameId LONG,classPK LONG)";
73      public static final String TABLE_SQL_DROP = "drop table PasswordPolicyRel";
74      public static final String DATA_SOURCE = "liferayDataSource";
75      public static final String SESSION_FACTORY = "liferaySessionFactory";
76      public static final String TX_MANAGER = "liferayTransactionManager";
77      public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.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(com.liferay.portal.util.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         if (getClassNameId() <= 0) {
143             return StringPool.BLANK;
144         }
145 
146         return PortalUtil.getClassName(getClassNameId());
147     }
148 
149     public long getClassNameId() {
150         return _classNameId;
151     }
152 
153     public void setClassNameId(long classNameId) {
154         if (classNameId != _classNameId) {
155             _classNameId = classNameId;
156         }
157     }
158 
159     public long getClassPK() {
160         return _classPK;
161     }
162 
163     public void setClassPK(long classPK) {
164         if (classPK != _classPK) {
165             _classPK = classPK;
166         }
167     }
168 
169     public PasswordPolicyRel toEscapedModel() {
170         if (isEscapedModel()) {
171             return (PasswordPolicyRel)this;
172         }
173         else {
174             PasswordPolicyRel model = new PasswordPolicyRelImpl();
175 
176             model.setNew(isNew());
177             model.setEscapedModel(true);
178 
179             model.setPasswordPolicyRelId(getPasswordPolicyRelId());
180             model.setPasswordPolicyId(getPasswordPolicyId());
181             model.setClassNameId(getClassNameId());
182             model.setClassPK(getClassPK());
183 
184             model = (PasswordPolicyRel)Proxy.newProxyInstance(PasswordPolicyRel.class.getClassLoader(),
185                     new Class[] { PasswordPolicyRel.class },
186                     new ReadOnlyBeanHandler(model));
187 
188             return model;
189         }
190     }
191 
192     public Object clone() {
193         PasswordPolicyRelImpl clone = new PasswordPolicyRelImpl();
194 
195         clone.setPasswordPolicyRelId(getPasswordPolicyRelId());
196         clone.setPasswordPolicyId(getPasswordPolicyId());
197         clone.setClassNameId(getClassNameId());
198         clone.setClassPK(getClassPK());
199 
200         return clone;
201     }
202 
203     public int compareTo(Object obj) {
204         if (obj == null) {
205             return -1;
206         }
207 
208         PasswordPolicyRelImpl passwordPolicyRel = (PasswordPolicyRelImpl)obj;
209 
210         long pk = passwordPolicyRel.getPrimaryKey();
211 
212         if (getPrimaryKey() < pk) {
213             return -1;
214         }
215         else if (getPrimaryKey() > pk) {
216             return 1;
217         }
218         else {
219             return 0;
220         }
221     }
222 
223     public boolean equals(Object obj) {
224         if (obj == null) {
225             return false;
226         }
227 
228         PasswordPolicyRelImpl passwordPolicyRel = null;
229 
230         try {
231             passwordPolicyRel = (PasswordPolicyRelImpl)obj;
232         }
233         catch (ClassCastException cce) {
234             return false;
235         }
236 
237         long pk = passwordPolicyRel.getPrimaryKey();
238 
239         if (getPrimaryKey() == pk) {
240             return true;
241         }
242         else {
243             return false;
244         }
245     }
246 
247     public int hashCode() {
248         return (int)getPrimaryKey();
249     }
250 
251     private long _passwordPolicyRelId;
252     private long _passwordPolicyId;
253     private long _classNameId;
254     private long _classPK;
255 }