1   /**
2    * Copyright (c) 2000-2009 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   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portlet.tags.model.impl;
21  
22  import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
23  import com.liferay.portal.kernel.util.GetterUtil;
24  import com.liferay.portal.kernel.util.HtmlUtil;
25  import com.liferay.portal.model.impl.BaseModelImpl;
26  
27  import com.liferay.portlet.expando.model.ExpandoBridge;
28  import com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl;
29  import com.liferay.portlet.tags.model.TagsEntry;
30  import com.liferay.portlet.tags.model.TagsEntrySoap;
31  
32  import java.io.Serializable;
33  
34  import java.lang.reflect.Proxy;
35  
36  import java.sql.Types;
37  
38  import java.util.ArrayList;
39  import java.util.Date;
40  import java.util.List;
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.model.TagsEntry
58   * @see com.liferay.portlet.tags.model.TagsEntryModel
59   * @see com.liferay.portlet.tags.model.impl.TagsEntryImpl
60   *
61   */
62  public class TagsEntryModelImpl extends BaseModelImpl<TagsEntry> {
63      public static final String TABLE_NAME = "TagsEntry";
64      public static final Object[][] TABLE_COLUMNS = {
65              { "entryId", new Integer(Types.BIGINT) },
66              
67  
68              { "groupId", new Integer(Types.BIGINT) },
69              
70  
71              { "companyId", new Integer(Types.BIGINT) },
72              
73  
74              { "userId", new Integer(Types.BIGINT) },
75              
76  
77              { "userName", new Integer(Types.VARCHAR) },
78              
79  
80              { "createDate", new Integer(Types.TIMESTAMP) },
81              
82  
83              { "modifiedDate", new Integer(Types.TIMESTAMP) },
84              
85  
86              { "parentEntryId", new Integer(Types.BIGINT) },
87              
88  
89              { "name", new Integer(Types.VARCHAR) },
90              
91  
92              { "vocabularyId", new Integer(Types.BIGINT) }
93          };
94      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)";
95      public static final String TABLE_SQL_DROP = "drop table TagsEntry";
96      public static final String DATA_SOURCE = "liferayDataSource";
97      public static final String SESSION_FACTORY = "liferaySessionFactory";
98      public static final String TX_MANAGER = "liferayTransactionManager";
99      public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
100                 "value.object.entity.cache.enabled.com.liferay.portlet.tags.model.TagsEntry"),
101             true);
102     public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
103                 "value.object.finder.cache.enabled.com.liferay.portlet.tags.model.TagsEntry"),
104             true);
105 
106     public static TagsEntry toModel(TagsEntrySoap soapModel) {
107         TagsEntry model = new TagsEntryImpl();
108 
109         model.setEntryId(soapModel.getEntryId());
110         model.setGroupId(soapModel.getGroupId());
111         model.setCompanyId(soapModel.getCompanyId());
112         model.setUserId(soapModel.getUserId());
113         model.setUserName(soapModel.getUserName());
114         model.setCreateDate(soapModel.getCreateDate());
115         model.setModifiedDate(soapModel.getModifiedDate());
116         model.setParentEntryId(soapModel.getParentEntryId());
117         model.setName(soapModel.getName());
118         model.setVocabularyId(soapModel.getVocabularyId());
119 
120         return model;
121     }
122 
123     public static List<TagsEntry> toModels(TagsEntrySoap[] soapModels) {
124         List<TagsEntry> models = new ArrayList<TagsEntry>(soapModels.length);
125 
126         for (TagsEntrySoap soapModel : soapModels) {
127             models.add(toModel(soapModel));
128         }
129 
130         return models;
131     }
132 
133     public static final boolean FINDER_CACHE_ENABLED_TAGSASSETS_TAGSENTRIES = com.liferay.portlet.tags.model.impl.TagsAssetModelImpl.FINDER_CACHE_ENABLED_TAGSASSETS_TAGSENTRIES;
134     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
135                 "lock.expiration.time.com.liferay.portlet.tags.model.TagsEntry"));
136 
137     public TagsEntryModelImpl() {
138     }
139 
140     public long getPrimaryKey() {
141         return _entryId;
142     }
143 
144     public void setPrimaryKey(long pk) {
145         setEntryId(pk);
146     }
147 
148     public Serializable getPrimaryKeyObj() {
149         return new Long(_entryId);
150     }
151 
152     public long getEntryId() {
153         return _entryId;
154     }
155 
156     public void setEntryId(long entryId) {
157         _entryId = entryId;
158     }
159 
160     public long getGroupId() {
161         return _groupId;
162     }
163 
164     public void setGroupId(long groupId) {
165         _groupId = groupId;
166     }
167 
168     public long getCompanyId() {
169         return _companyId;
170     }
171 
172     public void setCompanyId(long companyId) {
173         _companyId = companyId;
174     }
175 
176     public long getUserId() {
177         return _userId;
178     }
179 
180     public void setUserId(long userId) {
181         _userId = userId;
182     }
183 
184     public String getUserName() {
185         return GetterUtil.getString(_userName);
186     }
187 
188     public void setUserName(String userName) {
189         _userName = userName;
190     }
191 
192     public Date getCreateDate() {
193         return _createDate;
194     }
195 
196     public void setCreateDate(Date createDate) {
197         _createDate = createDate;
198     }
199 
200     public Date getModifiedDate() {
201         return _modifiedDate;
202     }
203 
204     public void setModifiedDate(Date modifiedDate) {
205         _modifiedDate = modifiedDate;
206     }
207 
208     public long getParentEntryId() {
209         return _parentEntryId;
210     }
211 
212     public void setParentEntryId(long parentEntryId) {
213         _parentEntryId = parentEntryId;
214     }
215 
216     public String getName() {
217         return GetterUtil.getString(_name);
218     }
219 
220     public void setName(String name) {
221         _name = name;
222     }
223 
224     public long getVocabularyId() {
225         return _vocabularyId;
226     }
227 
228     public void setVocabularyId(long vocabularyId) {
229         _vocabularyId = vocabularyId;
230     }
231 
232     public TagsEntry toEscapedModel() {
233         if (isEscapedModel()) {
234             return (TagsEntry)this;
235         }
236         else {
237             TagsEntry model = new TagsEntryImpl();
238 
239             model.setNew(isNew());
240             model.setEscapedModel(true);
241 
242             model.setEntryId(getEntryId());
243             model.setGroupId(getGroupId());
244             model.setCompanyId(getCompanyId());
245             model.setUserId(getUserId());
246             model.setUserName(HtmlUtil.escape(getUserName()));
247             model.setCreateDate(getCreateDate());
248             model.setModifiedDate(getModifiedDate());
249             model.setParentEntryId(getParentEntryId());
250             model.setName(HtmlUtil.escape(getName()));
251             model.setVocabularyId(getVocabularyId());
252 
253             model = (TagsEntry)Proxy.newProxyInstance(TagsEntry.class.getClassLoader(),
254                     new Class[] { TagsEntry.class },
255                     new ReadOnlyBeanHandler(model));
256 
257             return model;
258         }
259     }
260 
261     public ExpandoBridge getExpandoBridge() {
262         if (_expandoBridge == null) {
263             _expandoBridge = new ExpandoBridgeImpl(TagsEntry.class.getName(),
264                     getPrimaryKey());
265         }
266 
267         return _expandoBridge;
268     }
269 
270     public Object clone() {
271         TagsEntryImpl clone = new TagsEntryImpl();
272 
273         clone.setEntryId(getEntryId());
274         clone.setGroupId(getGroupId());
275         clone.setCompanyId(getCompanyId());
276         clone.setUserId(getUserId());
277         clone.setUserName(getUserName());
278         clone.setCreateDate(getCreateDate());
279         clone.setModifiedDate(getModifiedDate());
280         clone.setParentEntryId(getParentEntryId());
281         clone.setName(getName());
282         clone.setVocabularyId(getVocabularyId());
283 
284         return clone;
285     }
286 
287     public int compareTo(TagsEntry tagsEntry) {
288         int value = 0;
289 
290         value = getName().compareTo(tagsEntry.getName());
291 
292         if (value != 0) {
293             return value;
294         }
295 
296         return 0;
297     }
298 
299     public boolean equals(Object obj) {
300         if (obj == null) {
301             return false;
302         }
303 
304         TagsEntry tagsEntry = null;
305 
306         try {
307             tagsEntry = (TagsEntry)obj;
308         }
309         catch (ClassCastException cce) {
310             return false;
311         }
312 
313         long pk = tagsEntry.getPrimaryKey();
314 
315         if (getPrimaryKey() == pk) {
316             return true;
317         }
318         else {
319             return false;
320         }
321     }
322 
323     public int hashCode() {
324         return (int)getPrimaryKey();
325     }
326 
327     public String toString() {
328         StringBuilder sb = new StringBuilder();
329 
330         sb.append("{entryId=");
331         sb.append(getEntryId());
332         sb.append(", groupId=");
333         sb.append(getGroupId());
334         sb.append(", companyId=");
335         sb.append(getCompanyId());
336         sb.append(", userId=");
337         sb.append(getUserId());
338         sb.append(", userName=");
339         sb.append(getUserName());
340         sb.append(", createDate=");
341         sb.append(getCreateDate());
342         sb.append(", modifiedDate=");
343         sb.append(getModifiedDate());
344         sb.append(", parentEntryId=");
345         sb.append(getParentEntryId());
346         sb.append(", name=");
347         sb.append(getName());
348         sb.append(", vocabularyId=");
349         sb.append(getVocabularyId());
350         sb.append("}");
351 
352         return sb.toString();
353     }
354 
355     public String toXmlString() {
356         StringBuilder sb = new StringBuilder();
357 
358         sb.append("<model><model-name>");
359         sb.append("com.liferay.portlet.tags.model.TagsEntry");
360         sb.append("</model-name>");
361 
362         sb.append(
363             "<column><column-name>entryId</column-name><column-value><![CDATA[");
364         sb.append(getEntryId());
365         sb.append("]]></column-value></column>");
366         sb.append(
367             "<column><column-name>groupId</column-name><column-value><![CDATA[");
368         sb.append(getGroupId());
369         sb.append("]]></column-value></column>");
370         sb.append(
371             "<column><column-name>companyId</column-name><column-value><![CDATA[");
372         sb.append(getCompanyId());
373         sb.append("]]></column-value></column>");
374         sb.append(
375             "<column><column-name>userId</column-name><column-value><![CDATA[");
376         sb.append(getUserId());
377         sb.append("]]></column-value></column>");
378         sb.append(
379             "<column><column-name>userName</column-name><column-value><![CDATA[");
380         sb.append(getUserName());
381         sb.append("]]></column-value></column>");
382         sb.append(
383             "<column><column-name>createDate</column-name><column-value><![CDATA[");
384         sb.append(getCreateDate());
385         sb.append("]]></column-value></column>");
386         sb.append(
387             "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
388         sb.append(getModifiedDate());
389         sb.append("]]></column-value></column>");
390         sb.append(
391             "<column><column-name>parentEntryId</column-name><column-value><![CDATA[");
392         sb.append(getParentEntryId());
393         sb.append("]]></column-value></column>");
394         sb.append(
395             "<column><column-name>name</column-name><column-value><![CDATA[");
396         sb.append(getName());
397         sb.append("]]></column-value></column>");
398         sb.append(
399             "<column><column-name>vocabularyId</column-name><column-value><![CDATA[");
400         sb.append(getVocabularyId());
401         sb.append("]]></column-value></column>");
402 
403         sb.append("</model>");
404 
405         return sb.toString();
406     }
407 
408     private long _entryId;
409     private long _groupId;
410     private long _companyId;
411     private long _userId;
412     private String _userName;
413     private Date _createDate;
414     private Date _modifiedDate;
415     private long _parentEntryId;
416     private String _name;
417     private long _vocabularyId;
418     private transient ExpandoBridge _expandoBridge;
419 }