1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.asset.model.impl;
16  
17  import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
18  import com.liferay.portal.kernel.exception.SystemException;
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.asset.model.AssetTagProperty;
27  import com.liferay.portlet.asset.model.AssetTagPropertySoap;
28  import com.liferay.portlet.expando.model.ExpandoBridge;
29  import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
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="AssetTagPropertyModelImpl.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 AssetTagProperty table in the
51   * database.
52   * </p>
53   *
54   * @author    Brian Wing Shun Chan
55   * @see       AssetTagPropertyImpl
56   * @see       com.liferay.portlet.asset.model.AssetTagProperty
57   * @see       com.liferay.portlet.asset.model.AssetTagPropertyModel
58   * @generated
59   */
60  public class AssetTagPropertyModelImpl extends BaseModelImpl<AssetTagProperty> {
61      public static final String TABLE_NAME = "AssetTagProperty";
62      public static final Object[][] TABLE_COLUMNS = {
63              { "tagPropertyId", 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              { "tagId", 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 AssetTagProperty (tagPropertyId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,tagId LONG,key_ VARCHAR(75) null,value VARCHAR(255) null)";
74      public static final String TABLE_SQL_DROP = "drop table AssetTagProperty";
75      public static final String ORDER_BY_JPQL = " ORDER BY assetTagProperty.key ASC";
76      public static final String ORDER_BY_SQL = " ORDER BY AssetTagProperty.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.asset.model.AssetTagProperty"),
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.asset.model.AssetTagProperty"),
85              true);
86  
87      public static AssetTagProperty toModel(AssetTagPropertySoap soapModel) {
88          AssetTagProperty model = new AssetTagPropertyImpl();
89  
90          model.setTagPropertyId(soapModel.getTagPropertyId());
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.setTagId(soapModel.getTagId());
97          model.setKey(soapModel.getKey());
98          model.setValue(soapModel.getValue());
99  
100         return model;
101     }
102 
103     public static List<AssetTagProperty> toModels(
104         AssetTagPropertySoap[] soapModels) {
105         List<AssetTagProperty> models = new ArrayList<AssetTagProperty>(soapModels.length);
106 
107         for (AssetTagPropertySoap soapModel : soapModels) {
108             models.add(toModel(soapModel));
109         }
110 
111         return models;
112     }
113 
114     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
115                 "lock.expiration.time.com.liferay.portlet.asset.model.AssetTagProperty"));
116 
117     public AssetTagPropertyModelImpl() {
118     }
119 
120     public long getPrimaryKey() {
121         return _tagPropertyId;
122     }
123 
124     public void setPrimaryKey(long pk) {
125         setTagPropertyId(pk);
126     }
127 
128     public Serializable getPrimaryKeyObj() {
129         return new Long(_tagPropertyId);
130     }
131 
132     public long getTagPropertyId() {
133         return _tagPropertyId;
134     }
135 
136     public void setTagPropertyId(long tagPropertyId) {
137         _tagPropertyId = tagPropertyId;
138     }
139 
140     public long getCompanyId() {
141         return _companyId;
142     }
143 
144     public void setCompanyId(long companyId) {
145         _companyId = companyId;
146     }
147 
148     public long getUserId() {
149         return _userId;
150     }
151 
152     public void setUserId(long userId) {
153         _userId = userId;
154     }
155 
156     public String getUserUuid() throws SystemException {
157         return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
158     }
159 
160     public void setUserUuid(String userUuid) {
161         _userUuid = userUuid;
162     }
163 
164     public String getUserName() {
165         if (_userName == null) {
166             return StringPool.BLANK;
167         }
168         else {
169             return _userName;
170         }
171     }
172 
173     public void setUserName(String userName) {
174         _userName = userName;
175     }
176 
177     public Date getCreateDate() {
178         return _createDate;
179     }
180 
181     public void setCreateDate(Date createDate) {
182         _createDate = createDate;
183     }
184 
185     public Date getModifiedDate() {
186         return _modifiedDate;
187     }
188 
189     public void setModifiedDate(Date modifiedDate) {
190         _modifiedDate = modifiedDate;
191     }
192 
193     public long getTagId() {
194         return _tagId;
195     }
196 
197     public void setTagId(long tagId) {
198         _tagId = tagId;
199 
200         if (!_setOriginalTagId) {
201             _setOriginalTagId = true;
202 
203             _originalTagId = tagId;
204         }
205     }
206 
207     public long getOriginalTagId() {
208         return _originalTagId;
209     }
210 
211     public String getKey() {
212         if (_key == null) {
213             return StringPool.BLANK;
214         }
215         else {
216             return _key;
217         }
218     }
219 
220     public void setKey(String key) {
221         _key = key;
222 
223         if (_originalKey == null) {
224             _originalKey = key;
225         }
226     }
227 
228     public String getOriginalKey() {
229         return GetterUtil.getString(_originalKey);
230     }
231 
232     public String getValue() {
233         if (_value == null) {
234             return StringPool.BLANK;
235         }
236         else {
237             return _value;
238         }
239     }
240 
241     public void setValue(String value) {
242         _value = value;
243     }
244 
245     public AssetTagProperty toEscapedModel() {
246         if (isEscapedModel()) {
247             return (AssetTagProperty)this;
248         }
249         else {
250             return (AssetTagProperty)Proxy.newProxyInstance(AssetTagProperty.class.getClassLoader(),
251                 new Class[] { AssetTagProperty.class },
252                 new AutoEscapeBeanHandler(this));
253         }
254     }
255 
256     public ExpandoBridge getExpandoBridge() {
257         if (_expandoBridge == null) {
258             _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
259                     AssetTagProperty.class.getName(), getPrimaryKey());
260         }
261 
262         return _expandoBridge;
263     }
264 
265     public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
266         getExpandoBridge().setAttributes(serviceContext);
267     }
268 
269     public Object clone() {
270         AssetTagPropertyImpl clone = new AssetTagPropertyImpl();
271 
272         clone.setTagPropertyId(getTagPropertyId());
273         clone.setCompanyId(getCompanyId());
274         clone.setUserId(getUserId());
275         clone.setUserName(getUserName());
276         clone.setCreateDate(getCreateDate());
277         clone.setModifiedDate(getModifiedDate());
278         clone.setTagId(getTagId());
279         clone.setKey(getKey());
280         clone.setValue(getValue());
281 
282         return clone;
283     }
284 
285     public int compareTo(AssetTagProperty assetTagProperty) {
286         int value = 0;
287 
288         value = getKey().compareTo(assetTagProperty.getKey());
289 
290         if (value != 0) {
291             return value;
292         }
293 
294         return 0;
295     }
296 
297     public boolean equals(Object obj) {
298         if (obj == null) {
299             return false;
300         }
301 
302         AssetTagProperty assetTagProperty = null;
303 
304         try {
305             assetTagProperty = (AssetTagProperty)obj;
306         }
307         catch (ClassCastException cce) {
308             return false;
309         }
310 
311         long pk = assetTagProperty.getPrimaryKey();
312 
313         if (getPrimaryKey() == pk) {
314             return true;
315         }
316         else {
317             return false;
318         }
319     }
320 
321     public int hashCode() {
322         return (int)getPrimaryKey();
323     }
324 
325     public String toString() {
326         StringBundler sb = new StringBundler(19);
327 
328         sb.append("{tagPropertyId=");
329         sb.append(getTagPropertyId());
330         sb.append(", companyId=");
331         sb.append(getCompanyId());
332         sb.append(", userId=");
333         sb.append(getUserId());
334         sb.append(", userName=");
335         sb.append(getUserName());
336         sb.append(", createDate=");
337         sb.append(getCreateDate());
338         sb.append(", modifiedDate=");
339         sb.append(getModifiedDate());
340         sb.append(", tagId=");
341         sb.append(getTagId());
342         sb.append(", key=");
343         sb.append(getKey());
344         sb.append(", value=");
345         sb.append(getValue());
346         sb.append("}");
347 
348         return sb.toString();
349     }
350 
351     public String toXmlString() {
352         StringBundler sb = new StringBundler(31);
353 
354         sb.append("<model><model-name>");
355         sb.append("com.liferay.portlet.asset.model.AssetTagProperty");
356         sb.append("</model-name>");
357 
358         sb.append(
359             "<column><column-name>tagPropertyId</column-name><column-value><![CDATA[");
360         sb.append(getTagPropertyId());
361         sb.append("]]></column-value></column>");
362         sb.append(
363             "<column><column-name>companyId</column-name><column-value><![CDATA[");
364         sb.append(getCompanyId());
365         sb.append("]]></column-value></column>");
366         sb.append(
367             "<column><column-name>userId</column-name><column-value><![CDATA[");
368         sb.append(getUserId());
369         sb.append("]]></column-value></column>");
370         sb.append(
371             "<column><column-name>userName</column-name><column-value><![CDATA[");
372         sb.append(getUserName());
373         sb.append("]]></column-value></column>");
374         sb.append(
375             "<column><column-name>createDate</column-name><column-value><![CDATA[");
376         sb.append(getCreateDate());
377         sb.append("]]></column-value></column>");
378         sb.append(
379             "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
380         sb.append(getModifiedDate());
381         sb.append("]]></column-value></column>");
382         sb.append(
383             "<column><column-name>tagId</column-name><column-value><![CDATA[");
384         sb.append(getTagId());
385         sb.append("]]></column-value></column>");
386         sb.append(
387             "<column><column-name>key</column-name><column-value><![CDATA[");
388         sb.append(getKey());
389         sb.append("]]></column-value></column>");
390         sb.append(
391             "<column><column-name>value</column-name><column-value><![CDATA[");
392         sb.append(getValue());
393         sb.append("]]></column-value></column>");
394 
395         sb.append("</model>");
396 
397         return sb.toString();
398     }
399 
400     private long _tagPropertyId;
401     private long _companyId;
402     private long _userId;
403     private String _userUuid;
404     private String _userName;
405     private Date _createDate;
406     private Date _modifiedDate;
407     private long _tagId;
408     private long _originalTagId;
409     private boolean _setOriginalTagId;
410     private String _key;
411     private String _originalKey;
412     private String _value;
413     private transient ExpandoBridge _expandoBridge;
414 }