1   /**
2    * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions 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.HtmlUtil;
28  import com.liferay.portal.model.WebDAVProps;
29  import com.liferay.portal.model.WebDAVPropsSoap;
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.Date;
40  import java.util.List;
41  
42  /**
43   * <a href="WebDAVPropsModelImpl.java.html"><b><i>View Source</i></b></a>
44   *
45   * <p>
46   * ServiceBuilder generated this class. Modifications in this class will be
47   * overwritten the next time is generated.
48   * </p>
49   *
50   * <p>
51   * This class is a model that represents the <code>WebDAVProps</code> table
52   * in the database.
53   * </p>
54   *
55   * @author Brian Wing Shun Chan
56   *
57   * @see com.liferay.portal.service.model.WebDAVProps
58   * @see com.liferay.portal.service.model.WebDAVPropsModel
59   * @see com.liferay.portal.service.model.impl.WebDAVPropsImpl
60   *
61   */
62  public class WebDAVPropsModelImpl extends BaseModelImpl {
63      public static final String TABLE_NAME = "WebDAVProps";
64      public static final Object[][] TABLE_COLUMNS = {
65              { "webDavPropsId", new Integer(Types.BIGINT) },
66              
67  
68              { "companyId", new Integer(Types.BIGINT) },
69              
70  
71              { "createDate", new Integer(Types.TIMESTAMP) },
72              
73  
74              { "modifiedDate", new Integer(Types.TIMESTAMP) },
75              
76  
77              { "classNameId", new Integer(Types.BIGINT) },
78              
79  
80              { "classPK", new Integer(Types.BIGINT) },
81              
82  
83              { "props", new Integer(Types.CLOB) }
84          };
85      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)";
86      public static final String TABLE_SQL_DROP = "drop table WebDAVProps";
87      public static final String DATA_SOURCE = "liferayDataSource";
88      public static final String SESSION_FACTORY = "liferaySessionFactory";
89      public static final String TX_MANAGER = "liferayTransactionManager";
90      public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
91                  "value.object.finder.cache.enabled.com.liferay.portal.model.WebDAVProps"),
92              true);
93  
94      public static WebDAVProps toModel(WebDAVPropsSoap soapModel) {
95          WebDAVProps model = new WebDAVPropsImpl();
96  
97          model.setWebDavPropsId(soapModel.getWebDavPropsId());
98          model.setCompanyId(soapModel.getCompanyId());
99          model.setCreateDate(soapModel.getCreateDate());
100         model.setModifiedDate(soapModel.getModifiedDate());
101         model.setClassNameId(soapModel.getClassNameId());
102         model.setClassPK(soapModel.getClassPK());
103         model.setProps(soapModel.getProps());
104 
105         return model;
106     }
107 
108     public static List<WebDAVProps> toModels(WebDAVPropsSoap[] soapModels) {
109         List<WebDAVProps> models = new ArrayList<WebDAVProps>(soapModels.length);
110 
111         for (WebDAVPropsSoap soapModel : soapModels) {
112             models.add(toModel(soapModel));
113         }
114 
115         return models;
116     }
117 
118     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
119                 "lock.expiration.time.com.liferay.portal.model.WebDAVProps"));
120 
121     public WebDAVPropsModelImpl() {
122     }
123 
124     public long getPrimaryKey() {
125         return _webDavPropsId;
126     }
127 
128     public void setPrimaryKey(long pk) {
129         setWebDavPropsId(pk);
130     }
131 
132     public Serializable getPrimaryKeyObj() {
133         return new Long(_webDavPropsId);
134     }
135 
136     public long getWebDavPropsId() {
137         return _webDavPropsId;
138     }
139 
140     public void setWebDavPropsId(long webDavPropsId) {
141         if (webDavPropsId != _webDavPropsId) {
142             _webDavPropsId = webDavPropsId;
143         }
144     }
145 
146     public long getCompanyId() {
147         return _companyId;
148     }
149 
150     public void setCompanyId(long companyId) {
151         if (companyId != _companyId) {
152             _companyId = companyId;
153         }
154     }
155 
156     public Date getCreateDate() {
157         return _createDate;
158     }
159 
160     public void setCreateDate(Date createDate) {
161         if (((createDate == null) && (_createDate != null)) ||
162                 ((createDate != null) && (_createDate == null)) ||
163                 ((createDate != null) && (_createDate != null) &&
164                 !createDate.equals(_createDate))) {
165             _createDate = createDate;
166         }
167     }
168 
169     public Date getModifiedDate() {
170         return _modifiedDate;
171     }
172 
173     public void setModifiedDate(Date modifiedDate) {
174         if (((modifiedDate == null) && (_modifiedDate != null)) ||
175                 ((modifiedDate != null) && (_modifiedDate == null)) ||
176                 ((modifiedDate != null) && (_modifiedDate != null) &&
177                 !modifiedDate.equals(_modifiedDate))) {
178             _modifiedDate = modifiedDate;
179         }
180     }
181 
182     public String getClassName() {
183         return PortalUtil.getClassName(getClassNameId());
184     }
185 
186     public long getClassNameId() {
187         return _classNameId;
188     }
189 
190     public void setClassNameId(long classNameId) {
191         if (classNameId != _classNameId) {
192             _classNameId = classNameId;
193         }
194     }
195 
196     public long getClassPK() {
197         return _classPK;
198     }
199 
200     public void setClassPK(long classPK) {
201         if (classPK != _classPK) {
202             _classPK = classPK;
203         }
204     }
205 
206     public String getProps() {
207         return GetterUtil.getString(_props);
208     }
209 
210     public void setProps(String props) {
211         if (((props == null) && (_props != null)) ||
212                 ((props != null) && (_props == null)) ||
213                 ((props != null) && (_props != null) && !props.equals(_props))) {
214             _props = props;
215         }
216     }
217 
218     public WebDAVProps toEscapedModel() {
219         if (isEscapedModel()) {
220             return (WebDAVProps)this;
221         }
222         else {
223             WebDAVProps model = new WebDAVPropsImpl();
224 
225             model.setEscapedModel(true);
226 
227             model.setWebDavPropsId(getWebDavPropsId());
228             model.setCompanyId(getCompanyId());
229             model.setCreateDate(getCreateDate());
230             model.setModifiedDate(getModifiedDate());
231             model.setClassNameId(getClassNameId());
232             model.setClassPK(getClassPK());
233             model.setProps(HtmlUtil.escape(getProps()));
234 
235             model = (WebDAVProps)Proxy.newProxyInstance(WebDAVProps.class.getClassLoader(),
236                     new Class[] { WebDAVProps.class },
237                     new ReadOnlyBeanHandler(model));
238 
239             return model;
240         }
241     }
242 
243     public Object clone() {
244         WebDAVPropsImpl clone = new WebDAVPropsImpl();
245 
246         clone.setWebDavPropsId(getWebDavPropsId());
247         clone.setCompanyId(getCompanyId());
248         clone.setCreateDate(getCreateDate());
249         clone.setModifiedDate(getModifiedDate());
250         clone.setClassNameId(getClassNameId());
251         clone.setClassPK(getClassPK());
252         clone.setProps(getProps());
253 
254         return clone;
255     }
256 
257     public int compareTo(Object obj) {
258         if (obj == null) {
259             return -1;
260         }
261 
262         WebDAVPropsImpl webDAVProps = (WebDAVPropsImpl)obj;
263 
264         long pk = webDAVProps.getPrimaryKey();
265 
266         if (getPrimaryKey() < pk) {
267             return -1;
268         }
269         else if (getPrimaryKey() > pk) {
270             return 1;
271         }
272         else {
273             return 0;
274         }
275     }
276 
277     public boolean equals(Object obj) {
278         if (obj == null) {
279             return false;
280         }
281 
282         WebDAVPropsImpl webDAVProps = null;
283 
284         try {
285             webDAVProps = (WebDAVPropsImpl)obj;
286         }
287         catch (ClassCastException cce) {
288             return false;
289         }
290 
291         long pk = webDAVProps.getPrimaryKey();
292 
293         if (getPrimaryKey() == pk) {
294             return true;
295         }
296         else {
297             return false;
298         }
299     }
300 
301     public int hashCode() {
302         return (int)getPrimaryKey();
303     }
304 
305     private long _webDavPropsId;
306     private long _companyId;
307     private Date _createDate;
308     private Date _modifiedDate;
309     private long _classNameId;
310     private long _classPK;
311     private String _props;
312 }