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