1   /**
2    * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions 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.kernel.bean.ReadOnlyBeanHandler;
26  import com.liferay.portal.kernel.util.GetterUtil;
27  import com.liferay.portal.model.impl.BaseModelImpl;
28  import com.liferay.portal.util.PropsUtil;
29  
30  import com.liferay.portlet.tags.model.TagsEntry;
31  
32  import com.liferay.util.Html;
33  
34  import java.io.Serializable;
35  
36  import java.lang.reflect.Proxy;
37  
38  import java.sql.Types;
39  
40  import java.util.Date;
41  
42  /**
43   * <a href="TagsEntryModelImpl.java.html"><b><i>View Source</i></b></a>
44   *
45   * <p>
46   * ServiceBuilder generated this class. Modifications in this class will be
47   * overwritten the next time is generated.
48   * </p>
49   *
50   * <p>
51   * This class is a model that represents the <code>TagsEntry</code> table
52   * in the database.
53   * </p>
54   *
55   * @author Brian Wing Shun Chan
56   *
57   * @see com.liferay.portlet.tags.service.model.TagsEntry
58   * @see com.liferay.portlet.tags.service.model.TagsEntryModel
59   * @see com.liferay.portlet.tags.service.model.impl.TagsEntryImpl
60   *
61   */
62  public class TagsEntryModelImpl extends BaseModelImpl {
63      public static final String TABLE_NAME = "TagsEntry";
64      public static final Object[][] TABLE_COLUMNS = {
65              { "entryId", new Integer(Types.BIGINT) },
66              
67  
68              { "companyId", new Integer(Types.BIGINT) },
69              
70  
71              { "userId", new Integer(Types.BIGINT) },
72              
73  
74              { "userName", new Integer(Types.VARCHAR) },
75              
76  
77              { "createDate", new Integer(Types.TIMESTAMP) },
78              
79  
80              { "modifiedDate", new Integer(Types.TIMESTAMP) },
81              
82  
83              { "name", new Integer(Types.VARCHAR) }
84          };
85      public static final String TABLE_SQL_CREATE = "create table TagsEntry (entryId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,name VARCHAR(75) null)";
86      public static final String TABLE_SQL_DROP = "drop table TagsEntry";
87      public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
88                  "value.object.finder.cache.enabled.com.liferay.portlet.tags.model.TagsEntry"),
89              true);
90      public static final boolean CACHE_ENABLED_TAGSASSETS_TAGSENTRIES = com.liferay.portlet.tags.model.impl.TagsAssetModelImpl.CACHE_ENABLED_TAGSASSETS_TAGSENTRIES;
91      public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
92                  "lock.expiration.time.com.liferay.portlet.tags.model.TagsEntry"));
93  
94      public TagsEntryModelImpl() {
95      }
96  
97      public long getPrimaryKey() {
98          return _entryId;
99      }
100 
101     public void setPrimaryKey(long pk) {
102         setEntryId(pk);
103     }
104 
105     public Serializable getPrimaryKeyObj() {
106         return new Long(_entryId);
107     }
108 
109     public long getEntryId() {
110         return _entryId;
111     }
112 
113     public void setEntryId(long entryId) {
114         if (entryId != _entryId) {
115             _entryId = entryId;
116         }
117     }
118 
119     public long getCompanyId() {
120         return _companyId;
121     }
122 
123     public void setCompanyId(long companyId) {
124         if (companyId != _companyId) {
125             _companyId = companyId;
126         }
127     }
128 
129     public long getUserId() {
130         return _userId;
131     }
132 
133     public void setUserId(long userId) {
134         if (userId != _userId) {
135             _userId = userId;
136         }
137     }
138 
139     public String getUserName() {
140         return GetterUtil.getString(_userName);
141     }
142 
143     public void setUserName(String userName) {
144         if (((userName == null) && (_userName != null)) ||
145                 ((userName != null) && (_userName == null)) ||
146                 ((userName != null) && (_userName != null) &&
147                 !userName.equals(_userName))) {
148             _userName = userName;
149         }
150     }
151 
152     public Date getCreateDate() {
153         return _createDate;
154     }
155 
156     public void setCreateDate(Date createDate) {
157         if (((createDate == null) && (_createDate != null)) ||
158                 ((createDate != null) && (_createDate == null)) ||
159                 ((createDate != null) && (_createDate != null) &&
160                 !createDate.equals(_createDate))) {
161             _createDate = createDate;
162         }
163     }
164 
165     public Date getModifiedDate() {
166         return _modifiedDate;
167     }
168 
169     public void setModifiedDate(Date modifiedDate) {
170         if (((modifiedDate == null) && (_modifiedDate != null)) ||
171                 ((modifiedDate != null) && (_modifiedDate == null)) ||
172                 ((modifiedDate != null) && (_modifiedDate != null) &&
173                 !modifiedDate.equals(_modifiedDate))) {
174             _modifiedDate = modifiedDate;
175         }
176     }
177 
178     public String getName() {
179         return GetterUtil.getString(_name);
180     }
181 
182     public void setName(String name) {
183         if (((name == null) && (_name != null)) ||
184                 ((name != null) && (_name == null)) ||
185                 ((name != null) && (_name != null) && !name.equals(_name))) {
186             _name = name;
187         }
188     }
189 
190     public TagsEntry toEscapedModel() {
191         if (isEscapedModel()) {
192             return (TagsEntry)this;
193         }
194         else {
195             TagsEntry model = new TagsEntryImpl();
196 
197             model.setEscapedModel(true);
198 
199             model.setEntryId(getEntryId());
200             model.setCompanyId(getCompanyId());
201             model.setUserId(getUserId());
202             model.setUserName(Html.escape(getUserName()));
203             model.setCreateDate(getCreateDate());
204             model.setModifiedDate(getModifiedDate());
205             model.setName(Html.escape(getName()));
206 
207             model = (TagsEntry)Proxy.newProxyInstance(TagsEntry.class.getClassLoader(),
208                     new Class[] { TagsEntry.class },
209                     new ReadOnlyBeanHandler(model));
210 
211             return model;
212         }
213     }
214 
215     public Object clone() {
216         TagsEntryImpl clone = new TagsEntryImpl();
217 
218         clone.setEntryId(getEntryId());
219         clone.setCompanyId(getCompanyId());
220         clone.setUserId(getUserId());
221         clone.setUserName(getUserName());
222         clone.setCreateDate(getCreateDate());
223         clone.setModifiedDate(getModifiedDate());
224         clone.setName(getName());
225 
226         return clone;
227     }
228 
229     public int compareTo(Object obj) {
230         if (obj == null) {
231             return -1;
232         }
233 
234         TagsEntryImpl tagsEntry = (TagsEntryImpl)obj;
235 
236         int value = 0;
237 
238         value = getName().compareTo(tagsEntry.getName());
239 
240         if (value != 0) {
241             return value;
242         }
243 
244         return 0;
245     }
246 
247     public boolean equals(Object obj) {
248         if (obj == null) {
249             return false;
250         }
251 
252         TagsEntryImpl tagsEntry = null;
253 
254         try {
255             tagsEntry = (TagsEntryImpl)obj;
256         }
257         catch (ClassCastException cce) {
258             return false;
259         }
260 
261         long pk = tagsEntry.getPrimaryKey();
262 
263         if (getPrimaryKey() == pk) {
264             return true;
265         }
266         else {
267             return false;
268         }
269     }
270 
271     public int hashCode() {
272         return (int)getPrimaryKey();
273     }
274 
275     private long _entryId;
276     private long _companyId;
277     private long _userId;
278     private String _userName;
279     private Date _createDate;
280     private Date _modifiedDate;
281     private String _name;
282 }