1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights 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 interface is a model that represents the PasswordPolicyRel table in the
51   * database.
52   * </p>
53   *
54   * @author    Brian Wing Shun Chan
55   * @see       PasswordPolicyRelImpl
56   * @see       com.liferay.portal.model.PasswordPolicyRel
57   * @see       com.liferay.portal.model.PasswordPolicyRelModel
58   * @generated
59   */
60  public class PasswordPolicyRelModelImpl extends BaseModelImpl<PasswordPolicyRel> {
61      public static final String TABLE_NAME = "PasswordPolicyRel";
62      public static final Object[][] TABLE_COLUMNS = {
63              { "passwordPolicyRelId", new Integer(Types.BIGINT) },
64              { "passwordPolicyId", new Integer(Types.BIGINT) },
65              { "classNameId", new Integer(Types.BIGINT) },
66              { "classPK", new Integer(Types.BIGINT) }
67          };
68      public static final String TABLE_SQL_CREATE = "create table PasswordPolicyRel (passwordPolicyRelId LONG not null primary key,passwordPolicyId LONG,classNameId LONG,classPK LONG)";
69      public static final String TABLE_SQL_DROP = "drop table PasswordPolicyRel";
70      public static final String DATA_SOURCE = "liferayDataSource";
71      public static final String SESSION_FACTORY = "liferaySessionFactory";
72      public static final String TX_MANAGER = "liferayTransactionManager";
73      public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
74                  "value.object.entity.cache.enabled.com.liferay.portal.model.PasswordPolicyRel"),
75              true);
76      public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
77                  "value.object.finder.cache.enabled.com.liferay.portal.model.PasswordPolicyRel"),
78              true);
79  
80      public static PasswordPolicyRel toModel(PasswordPolicyRelSoap soapModel) {
81          PasswordPolicyRel model = new PasswordPolicyRelImpl();
82  
83          model.setPasswordPolicyRelId(soapModel.getPasswordPolicyRelId());
84          model.setPasswordPolicyId(soapModel.getPasswordPolicyId());
85          model.setClassNameId(soapModel.getClassNameId());
86          model.setClassPK(soapModel.getClassPK());
87  
88          return model;
89      }
90  
91      public static List<PasswordPolicyRel> toModels(
92          PasswordPolicyRelSoap[] soapModels) {
93          List<PasswordPolicyRel> models = new ArrayList<PasswordPolicyRel>(soapModels.length);
94  
95          for (PasswordPolicyRelSoap soapModel : soapModels) {
96              models.add(toModel(soapModel));
97          }
98  
99          return models;
100     }
101 
102     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
103                 "lock.expiration.time.com.liferay.portal.model.PasswordPolicyRel"));
104 
105     public PasswordPolicyRelModelImpl() {
106     }
107 
108     public long getPrimaryKey() {
109         return _passwordPolicyRelId;
110     }
111 
112     public void setPrimaryKey(long pk) {
113         setPasswordPolicyRelId(pk);
114     }
115 
116     public Serializable getPrimaryKeyObj() {
117         return new Long(_passwordPolicyRelId);
118     }
119 
120     public long getPasswordPolicyRelId() {
121         return _passwordPolicyRelId;
122     }
123 
124     public void setPasswordPolicyRelId(long passwordPolicyRelId) {
125         _passwordPolicyRelId = passwordPolicyRelId;
126     }
127 
128     public long getPasswordPolicyId() {
129         return _passwordPolicyId;
130     }
131 
132     public void setPasswordPolicyId(long passwordPolicyId) {
133         _passwordPolicyId = passwordPolicyId;
134 
135         if (!_setOriginalPasswordPolicyId) {
136             _setOriginalPasswordPolicyId = true;
137 
138             _originalPasswordPolicyId = passwordPolicyId;
139         }
140     }
141 
142     public long getOriginalPasswordPolicyId() {
143         return _originalPasswordPolicyId;
144     }
145 
146     public String getClassName() {
147         if (getClassNameId() <= 0) {
148             return StringPool.BLANK;
149         }
150 
151         return PortalUtil.getClassName(getClassNameId());
152     }
153 
154     public long getClassNameId() {
155         return _classNameId;
156     }
157 
158     public void setClassNameId(long classNameId) {
159         _classNameId = classNameId;
160 
161         if (!_setOriginalClassNameId) {
162             _setOriginalClassNameId = true;
163 
164             _originalClassNameId = classNameId;
165         }
166     }
167 
168     public long getOriginalClassNameId() {
169         return _originalClassNameId;
170     }
171 
172     public long getClassPK() {
173         return _classPK;
174     }
175 
176     public void setClassPK(long classPK) {
177         _classPK = classPK;
178 
179         if (!_setOriginalClassPK) {
180             _setOriginalClassPK = true;
181 
182             _originalClassPK = classPK;
183         }
184     }
185 
186     public long getOriginalClassPK() {
187         return _originalClassPK;
188     }
189 
190     public PasswordPolicyRel toEscapedModel() {
191         if (isEscapedModel()) {
192             return (PasswordPolicyRel)this;
193         }
194         else {
195             PasswordPolicyRel model = new PasswordPolicyRelImpl();
196 
197             model.setNew(isNew());
198             model.setEscapedModel(true);
199 
200             model.setPasswordPolicyRelId(getPasswordPolicyRelId());
201             model.setPasswordPolicyId(getPasswordPolicyId());
202             model.setClassNameId(getClassNameId());
203             model.setClassPK(getClassPK());
204 
205             model = (PasswordPolicyRel)Proxy.newProxyInstance(PasswordPolicyRel.class.getClassLoader(),
206                     new Class[] { PasswordPolicyRel.class },
207                     new ReadOnlyBeanHandler(model));
208 
209             return model;
210         }
211     }
212 
213     public Object clone() {
214         PasswordPolicyRelImpl clone = new PasswordPolicyRelImpl();
215 
216         clone.setPasswordPolicyRelId(getPasswordPolicyRelId());
217         clone.setPasswordPolicyId(getPasswordPolicyId());
218         clone.setClassNameId(getClassNameId());
219         clone.setClassPK(getClassPK());
220 
221         return clone;
222     }
223 
224     public int compareTo(PasswordPolicyRel passwordPolicyRel) {
225         long pk = passwordPolicyRel.getPrimaryKey();
226 
227         if (getPrimaryKey() < pk) {
228             return -1;
229         }
230         else if (getPrimaryKey() > pk) {
231             return 1;
232         }
233         else {
234             return 0;
235         }
236     }
237 
238     public boolean equals(Object obj) {
239         if (obj == null) {
240             return false;
241         }
242 
243         PasswordPolicyRel passwordPolicyRel = null;
244 
245         try {
246             passwordPolicyRel = (PasswordPolicyRel)obj;
247         }
248         catch (ClassCastException cce) {
249             return false;
250         }
251 
252         long pk = passwordPolicyRel.getPrimaryKey();
253 
254         if (getPrimaryKey() == pk) {
255             return true;
256         }
257         else {
258             return false;
259         }
260     }
261 
262     public int hashCode() {
263         return (int)getPrimaryKey();
264     }
265 
266     public String toString() {
267         StringBuilder sb = new StringBuilder();
268 
269         sb.append("{passwordPolicyRelId=");
270         sb.append(getPasswordPolicyRelId());
271         sb.append(", passwordPolicyId=");
272         sb.append(getPasswordPolicyId());
273         sb.append(", classNameId=");
274         sb.append(getClassNameId());
275         sb.append(", classPK=");
276         sb.append(getClassPK());
277         sb.append("}");
278 
279         return sb.toString();
280     }
281 
282     public String toXmlString() {
283         StringBuilder sb = new StringBuilder();
284 
285         sb.append("<model><model-name>");
286         sb.append("com.liferay.portal.model.PasswordPolicyRel");
287         sb.append("</model-name>");
288 
289         sb.append(
290             "<column><column-name>passwordPolicyRelId</column-name><column-value><![CDATA[");
291         sb.append(getPasswordPolicyRelId());
292         sb.append("]]></column-value></column>");
293         sb.append(
294             "<column><column-name>passwordPolicyId</column-name><column-value><![CDATA[");
295         sb.append(getPasswordPolicyId());
296         sb.append("]]></column-value></column>");
297         sb.append(
298             "<column><column-name>classNameId</column-name><column-value><![CDATA[");
299         sb.append(getClassNameId());
300         sb.append("]]></column-value></column>");
301         sb.append(
302             "<column><column-name>classPK</column-name><column-value><![CDATA[");
303         sb.append(getClassPK());
304         sb.append("]]></column-value></column>");
305 
306         sb.append("</model>");
307 
308         return sb.toString();
309     }
310 
311     private long _passwordPolicyRelId;
312     private long _passwordPolicyId;
313     private long _originalPasswordPolicyId;
314     private boolean _setOriginalPasswordPolicyId;
315     private long _classNameId;
316     private long _originalClassNameId;
317     private boolean _setOriginalClassNameId;
318     private long _classPK;
319     private long _originalClassPK;
320     private boolean _setOriginalClassPK;
321 }