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.portlet.tags.model.impl;
16  
17  import com.liferay.portal.SystemException;
18  import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
19  import com.liferay.portal.kernel.util.GetterUtil;
20  import com.liferay.portal.kernel.util.HtmlUtil;
21  import com.liferay.portal.kernel.util.StringBundler;
22  import com.liferay.portal.model.impl.BaseModelImpl;
23  import com.liferay.portal.util.PortalUtil;
24  
25  import com.liferay.portlet.tags.model.TagsProperty;
26  import com.liferay.portlet.tags.model.TagsPropertySoap;
27  
28  import java.io.Serializable;
29  
30  import java.lang.reflect.Proxy;
31  
32  import java.sql.Types;
33  
34  import java.util.ArrayList;
35  import java.util.Date;
36  import java.util.List;
37  
38  /**
39   * <a href="TagsPropertyModelImpl.java.html"><b><i>View Source</i></b></a>
40   *
41   * <p>
42   * ServiceBuilder generated this class. Modifications in this class will be
43   * overwritten the next time is generated.
44   * </p>
45   *
46   * <p>
47   * This interface is a model that represents the TagsProperty table in the
48   * database.
49   * </p>
50   *
51   * @author    Brian Wing Shun Chan
52   * @see       TagsPropertyImpl
53   * @see       com.liferay.portlet.tags.model.TagsProperty
54   * @see       com.liferay.portlet.tags.model.TagsPropertyModel
55   * @generated
56   */
57  public class TagsPropertyModelImpl extends BaseModelImpl<TagsProperty> {
58      public static final String TABLE_NAME = "TagsProperty";
59      public static final Object[][] TABLE_COLUMNS = {
60              { "propertyId", new Integer(Types.BIGINT) },
61              { "companyId", new Integer(Types.BIGINT) },
62              { "userId", new Integer(Types.BIGINT) },
63              { "userName", new Integer(Types.VARCHAR) },
64              { "createDate", new Integer(Types.TIMESTAMP) },
65              { "modifiedDate", new Integer(Types.TIMESTAMP) },
66              { "entryId", new Integer(Types.BIGINT) },
67              { "key_", new Integer(Types.VARCHAR) },
68              { "value", new Integer(Types.VARCHAR) }
69          };
70      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(255) null)";
71      public static final String TABLE_SQL_DROP = "drop table TagsProperty";
72      public static final String ORDER_BY_JPQL = " ORDER BY tagsProperty.key ASC";
73      public static final String ORDER_BY_SQL = " ORDER BY TagsProperty.key_ ASC";
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.portlet.tags.model.TagsProperty"),
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.portlet.tags.model.TagsProperty"),
82              true);
83  
84      public static TagsProperty toModel(TagsPropertySoap soapModel) {
85          TagsProperty model = new TagsPropertyImpl();
86  
87          model.setPropertyId(soapModel.getPropertyId());
88          model.setCompanyId(soapModel.getCompanyId());
89          model.setUserId(soapModel.getUserId());
90          model.setUserName(soapModel.getUserName());
91          model.setCreateDate(soapModel.getCreateDate());
92          model.setModifiedDate(soapModel.getModifiedDate());
93          model.setEntryId(soapModel.getEntryId());
94          model.setKey(soapModel.getKey());
95          model.setValue(soapModel.getValue());
96  
97          return model;
98      }
99  
100     public static List<TagsProperty> toModels(TagsPropertySoap[] soapModels) {
101         List<TagsProperty> models = new ArrayList<TagsProperty>(soapModels.length);
102 
103         for (TagsPropertySoap soapModel : soapModels) {
104             models.add(toModel(soapModel));
105         }
106 
107         return models;
108     }
109 
110     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
111                 "lock.expiration.time.com.liferay.portlet.tags.model.TagsProperty"));
112 
113     public TagsPropertyModelImpl() {
114     }
115 
116     public long getPrimaryKey() {
117         return _propertyId;
118     }
119 
120     public void setPrimaryKey(long pk) {
121         setPropertyId(pk);
122     }
123 
124     public Serializable getPrimaryKeyObj() {
125         return new Long(_propertyId);
126     }
127 
128     public long getPropertyId() {
129         return _propertyId;
130     }
131 
132     public void setPropertyId(long propertyId) {
133         _propertyId = propertyId;
134     }
135 
136     public long getCompanyId() {
137         return _companyId;
138     }
139 
140     public void setCompanyId(long companyId) {
141         _companyId = companyId;
142     }
143 
144     public long getUserId() {
145         return _userId;
146     }
147 
148     public void setUserId(long userId) {
149         _userId = userId;
150     }
151 
152     public String getUserUuid() throws SystemException {
153         return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
154     }
155 
156     public void setUserUuid(String userUuid) {
157         _userUuid = userUuid;
158     }
159 
160     public String getUserName() {
161         return GetterUtil.getString(_userName);
162     }
163 
164     public void setUserName(String userName) {
165         _userName = userName;
166     }
167 
168     public Date getCreateDate() {
169         return _createDate;
170     }
171 
172     public void setCreateDate(Date createDate) {
173         _createDate = createDate;
174     }
175 
176     public Date getModifiedDate() {
177         return _modifiedDate;
178     }
179 
180     public void setModifiedDate(Date modifiedDate) {
181         _modifiedDate = modifiedDate;
182     }
183 
184     public long getEntryId() {
185         return _entryId;
186     }
187 
188     public void setEntryId(long entryId) {
189         _entryId = entryId;
190 
191         if (!_setOriginalEntryId) {
192             _setOriginalEntryId = true;
193 
194             _originalEntryId = entryId;
195         }
196     }
197 
198     public long getOriginalEntryId() {
199         return _originalEntryId;
200     }
201 
202     public String getKey() {
203         return GetterUtil.getString(_key);
204     }
205 
206     public void setKey(String key) {
207         _key = key;
208 
209         if (_originalKey == null) {
210             _originalKey = key;
211         }
212     }
213 
214     public String getOriginalKey() {
215         return GetterUtil.getString(_originalKey);
216     }
217 
218     public String getValue() {
219         return GetterUtil.getString(_value);
220     }
221 
222     public void setValue(String value) {
223         _value = value;
224     }
225 
226     public TagsProperty toEscapedModel() {
227         if (isEscapedModel()) {
228             return (TagsProperty)this;
229         }
230         else {
231             TagsProperty model = new TagsPropertyImpl();
232 
233             model.setNew(isNew());
234             model.setEscapedModel(true);
235 
236             model.setPropertyId(getPropertyId());
237             model.setCompanyId(getCompanyId());
238             model.setUserId(getUserId());
239             model.setUserName(HtmlUtil.escape(getUserName()));
240             model.setCreateDate(getCreateDate());
241             model.setModifiedDate(getModifiedDate());
242             model.setEntryId(getEntryId());
243             model.setKey(HtmlUtil.escape(getKey()));
244             model.setValue(HtmlUtil.escape(getValue()));
245 
246             model = (TagsProperty)Proxy.newProxyInstance(TagsProperty.class.getClassLoader(),
247                     new Class[] { TagsProperty.class },
248                     new ReadOnlyBeanHandler(model));
249 
250             return model;
251         }
252     }
253 
254     public Object clone() {
255         TagsPropertyImpl clone = new TagsPropertyImpl();
256 
257         clone.setPropertyId(getPropertyId());
258         clone.setCompanyId(getCompanyId());
259         clone.setUserId(getUserId());
260         clone.setUserName(getUserName());
261         clone.setCreateDate(getCreateDate());
262         clone.setModifiedDate(getModifiedDate());
263         clone.setEntryId(getEntryId());
264         clone.setKey(getKey());
265         clone.setValue(getValue());
266 
267         return clone;
268     }
269 
270     public int compareTo(TagsProperty tagsProperty) {
271         int value = 0;
272 
273         value = getKey().compareTo(tagsProperty.getKey());
274 
275         if (value != 0) {
276             return value;
277         }
278 
279         return 0;
280     }
281 
282     public boolean equals(Object obj) {
283         if (obj == null) {
284             return false;
285         }
286 
287         TagsProperty tagsProperty = null;
288 
289         try {
290             tagsProperty = (TagsProperty)obj;
291         }
292         catch (ClassCastException cce) {
293             return false;
294         }
295 
296         long pk = tagsProperty.getPrimaryKey();
297 
298         if (getPrimaryKey() == pk) {
299             return true;
300         }
301         else {
302             return false;
303         }
304     }
305 
306     public int hashCode() {
307         return (int)getPrimaryKey();
308     }
309 
310     public String toString() {
311         StringBundler sb = new StringBundler(19);
312 
313         sb.append("{propertyId=");
314         sb.append(getPropertyId());
315         sb.append(", companyId=");
316         sb.append(getCompanyId());
317         sb.append(", userId=");
318         sb.append(getUserId());
319         sb.append(", userName=");
320         sb.append(getUserName());
321         sb.append(", createDate=");
322         sb.append(getCreateDate());
323         sb.append(", modifiedDate=");
324         sb.append(getModifiedDate());
325         sb.append(", entryId=");
326         sb.append(getEntryId());
327         sb.append(", key=");
328         sb.append(getKey());
329         sb.append(", value=");
330         sb.append(getValue());
331         sb.append("}");
332 
333         return sb.toString();
334     }
335 
336     public String toXmlString() {
337         StringBundler sb = new StringBundler(31);
338 
339         sb.append("<model><model-name>");
340         sb.append("com.liferay.portlet.tags.model.TagsProperty");
341         sb.append("</model-name>");
342 
343         sb.append(
344             "<column><column-name>propertyId</column-name><column-value><![CDATA[");
345         sb.append(getPropertyId());
346         sb.append("]]></column-value></column>");
347         sb.append(
348             "<column><column-name>companyId</column-name><column-value><![CDATA[");
349         sb.append(getCompanyId());
350         sb.append("]]></column-value></column>");
351         sb.append(
352             "<column><column-name>userId</column-name><column-value><![CDATA[");
353         sb.append(getUserId());
354         sb.append("]]></column-value></column>");
355         sb.append(
356             "<column><column-name>userName</column-name><column-value><![CDATA[");
357         sb.append(getUserName());
358         sb.append("]]></column-value></column>");
359         sb.append(
360             "<column><column-name>createDate</column-name><column-value><![CDATA[");
361         sb.append(getCreateDate());
362         sb.append("]]></column-value></column>");
363         sb.append(
364             "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
365         sb.append(getModifiedDate());
366         sb.append("]]></column-value></column>");
367         sb.append(
368             "<column><column-name>entryId</column-name><column-value><![CDATA[");
369         sb.append(getEntryId());
370         sb.append("]]></column-value></column>");
371         sb.append(
372             "<column><column-name>key</column-name><column-value><![CDATA[");
373         sb.append(getKey());
374         sb.append("]]></column-value></column>");
375         sb.append(
376             "<column><column-name>value</column-name><column-value><![CDATA[");
377         sb.append(getValue());
378         sb.append("]]></column-value></column>");
379 
380         sb.append("</model>");
381 
382         return sb.toString();
383     }
384 
385     private long _propertyId;
386     private long _companyId;
387     private long _userId;
388     private String _userUuid;
389     private String _userName;
390     private Date _createDate;
391     private Date _modifiedDate;
392     private long _entryId;
393     private long _originalEntryId;
394     private boolean _setOriginalEntryId;
395     private String _key;
396     private String _originalKey;
397     private String _value;
398 }