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.portlet.tags.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.impl.BaseModelImpl;
28  import com.liferay.portal.util.PropsUtil;
29  
30  import com.liferay.portlet.tags.model.TagsProperty;
31  
32  import com.liferay.util.Html;
33  
34  import java.io.Serializable;
35  
36  import java.lang.reflect.Proxy;
37  
38  import java.sql.Types;
39  
40  import java.util.Date;
41  
42  /**
43   * <a href="TagsPropertyModelImpl.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>TagsProperty</code> table
52   * in the database.
53   * </p>
54   *
55   * @author Brian Wing Shun Chan
56   *
57   * @see com.liferay.portlet.tags.service.model.TagsProperty
58   * @see com.liferay.portlet.tags.service.model.TagsPropertyModel
59   * @see com.liferay.portlet.tags.service.model.impl.TagsPropertyImpl
60   *
61   */
62  public class TagsPropertyModelImpl extends BaseModelImpl {
63      public static final String TABLE_NAME = "TagsProperty";
64      public static final Object[][] TABLE_COLUMNS = {
65              { "propertyId", new Integer(Types.BIGINT) },
66              
67  
68              { "companyId", new Integer(Types.BIGINT) },
69              
70  
71              { "userId", new Integer(Types.BIGINT) },
72              
73  
74              { "userName", new Integer(Types.VARCHAR) },
75              
76  
77              { "createDate", new Integer(Types.TIMESTAMP) },
78              
79  
80              { "modifiedDate", new Integer(Types.TIMESTAMP) },
81              
82  
83              { "entryId", new Integer(Types.BIGINT) },
84              
85  
86              { "key_", new Integer(Types.VARCHAR) },
87              
88  
89              { "value", new Integer(Types.VARCHAR) }
90          };
91      public static final String TABLE_SQL_CREATE = "create table TagsProperty (propertyId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,entryId LONG,key_ VARCHAR(75) null,value VARCHAR(300) null)";
92      public static final String TABLE_SQL_DROP = "drop table TagsProperty";
93      public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
94                  "value.object.finder.cache.enabled.com.liferay.portlet.tags.model.TagsProperty"),
95              true);
96      public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
97                  "lock.expiration.time.com.liferay.portlet.tags.model.TagsProperty"));
98  
99      public TagsPropertyModelImpl() {
100     }
101 
102     public long getPrimaryKey() {
103         return _propertyId;
104     }
105 
106     public void setPrimaryKey(long pk) {
107         setPropertyId(pk);
108     }
109 
110     public Serializable getPrimaryKeyObj() {
111         return new Long(_propertyId);
112     }
113 
114     public long getPropertyId() {
115         return _propertyId;
116     }
117 
118     public void setPropertyId(long propertyId) {
119         if (propertyId != _propertyId) {
120             _propertyId = propertyId;
121         }
122     }
123 
124     public long getCompanyId() {
125         return _companyId;
126     }
127 
128     public void setCompanyId(long companyId) {
129         if (companyId != _companyId) {
130             _companyId = companyId;
131         }
132     }
133 
134     public long getUserId() {
135         return _userId;
136     }
137 
138     public void setUserId(long userId) {
139         if (userId != _userId) {
140             _userId = userId;
141         }
142     }
143 
144     public String getUserName() {
145         return GetterUtil.getString(_userName);
146     }
147 
148     public void setUserName(String userName) {
149         if (((userName == null) && (_userName != null)) ||
150                 ((userName != null) && (_userName == null)) ||
151                 ((userName != null) && (_userName != null) &&
152                 !userName.equals(_userName))) {
153             _userName = userName;
154         }
155     }
156 
157     public Date getCreateDate() {
158         return _createDate;
159     }
160 
161     public void setCreateDate(Date createDate) {
162         if (((createDate == null) && (_createDate != null)) ||
163                 ((createDate != null) && (_createDate == null)) ||
164                 ((createDate != null) && (_createDate != null) &&
165                 !createDate.equals(_createDate))) {
166             _createDate = createDate;
167         }
168     }
169 
170     public Date getModifiedDate() {
171         return _modifiedDate;
172     }
173 
174     public void setModifiedDate(Date modifiedDate) {
175         if (((modifiedDate == null) && (_modifiedDate != null)) ||
176                 ((modifiedDate != null) && (_modifiedDate == null)) ||
177                 ((modifiedDate != null) && (_modifiedDate != null) &&
178                 !modifiedDate.equals(_modifiedDate))) {
179             _modifiedDate = modifiedDate;
180         }
181     }
182 
183     public long getEntryId() {
184         return _entryId;
185     }
186 
187     public void setEntryId(long entryId) {
188         if (entryId != _entryId) {
189             _entryId = entryId;
190         }
191     }
192 
193     public String getKey() {
194         return GetterUtil.getString(_key);
195     }
196 
197     public void setKey(String key) {
198         if (((key == null) && (_key != null)) ||
199                 ((key != null) && (_key == null)) ||
200                 ((key != null) && (_key != null) && !key.equals(_key))) {
201             _key = key;
202         }
203     }
204 
205     public String getValue() {
206         return GetterUtil.getString(_value);
207     }
208 
209     public void setValue(String value) {
210         if (((value == null) && (_value != null)) ||
211                 ((value != null) && (_value == null)) ||
212                 ((value != null) && (_value != null) && !value.equals(_value))) {
213             _value = value;
214         }
215     }
216 
217     public TagsProperty toEscapedModel() {
218         if (isEscapedModel()) {
219             return (TagsProperty)this;
220         }
221         else {
222             TagsProperty model = new TagsPropertyImpl();
223 
224             model.setEscapedModel(true);
225 
226             model.setPropertyId(getPropertyId());
227             model.setCompanyId(getCompanyId());
228             model.setUserId(getUserId());
229             model.setUserName(Html.escape(getUserName()));
230             model.setCreateDate(getCreateDate());
231             model.setModifiedDate(getModifiedDate());
232             model.setEntryId(getEntryId());
233             model.setKey(Html.escape(getKey()));
234             model.setValue(Html.escape(getValue()));
235 
236             model = (TagsProperty)Proxy.newProxyInstance(TagsProperty.class.getClassLoader(),
237                     new Class[] { TagsProperty.class },
238                     new ReadOnlyBeanHandler(model));
239 
240             return model;
241         }
242     }
243 
244     public Object clone() {
245         TagsPropertyImpl clone = new TagsPropertyImpl();
246 
247         clone.setPropertyId(getPropertyId());
248         clone.setCompanyId(getCompanyId());
249         clone.setUserId(getUserId());
250         clone.setUserName(getUserName());
251         clone.setCreateDate(getCreateDate());
252         clone.setModifiedDate(getModifiedDate());
253         clone.setEntryId(getEntryId());
254         clone.setKey(getKey());
255         clone.setValue(getValue());
256 
257         return clone;
258     }
259 
260     public int compareTo(Object obj) {
261         if (obj == null) {
262             return -1;
263         }
264 
265         TagsPropertyImpl tagsProperty = (TagsPropertyImpl)obj;
266 
267         int value = 0;
268 
269         value = getKey().compareTo(tagsProperty.getKey());
270 
271         if (value != 0) {
272             return value;
273         }
274 
275         return 0;
276     }
277 
278     public boolean equals(Object obj) {
279         if (obj == null) {
280             return false;
281         }
282 
283         TagsPropertyImpl tagsProperty = null;
284 
285         try {
286             tagsProperty = (TagsPropertyImpl)obj;
287         }
288         catch (ClassCastException cce) {
289             return false;
290         }
291 
292         long pk = tagsProperty.getPrimaryKey();
293 
294         if (getPrimaryKey() == pk) {
295             return true;
296         }
297         else {
298             return false;
299         }
300     }
301 
302     public int hashCode() {
303         return (int)getPrimaryKey();
304     }
305 
306     private long _propertyId;
307     private long _companyId;
308     private long _userId;
309     private String _userName;
310     private Date _createDate;
311     private Date _modifiedDate;
312     private long _entryId;
313     private String _key;
314     private String _value;
315 }