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