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 com.liferay.portlet.expando.model.ExpandoBridge;
30  import com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl;
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.model.PasswordPolicyRel
57   * @see com.liferay.portal.model.PasswordPolicyRelModel
58   * @see com.liferay.portal.model.impl.PasswordPolicyRelImpl
59   *
60   */
61  public class PasswordPolicyRelModelImpl extends BaseModelImpl<PasswordPolicyRel> {
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 String DATA_SOURCE = "liferayDataSource";
78      public static final String SESSION_FACTORY = "liferaySessionFactory";
79      public static final String TX_MANAGER = "liferayTransactionManager";
80      public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
81                  "value.object.entity.cache.enabled.com.liferay.portal.model.PasswordPolicyRel"),
82              true);
83      public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
84                  "value.object.finder.cache.enabled.com.liferay.portal.model.PasswordPolicyRel"),
85              true);
86  
87      public static PasswordPolicyRel toModel(PasswordPolicyRelSoap soapModel) {
88          PasswordPolicyRel model = new PasswordPolicyRelImpl();
89  
90          model.setPasswordPolicyRelId(soapModel.getPasswordPolicyRelId());
91          model.setPasswordPolicyId(soapModel.getPasswordPolicyId());
92          model.setClassNameId(soapModel.getClassNameId());
93          model.setClassPK(soapModel.getClassPK());
94  
95          return model;
96      }
97  
98      public static List<PasswordPolicyRel> toModels(
99          PasswordPolicyRelSoap[] soapModels) {
100         List<PasswordPolicyRel> models = new ArrayList<PasswordPolicyRel>(soapModels.length);
101 
102         for (PasswordPolicyRelSoap soapModel : soapModels) {
103             models.add(toModel(soapModel));
104         }
105 
106         return models;
107     }
108 
109     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
110                 "lock.expiration.time.com.liferay.portal.model.PasswordPolicyRel"));
111 
112     public PasswordPolicyRelModelImpl() {
113     }
114 
115     public long getPrimaryKey() {
116         return _passwordPolicyRelId;
117     }
118 
119     public void setPrimaryKey(long pk) {
120         setPasswordPolicyRelId(pk);
121     }
122 
123     public Serializable getPrimaryKeyObj() {
124         return new Long(_passwordPolicyRelId);
125     }
126 
127     public long getPasswordPolicyRelId() {
128         return _passwordPolicyRelId;
129     }
130 
131     public void setPasswordPolicyRelId(long passwordPolicyRelId) {
132         _passwordPolicyRelId = passwordPolicyRelId;
133     }
134 
135     public long getPasswordPolicyId() {
136         return _passwordPolicyId;
137     }
138 
139     public void setPasswordPolicyId(long passwordPolicyId) {
140         _passwordPolicyId = passwordPolicyId;
141 
142         if (!_setOriginalPasswordPolicyId) {
143             _setOriginalPasswordPolicyId = true;
144 
145             _originalPasswordPolicyId = passwordPolicyId;
146         }
147     }
148 
149     public long getOriginalPasswordPolicyId() {
150         return _originalPasswordPolicyId;
151     }
152 
153     public String getClassName() {
154         if (getClassNameId() <= 0) {
155             return StringPool.BLANK;
156         }
157 
158         return PortalUtil.getClassName(getClassNameId());
159     }
160 
161     public long getClassNameId() {
162         return _classNameId;
163     }
164 
165     public void setClassNameId(long classNameId) {
166         _classNameId = classNameId;
167 
168         if (!_setOriginalClassNameId) {
169             _setOriginalClassNameId = true;
170 
171             _originalClassNameId = classNameId;
172         }
173     }
174 
175     public long getOriginalClassNameId() {
176         return _originalClassNameId;
177     }
178 
179     public long getClassPK() {
180         return _classPK;
181     }
182 
183     public void setClassPK(long classPK) {
184         _classPK = classPK;
185 
186         if (!_setOriginalClassPK) {
187             _setOriginalClassPK = true;
188 
189             _originalClassPK = classPK;
190         }
191     }
192 
193     public long getOriginalClassPK() {
194         return _originalClassPK;
195     }
196 
197     public PasswordPolicyRel toEscapedModel() {
198         if (isEscapedModel()) {
199             return (PasswordPolicyRel)this;
200         }
201         else {
202             PasswordPolicyRel model = new PasswordPolicyRelImpl();
203 
204             model.setNew(isNew());
205             model.setEscapedModel(true);
206 
207             model.setPasswordPolicyRelId(getPasswordPolicyRelId());
208             model.setPasswordPolicyId(getPasswordPolicyId());
209             model.setClassNameId(getClassNameId());
210             model.setClassPK(getClassPK());
211 
212             model = (PasswordPolicyRel)Proxy.newProxyInstance(PasswordPolicyRel.class.getClassLoader(),
213                     new Class[] { PasswordPolicyRel.class },
214                     new ReadOnlyBeanHandler(model));
215 
216             return model;
217         }
218     }
219 
220     public ExpandoBridge getExpandoBridge() {
221         if (_expandoBridge == null) {
222             _expandoBridge = new ExpandoBridgeImpl(PasswordPolicyRel.class.getName(),
223                     getPrimaryKey());
224         }
225 
226         return _expandoBridge;
227     }
228 
229     public Object clone() {
230         PasswordPolicyRelImpl clone = new PasswordPolicyRelImpl();
231 
232         clone.setPasswordPolicyRelId(getPasswordPolicyRelId());
233         clone.setPasswordPolicyId(getPasswordPolicyId());
234         clone.setClassNameId(getClassNameId());
235         clone.setClassPK(getClassPK());
236 
237         return clone;
238     }
239 
240     public int compareTo(PasswordPolicyRel passwordPolicyRel) {
241         long pk = passwordPolicyRel.getPrimaryKey();
242 
243         if (getPrimaryKey() < pk) {
244             return -1;
245         }
246         else if (getPrimaryKey() > pk) {
247             return 1;
248         }
249         else {
250             return 0;
251         }
252     }
253 
254     public boolean equals(Object obj) {
255         if (obj == null) {
256             return false;
257         }
258 
259         PasswordPolicyRel passwordPolicyRel = null;
260 
261         try {
262             passwordPolicyRel = (PasswordPolicyRel)obj;
263         }
264         catch (ClassCastException cce) {
265             return false;
266         }
267 
268         long pk = passwordPolicyRel.getPrimaryKey();
269 
270         if (getPrimaryKey() == pk) {
271             return true;
272         }
273         else {
274             return false;
275         }
276     }
277 
278     public int hashCode() {
279         return (int)getPrimaryKey();
280     }
281 
282     public String toString() {
283         StringBuilder sb = new StringBuilder();
284 
285         sb.append("{passwordPolicyRelId=");
286         sb.append(getPasswordPolicyRelId());
287         sb.append(", passwordPolicyId=");
288         sb.append(getPasswordPolicyId());
289         sb.append(", classNameId=");
290         sb.append(getClassNameId());
291         sb.append(", classPK=");
292         sb.append(getClassPK());
293         sb.append("}");
294 
295         return sb.toString();
296     }
297 
298     public String toXmlString() {
299         StringBuilder sb = new StringBuilder();
300 
301         sb.append("<model><model-name>");
302         sb.append("com.liferay.portal.model.PasswordPolicyRel");
303         sb.append("</model-name>");
304 
305         sb.append(
306             "<column><column-name>passwordPolicyRelId</column-name><column-value><![CDATA[");
307         sb.append(getPasswordPolicyRelId());
308         sb.append("]]></column-value></column>");
309         sb.append(
310             "<column><column-name>passwordPolicyId</column-name><column-value><![CDATA[");
311         sb.append(getPasswordPolicyId());
312         sb.append("]]></column-value></column>");
313         sb.append(
314             "<column><column-name>classNameId</column-name><column-value><![CDATA[");
315         sb.append(getClassNameId());
316         sb.append("]]></column-value></column>");
317         sb.append(
318             "<column><column-name>classPK</column-name><column-value><![CDATA[");
319         sb.append(getClassPK());
320         sb.append("]]></column-value></column>");
321 
322         sb.append("</model>");
323 
324         return sb.toString();
325     }
326 
327     private long _passwordPolicyRelId;
328     private long _passwordPolicyId;
329     private long _originalPasswordPolicyId;
330     private boolean _setOriginalPasswordPolicyId;
331     private long _classNameId;
332     private long _originalClassNameId;
333     private boolean _setOriginalClassNameId;
334     private long _classPK;
335     private long _originalClassPK;
336     private boolean _setOriginalClassPK;
337     private transient ExpandoBridge _expandoBridge;
338 }