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