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