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.model.WebDAVProps;
28  import com.liferay.portal.util.PropsUtil;
29  
30  import com.liferay.util.Html;
31  
32  import java.io.Serializable;
33  
34  import java.lang.reflect.Proxy;
35  
36  import java.sql.Types;
37  
38  import java.util.Date;
39  
40  /**
41   * <a href="WebDAVPropsModelImpl.java.html"><b><i>View Source</i></b></a>
42   *
43   * <p>
44   * ServiceBuilder generated this class. Modifications in this class will be
45   * overwritten the next time is generated.
46   * </p>
47   *
48   * <p>
49   * This class is a model that represents the <code>WebDAVProps</code> table
50   * in the database.
51   * </p>
52   *
53   * @author Brian Wing Shun Chan
54   *
55   * @see com.liferay.portal.service.model.WebDAVProps
56   * @see com.liferay.portal.service.model.WebDAVPropsModel
57   * @see com.liferay.portal.service.model.impl.WebDAVPropsImpl
58   *
59   */
60  public class WebDAVPropsModelImpl extends BaseModelImpl {
61      public static final String TABLE_NAME = "WebDAVProps";
62      public static final Object[][] TABLE_COLUMNS = {
63              { "webDavPropsId", new Integer(Types.BIGINT) },
64              
65  
66              { "companyId", new Integer(Types.BIGINT) },
67              
68  
69              { "createDate", new Integer(Types.TIMESTAMP) },
70              
71  
72              { "modifiedDate", new Integer(Types.TIMESTAMP) },
73              
74  
75              { "classNameId", new Integer(Types.BIGINT) },
76              
77  
78              { "classPK", new Integer(Types.BIGINT) },
79              
80  
81              { "props", new Integer(Types.CLOB) }
82          };
83      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)";
84      public static final String TABLE_SQL_DROP = "drop table WebDAVProps";
85      public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
86                  "value.object.finder.cache.enabled.com.liferay.portal.model.WebDAVProps"),
87              true);
88      public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
89                  "lock.expiration.time.com.liferay.portal.model.WebDAVProps"));
90  
91      public WebDAVPropsModelImpl() {
92      }
93  
94      public long getPrimaryKey() {
95          return _webDavPropsId;
96      }
97  
98      public void setPrimaryKey(long pk) {
99          setWebDavPropsId(pk);
100     }
101 
102     public Serializable getPrimaryKeyObj() {
103         return new Long(_webDavPropsId);
104     }
105 
106     public long getWebDavPropsId() {
107         return _webDavPropsId;
108     }
109 
110     public void setWebDavPropsId(long webDavPropsId) {
111         if (webDavPropsId != _webDavPropsId) {
112             _webDavPropsId = webDavPropsId;
113         }
114     }
115 
116     public long getCompanyId() {
117         return _companyId;
118     }
119 
120     public void setCompanyId(long companyId) {
121         if (companyId != _companyId) {
122             _companyId = companyId;
123         }
124     }
125 
126     public Date getCreateDate() {
127         return _createDate;
128     }
129 
130     public void setCreateDate(Date createDate) {
131         if (((createDate == null) && (_createDate != null)) ||
132                 ((createDate != null) && (_createDate == null)) ||
133                 ((createDate != null) && (_createDate != null) &&
134                 !createDate.equals(_createDate))) {
135             _createDate = createDate;
136         }
137     }
138 
139     public Date getModifiedDate() {
140         return _modifiedDate;
141     }
142 
143     public void setModifiedDate(Date modifiedDate) {
144         if (((modifiedDate == null) && (_modifiedDate != null)) ||
145                 ((modifiedDate != null) && (_modifiedDate == null)) ||
146                 ((modifiedDate != null) && (_modifiedDate != null) &&
147                 !modifiedDate.equals(_modifiedDate))) {
148             _modifiedDate = modifiedDate;
149         }
150     }
151 
152     public long getClassNameId() {
153         return _classNameId;
154     }
155 
156     public void setClassNameId(long classNameId) {
157         if (classNameId != _classNameId) {
158             _classNameId = classNameId;
159         }
160     }
161 
162     public long getClassPK() {
163         return _classPK;
164     }
165 
166     public void setClassPK(long classPK) {
167         if (classPK != _classPK) {
168             _classPK = classPK;
169         }
170     }
171 
172     public String getProps() {
173         return GetterUtil.getString(_props);
174     }
175 
176     public void setProps(String props) {
177         if (((props == null) && (_props != null)) ||
178                 ((props != null) && (_props == null)) ||
179                 ((props != null) && (_props != null) && !props.equals(_props))) {
180             _props = props;
181         }
182     }
183 
184     public WebDAVProps toEscapedModel() {
185         if (isEscapedModel()) {
186             return (WebDAVProps)this;
187         }
188         else {
189             WebDAVProps model = new WebDAVPropsImpl();
190 
191             model.setEscapedModel(true);
192 
193             model.setWebDavPropsId(getWebDavPropsId());
194             model.setCompanyId(getCompanyId());
195             model.setCreateDate(getCreateDate());
196             model.setModifiedDate(getModifiedDate());
197             model.setClassNameId(getClassNameId());
198             model.setClassPK(getClassPK());
199             model.setProps(Html.escape(getProps()));
200 
201             model = (WebDAVProps)Proxy.newProxyInstance(WebDAVProps.class.getClassLoader(),
202                     new Class[] { WebDAVProps.class },
203                     new ReadOnlyBeanHandler(model));
204 
205             return model;
206         }
207     }
208 
209     public Object clone() {
210         WebDAVPropsImpl clone = new WebDAVPropsImpl();
211 
212         clone.setWebDavPropsId(getWebDavPropsId());
213         clone.setCompanyId(getCompanyId());
214         clone.setCreateDate(getCreateDate());
215         clone.setModifiedDate(getModifiedDate());
216         clone.setClassNameId(getClassNameId());
217         clone.setClassPK(getClassPK());
218         clone.setProps(getProps());
219 
220         return clone;
221     }
222 
223     public int compareTo(Object obj) {
224         if (obj == null) {
225             return -1;
226         }
227 
228         WebDAVPropsImpl webDAVProps = (WebDAVPropsImpl)obj;
229 
230         long pk = webDAVProps.getPrimaryKey();
231 
232         if (getPrimaryKey() < pk) {
233             return -1;
234         }
235         else if (getPrimaryKey() > pk) {
236             return 1;
237         }
238         else {
239             return 0;
240         }
241     }
242 
243     public boolean equals(Object obj) {
244         if (obj == null) {
245             return false;
246         }
247 
248         WebDAVPropsImpl webDAVProps = null;
249 
250         try {
251             webDAVProps = (WebDAVPropsImpl)obj;
252         }
253         catch (ClassCastException cce) {
254             return false;
255         }
256 
257         long pk = webDAVProps.getPrimaryKey();
258 
259         if (getPrimaryKey() == pk) {
260             return true;
261         }
262         else {
263             return false;
264         }
265     }
266 
267     public int hashCode() {
268         return (int)getPrimaryKey();
269     }
270 
271     private long _webDavPropsId;
272     private long _companyId;
273     private Date _createDate;
274     private Date _modifiedDate;
275     private long _classNameId;
276     private long _classPK;
277     private String _props;
278 }