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