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