1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights 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.SystemException;
26  import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
27  import com.liferay.portal.kernel.util.GetterUtil;
28  import com.liferay.portal.kernel.util.HtmlUtil;
29  import com.liferay.portal.model.impl.BaseModelImpl;
30  import com.liferay.portal.util.PortalUtil;
31  
32  import com.liferay.portlet.expando.model.ExpandoBridge;
33  import com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl;
34  import com.liferay.portlet.tags.model.TagsEntry;
35  import com.liferay.portlet.tags.model.TagsEntrySoap;
36  
37  import java.io.Serializable;
38  
39  import java.lang.reflect.Proxy;
40  
41  import java.sql.Types;
42  
43  import java.util.ArrayList;
44  import java.util.Date;
45  import java.util.List;
46  
47  /**
48   * <a href="TagsEntryModelImpl.java.html"><b><i>View Source</i></b></a>
49   *
50   * <p>
51   * ServiceBuilder generated this class. Modifications in this class will be
52   * overwritten the next time is generated.
53   * </p>
54   *
55   * <p>
56   * This class is a model that represents the <code>TagsEntry</code> table
57   * in the database.
58   * </p>
59   *
60   * @author Brian Wing Shun Chan
61   *
62   * @see com.liferay.portlet.tags.model.TagsEntry
63   * @see com.liferay.portlet.tags.model.TagsEntryModel
64   * @see com.liferay.portlet.tags.model.impl.TagsEntryImpl
65   *
66   */
67  public class TagsEntryModelImpl extends BaseModelImpl<TagsEntry> {
68      public static final String TABLE_NAME = "TagsEntry";
69      public static final Object[][] TABLE_COLUMNS = {
70              { "entryId", new Integer(Types.BIGINT) },
71              
72  
73              { "groupId", new Integer(Types.BIGINT) },
74              
75  
76              { "companyId", new Integer(Types.BIGINT) },
77              
78  
79              { "userId", new Integer(Types.BIGINT) },
80              
81  
82              { "userName", new Integer(Types.VARCHAR) },
83              
84  
85              { "createDate", new Integer(Types.TIMESTAMP) },
86              
87  
88              { "modifiedDate", new Integer(Types.TIMESTAMP) },
89              
90  
91              { "parentEntryId", new Integer(Types.BIGINT) },
92              
93  
94              { "name", new Integer(Types.VARCHAR) },
95              
96  
97              { "vocabularyId", new Integer(Types.BIGINT) }
98          };
99      public static final String TABLE_SQL_CREATE = "create table TagsEntry (entryId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,parentEntryId LONG,name VARCHAR(75) null,vocabularyId LONG)";
100     public static final String TABLE_SQL_DROP = "drop table TagsEntry";
101     public static final String DATA_SOURCE = "liferayDataSource";
102     public static final String SESSION_FACTORY = "liferaySessionFactory";
103     public static final String TX_MANAGER = "liferayTransactionManager";
104     public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
105                 "value.object.entity.cache.enabled.com.liferay.portlet.tags.model.TagsEntry"),
106             true);
107     public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
108                 "value.object.finder.cache.enabled.com.liferay.portlet.tags.model.TagsEntry"),
109             true);
110 
111     public static TagsEntry toModel(TagsEntrySoap soapModel) {
112         TagsEntry model = new TagsEntryImpl();
113 
114         model.setEntryId(soapModel.getEntryId());
115         model.setGroupId(soapModel.getGroupId());
116         model.setCompanyId(soapModel.getCompanyId());
117         model.setUserId(soapModel.getUserId());
118         model.setUserName(soapModel.getUserName());
119         model.setCreateDate(soapModel.getCreateDate());
120         model.setModifiedDate(soapModel.getModifiedDate());
121         model.setParentEntryId(soapModel.getParentEntryId());
122         model.setName(soapModel.getName());
123         model.setVocabularyId(soapModel.getVocabularyId());
124 
125         return model;
126     }
127 
128     public static List<TagsEntry> toModels(TagsEntrySoap[] soapModels) {
129         List<TagsEntry> models = new ArrayList<TagsEntry>(soapModels.length);
130 
131         for (TagsEntrySoap soapModel : soapModels) {
132             models.add(toModel(soapModel));
133         }
134 
135         return models;
136     }
137 
138     public static final boolean FINDER_CACHE_ENABLED_TAGSASSETS_TAGSENTRIES = com.liferay.portlet.tags.model.impl.TagsAssetModelImpl.FINDER_CACHE_ENABLED_TAGSASSETS_TAGSENTRIES;
139     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
140                 "lock.expiration.time.com.liferay.portlet.tags.model.TagsEntry"));
141 
142     public TagsEntryModelImpl() {
143     }
144 
145     public long getPrimaryKey() {
146         return _entryId;
147     }
148 
149     public void setPrimaryKey(long pk) {
150         setEntryId(pk);
151     }
152 
153     public Serializable getPrimaryKeyObj() {
154         return new Long(_entryId);
155     }
156 
157     public long getEntryId() {
158         return _entryId;
159     }
160 
161     public void setEntryId(long entryId) {
162         _entryId = entryId;
163     }
164 
165     public long getGroupId() {
166         return _groupId;
167     }
168 
169     public void setGroupId(long groupId) {
170         _groupId = groupId;
171     }
172 
173     public long getCompanyId() {
174         return _companyId;
175     }
176 
177     public void setCompanyId(long companyId) {
178         _companyId = companyId;
179     }
180 
181     public long getUserId() {
182         return _userId;
183     }
184 
185     public void setUserId(long userId) {
186         _userId = userId;
187     }
188 
189     public String getUserUuid() throws SystemException {
190         return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
191     }
192 
193     public void setUserUuid(String userUuid) {
194         _userUuid = userUuid;
195     }
196 
197     public String getUserName() {
198         return GetterUtil.getString(_userName);
199     }
200 
201     public void setUserName(String userName) {
202         _userName = userName;
203     }
204 
205     public Date getCreateDate() {
206         return _createDate;
207     }
208 
209     public void setCreateDate(Date createDate) {
210         _createDate = createDate;
211     }
212 
213     public Date getModifiedDate() {
214         return _modifiedDate;
215     }
216 
217     public void setModifiedDate(Date modifiedDate) {
218         _modifiedDate = modifiedDate;
219     }
220 
221     public long getParentEntryId() {
222         return _parentEntryId;
223     }
224 
225     public void setParentEntryId(long parentEntryId) {
226         _parentEntryId = parentEntryId;
227     }
228 
229     public String getName() {
230         return GetterUtil.getString(_name);
231     }
232 
233     public void setName(String name) {
234         _name = name;
235     }
236 
237     public long getVocabularyId() {
238         return _vocabularyId;
239     }
240 
241     public void setVocabularyId(long vocabularyId) {
242         _vocabularyId = vocabularyId;
243     }
244 
245     public TagsEntry toEscapedModel() {
246         if (isEscapedModel()) {
247             return (TagsEntry)this;
248         }
249         else {
250             TagsEntry model = new TagsEntryImpl();
251 
252             model.setNew(isNew());
253             model.setEscapedModel(true);
254 
255             model.setEntryId(getEntryId());
256             model.setGroupId(getGroupId());
257             model.setCompanyId(getCompanyId());
258             model.setUserId(getUserId());
259             model.setUserName(HtmlUtil.escape(getUserName()));
260             model.setCreateDate(getCreateDate());
261             model.setModifiedDate(getModifiedDate());
262             model.setParentEntryId(getParentEntryId());
263             model.setName(HtmlUtil.escape(getName()));
264             model.setVocabularyId(getVocabularyId());
265 
266             model = (TagsEntry)Proxy.newProxyInstance(TagsEntry.class.getClassLoader(),
267                     new Class[] { TagsEntry.class },
268                     new ReadOnlyBeanHandler(model));
269 
270             return model;
271         }
272     }
273 
274     public ExpandoBridge getExpandoBridge() {
275         if (_expandoBridge == null) {
276             _expandoBridge = new ExpandoBridgeImpl(TagsEntry.class.getName(),
277                     getPrimaryKey());
278         }
279 
280         return _expandoBridge;
281     }
282 
283     public Object clone() {
284         TagsEntryImpl clone = new TagsEntryImpl();
285 
286         clone.setEntryId(getEntryId());
287         clone.setGroupId(getGroupId());
288         clone.setCompanyId(getCompanyId());
289         clone.setUserId(getUserId());
290         clone.setUserName(getUserName());
291         clone.setCreateDate(getCreateDate());
292         clone.setModifiedDate(getModifiedDate());
293         clone.setParentEntryId(getParentEntryId());
294         clone.setName(getName());
295         clone.setVocabularyId(getVocabularyId());
296 
297         return clone;
298     }
299 
300     public int compareTo(TagsEntry tagsEntry) {
301         int value = 0;
302 
303         value = getName().compareTo(tagsEntry.getName());
304 
305         if (value != 0) {
306             return value;
307         }
308 
309         return 0;
310     }
311 
312     public boolean equals(Object obj) {
313         if (obj == null) {
314             return false;
315         }
316 
317         TagsEntry tagsEntry = null;
318 
319         try {
320             tagsEntry = (TagsEntry)obj;
321         }
322         catch (ClassCastException cce) {
323             return false;
324         }
325 
326         long pk = tagsEntry.getPrimaryKey();
327 
328         if (getPrimaryKey() == pk) {
329             return true;
330         }
331         else {
332             return false;
333         }
334     }
335 
336     public int hashCode() {
337         return (int)getPrimaryKey();
338     }
339 
340     public String toString() {
341         StringBuilder sb = new StringBuilder();
342 
343         sb.append("{entryId=");
344         sb.append(getEntryId());
345         sb.append(", groupId=");
346         sb.append(getGroupId());
347         sb.append(", companyId=");
348         sb.append(getCompanyId());
349         sb.append(", userId=");
350         sb.append(getUserId());
351         sb.append(", userName=");
352         sb.append(getUserName());
353         sb.append(", createDate=");
354         sb.append(getCreateDate());
355         sb.append(", modifiedDate=");
356         sb.append(getModifiedDate());
357         sb.append(", parentEntryId=");
358         sb.append(getParentEntryId());
359         sb.append(", name=");
360         sb.append(getName());
361         sb.append(", vocabularyId=");
362         sb.append(getVocabularyId());
363         sb.append("}");
364 
365         return sb.toString();
366     }
367 
368     public String toXmlString() {
369         StringBuilder sb = new StringBuilder();
370 
371         sb.append("<model><model-name>");
372         sb.append("com.liferay.portlet.tags.model.TagsEntry");
373         sb.append("</model-name>");
374 
375         sb.append(
376             "<column><column-name>entryId</column-name><column-value><![CDATA[");
377         sb.append(getEntryId());
378         sb.append("]]></column-value></column>");
379         sb.append(
380             "<column><column-name>groupId</column-name><column-value><![CDATA[");
381         sb.append(getGroupId());
382         sb.append("]]></column-value></column>");
383         sb.append(
384             "<column><column-name>companyId</column-name><column-value><![CDATA[");
385         sb.append(getCompanyId());
386         sb.append("]]></column-value></column>");
387         sb.append(
388             "<column><column-name>userId</column-name><column-value><![CDATA[");
389         sb.append(getUserId());
390         sb.append("]]></column-value></column>");
391         sb.append(
392             "<column><column-name>userName</column-name><column-value><![CDATA[");
393         sb.append(getUserName());
394         sb.append("]]></column-value></column>");
395         sb.append(
396             "<column><column-name>createDate</column-name><column-value><![CDATA[");
397         sb.append(getCreateDate());
398         sb.append("]]></column-value></column>");
399         sb.append(
400             "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
401         sb.append(getModifiedDate());
402         sb.append("]]></column-value></column>");
403         sb.append(
404             "<column><column-name>parentEntryId</column-name><column-value><![CDATA[");
405         sb.append(getParentEntryId());
406         sb.append("]]></column-value></column>");
407         sb.append(
408             "<column><column-name>name</column-name><column-value><![CDATA[");
409         sb.append(getName());
410         sb.append("]]></column-value></column>");
411         sb.append(
412             "<column><column-name>vocabularyId</column-name><column-value><![CDATA[");
413         sb.append(getVocabularyId());
414         sb.append("]]></column-value></column>");
415 
416         sb.append("</model>");
417 
418         return sb.toString();
419     }
420 
421     private long _entryId;
422     private long _groupId;
423     private long _companyId;
424     private long _userId;
425     private String _userUuid;
426     private String _userName;
427     private Date _createDate;
428     private Date _modifiedDate;
429     private long _parentEntryId;
430     private String _name;
431     private long _vocabularyId;
432     private transient ExpandoBridge _expandoBridge;
433 }