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.kernel.util.HtmlUtil;
28  import com.liferay.portal.model.impl.BaseModelImpl;
29  import com.liferay.portal.util.PortalUtil;
30  
31  import com.liferay.portlet.tags.model.TagsAsset;
32  import com.liferay.portlet.tags.model.TagsAssetSoap;
33  
34  import java.io.Serializable;
35  
36  import java.lang.reflect.Proxy;
37  
38  import java.sql.Types;
39  
40  import java.util.ArrayList;
41  import java.util.Date;
42  import java.util.List;
43  
44  /**
45   * <a href="TagsAssetModelImpl.java.html"><b><i>View Source</i></b></a>
46   *
47   * <p>
48   * ServiceBuilder generated this class. Modifications in this class will be
49   * overwritten the next time is generated.
50   * </p>
51   *
52   * <p>
53   * This class is a model that represents the <code>TagsAsset</code> table
54   * in the database.
55   * </p>
56   *
57   * @author Brian Wing Shun Chan
58   *
59   * @see com.liferay.portlet.tags.service.model.TagsAsset
60   * @see com.liferay.portlet.tags.service.model.TagsAssetModel
61   * @see com.liferay.portlet.tags.service.model.impl.TagsAssetImpl
62   *
63   */
64  public class TagsAssetModelImpl extends BaseModelImpl {
65      public static final String TABLE_NAME = "TagsAsset";
66      public static final Object[][] TABLE_COLUMNS = {
67              { "assetId", new Integer(Types.BIGINT) },
68              
69  
70              { "groupId", new Integer(Types.BIGINT) },
71              
72  
73              { "companyId", new Integer(Types.BIGINT) },
74              
75  
76              { "userId", new Integer(Types.BIGINT) },
77              
78  
79              { "userName", new Integer(Types.VARCHAR) },
80              
81  
82              { "createDate", new Integer(Types.TIMESTAMP) },
83              
84  
85              { "modifiedDate", new Integer(Types.TIMESTAMP) },
86              
87  
88              { "classNameId", new Integer(Types.BIGINT) },
89              
90  
91              { "classPK", new Integer(Types.BIGINT) },
92              
93  
94              { "startDate", new Integer(Types.TIMESTAMP) },
95              
96  
97              { "endDate", new Integer(Types.TIMESTAMP) },
98              
99  
100             { "publishDate", new Integer(Types.TIMESTAMP) },
101             
102 
103             { "expirationDate", new Integer(Types.TIMESTAMP) },
104             
105 
106             { "mimeType", new Integer(Types.VARCHAR) },
107             
108 
109             { "title", new Integer(Types.VARCHAR) },
110             
111 
112             { "description", new Integer(Types.VARCHAR) },
113             
114 
115             { "summary", new Integer(Types.VARCHAR) },
116             
117 
118             { "url", new Integer(Types.VARCHAR) },
119             
120 
121             { "height", new Integer(Types.INTEGER) },
122             
123 
124             { "width", new Integer(Types.INTEGER) },
125             
126 
127             { "priority", new Integer(Types.DOUBLE) },
128             
129 
130             { "viewCount", new Integer(Types.INTEGER) }
131         };
132     public static final String TABLE_SQL_CREATE = "create table TagsAsset (assetId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,classNameId LONG,classPK LONG,startDate DATE null,endDate DATE null,publishDate DATE null,expirationDate DATE null,mimeType VARCHAR(75) null,title VARCHAR(300) null,description STRING null,summary STRING null,url STRING null,height INTEGER,width INTEGER,priority DOUBLE,viewCount INTEGER)";
133     public static final String TABLE_SQL_DROP = "drop table TagsAsset";
134     public static final String DATA_SOURCE = "liferayDataSource";
135     public static final String SESSION_FACTORY = "liferaySessionFactory";
136     public static final String TX_MANAGER = "liferayTransactionManager";
137     public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
138                 "value.object.finder.cache.enabled.com.liferay.portlet.tags.model.TagsAsset"),
139             true);
140 
141     public static TagsAsset toModel(TagsAssetSoap soapModel) {
142         TagsAsset model = new TagsAssetImpl();
143 
144         model.setAssetId(soapModel.getAssetId());
145         model.setGroupId(soapModel.getGroupId());
146         model.setCompanyId(soapModel.getCompanyId());
147         model.setUserId(soapModel.getUserId());
148         model.setUserName(soapModel.getUserName());
149         model.setCreateDate(soapModel.getCreateDate());
150         model.setModifiedDate(soapModel.getModifiedDate());
151         model.setClassNameId(soapModel.getClassNameId());
152         model.setClassPK(soapModel.getClassPK());
153         model.setStartDate(soapModel.getStartDate());
154         model.setEndDate(soapModel.getEndDate());
155         model.setPublishDate(soapModel.getPublishDate());
156         model.setExpirationDate(soapModel.getExpirationDate());
157         model.setMimeType(soapModel.getMimeType());
158         model.setTitle(soapModel.getTitle());
159         model.setDescription(soapModel.getDescription());
160         model.setSummary(soapModel.getSummary());
161         model.setUrl(soapModel.getUrl());
162         model.setHeight(soapModel.getHeight());
163         model.setWidth(soapModel.getWidth());
164         model.setPriority(soapModel.getPriority());
165         model.setViewCount(soapModel.getViewCount());
166 
167         return model;
168     }
169 
170     public static List<TagsAsset> toModels(TagsAssetSoap[] soapModels) {
171         List<TagsAsset> models = new ArrayList<TagsAsset>(soapModels.length);
172 
173         for (TagsAssetSoap soapModel : soapModels) {
174             models.add(toModel(soapModel));
175         }
176 
177         return models;
178     }
179 
180     public static final boolean CACHE_ENABLED_TAGSASSETS_TAGSENTRIES = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
181                 "value.object.finder.cache.enabled.TagsAssets_TagsEntries"),
182             true);
183     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
184                 "lock.expiration.time.com.liferay.portlet.tags.model.TagsAsset"));
185 
186     public TagsAssetModelImpl() {
187     }
188 
189     public long getPrimaryKey() {
190         return _assetId;
191     }
192 
193     public void setPrimaryKey(long pk) {
194         setAssetId(pk);
195     }
196 
197     public Serializable getPrimaryKeyObj() {
198         return new Long(_assetId);
199     }
200 
201     public long getAssetId() {
202         return _assetId;
203     }
204 
205     public void setAssetId(long assetId) {
206         if (assetId != _assetId) {
207             _assetId = assetId;
208         }
209     }
210 
211     public long getGroupId() {
212         return _groupId;
213     }
214 
215     public void setGroupId(long groupId) {
216         if (groupId != _groupId) {
217             _groupId = groupId;
218         }
219     }
220 
221     public long getCompanyId() {
222         return _companyId;
223     }
224 
225     public void setCompanyId(long companyId) {
226         if (companyId != _companyId) {
227             _companyId = companyId;
228         }
229     }
230 
231     public long getUserId() {
232         return _userId;
233     }
234 
235     public void setUserId(long userId) {
236         if (userId != _userId) {
237             _userId = userId;
238         }
239     }
240 
241     public String getUserName() {
242         return GetterUtil.getString(_userName);
243     }
244 
245     public void setUserName(String userName) {
246         if (((userName == null) && (_userName != null)) ||
247                 ((userName != null) && (_userName == null)) ||
248                 ((userName != null) && (_userName != null) &&
249                 !userName.equals(_userName))) {
250             _userName = userName;
251         }
252     }
253 
254     public Date getCreateDate() {
255         return _createDate;
256     }
257 
258     public void setCreateDate(Date createDate) {
259         if (((createDate == null) && (_createDate != null)) ||
260                 ((createDate != null) && (_createDate == null)) ||
261                 ((createDate != null) && (_createDate != null) &&
262                 !createDate.equals(_createDate))) {
263             _createDate = createDate;
264         }
265     }
266 
267     public Date getModifiedDate() {
268         return _modifiedDate;
269     }
270 
271     public void setModifiedDate(Date modifiedDate) {
272         if (((modifiedDate == null) && (_modifiedDate != null)) ||
273                 ((modifiedDate != null) && (_modifiedDate == null)) ||
274                 ((modifiedDate != null) && (_modifiedDate != null) &&
275                 !modifiedDate.equals(_modifiedDate))) {
276             _modifiedDate = modifiedDate;
277         }
278     }
279 
280     public String getClassName() {
281         return PortalUtil.getClassName(getClassNameId());
282     }
283 
284     public long getClassNameId() {
285         return _classNameId;
286     }
287 
288     public void setClassNameId(long classNameId) {
289         if (classNameId != _classNameId) {
290             _classNameId = classNameId;
291         }
292     }
293 
294     public long getClassPK() {
295         return _classPK;
296     }
297 
298     public void setClassPK(long classPK) {
299         if (classPK != _classPK) {
300             _classPK = classPK;
301         }
302     }
303 
304     public Date getStartDate() {
305         return _startDate;
306     }
307 
308     public void setStartDate(Date startDate) {
309         if (((startDate == null) && (_startDate != null)) ||
310                 ((startDate != null) && (_startDate == null)) ||
311                 ((startDate != null) && (_startDate != null) &&
312                 !startDate.equals(_startDate))) {
313             _startDate = startDate;
314         }
315     }
316 
317     public Date getEndDate() {
318         return _endDate;
319     }
320 
321     public void setEndDate(Date endDate) {
322         if (((endDate == null) && (_endDate != null)) ||
323                 ((endDate != null) && (_endDate == null)) ||
324                 ((endDate != null) && (_endDate != null) &&
325                 !endDate.equals(_endDate))) {
326             _endDate = endDate;
327         }
328     }
329 
330     public Date getPublishDate() {
331         return _publishDate;
332     }
333 
334     public void setPublishDate(Date publishDate) {
335         if (((publishDate == null) && (_publishDate != null)) ||
336                 ((publishDate != null) && (_publishDate == null)) ||
337                 ((publishDate != null) && (_publishDate != null) &&
338                 !publishDate.equals(_publishDate))) {
339             _publishDate = publishDate;
340         }
341     }
342 
343     public Date getExpirationDate() {
344         return _expirationDate;
345     }
346 
347     public void setExpirationDate(Date expirationDate) {
348         if (((expirationDate == null) && (_expirationDate != null)) ||
349                 ((expirationDate != null) && (_expirationDate == null)) ||
350                 ((expirationDate != null) && (_expirationDate != null) &&
351                 !expirationDate.equals(_expirationDate))) {
352             _expirationDate = expirationDate;
353         }
354     }
355 
356     public String getMimeType() {
357         return GetterUtil.getString(_mimeType);
358     }
359 
360     public void setMimeType(String mimeType) {
361         if (((mimeType == null) && (_mimeType != null)) ||
362                 ((mimeType != null) && (_mimeType == null)) ||
363                 ((mimeType != null) && (_mimeType != null) &&
364                 !mimeType.equals(_mimeType))) {
365             _mimeType = mimeType;
366         }
367     }
368 
369     public String getTitle() {
370         return GetterUtil.getString(_title);
371     }
372 
373     public void setTitle(String title) {
374         if (((title == null) && (_title != null)) ||
375                 ((title != null) && (_title == null)) ||
376                 ((title != null) && (_title != null) && !title.equals(_title))) {
377             _title = title;
378         }
379     }
380 
381     public String getDescription() {
382         return GetterUtil.getString(_description);
383     }
384 
385     public void setDescription(String description) {
386         if (((description == null) && (_description != null)) ||
387                 ((description != null) && (_description == null)) ||
388                 ((description != null) && (_description != null) &&
389                 !description.equals(_description))) {
390             _description = description;
391         }
392     }
393 
394     public String getSummary() {
395         return GetterUtil.getString(_summary);
396     }
397 
398     public void setSummary(String summary) {
399         if (((summary == null) && (_summary != null)) ||
400                 ((summary != null) && (_summary == null)) ||
401                 ((summary != null) && (_summary != null) &&
402                 !summary.equals(_summary))) {
403             _summary = summary;
404         }
405     }
406 
407     public String getUrl() {
408         return GetterUtil.getString(_url);
409     }
410 
411     public void setUrl(String url) {
412         if (((url == null) && (_url != null)) ||
413                 ((url != null) && (_url == null)) ||
414                 ((url != null) && (_url != null) && !url.equals(_url))) {
415             _url = url;
416         }
417     }
418 
419     public int getHeight() {
420         return _height;
421     }
422 
423     public void setHeight(int height) {
424         if (height != _height) {
425             _height = height;
426         }
427     }
428 
429     public int getWidth() {
430         return _width;
431     }
432 
433     public void setWidth(int width) {
434         if (width != _width) {
435             _width = width;
436         }
437     }
438 
439     public double getPriority() {
440         return _priority;
441     }
442 
443     public void setPriority(double priority) {
444         if (priority != _priority) {
445             _priority = priority;
446         }
447     }
448 
449     public int getViewCount() {
450         return _viewCount;
451     }
452 
453     public void setViewCount(int viewCount) {
454         if (viewCount != _viewCount) {
455             _viewCount = viewCount;
456         }
457     }
458 
459     public TagsAsset toEscapedModel() {
460         if (isEscapedModel()) {
461             return (TagsAsset)this;
462         }
463         else {
464             TagsAsset model = new TagsAssetImpl();
465 
466             model.setEscapedModel(true);
467 
468             model.setAssetId(getAssetId());
469             model.setGroupId(getGroupId());
470             model.setCompanyId(getCompanyId());
471             model.setUserId(getUserId());
472             model.setUserName(HtmlUtil.escape(getUserName()));
473             model.setCreateDate(getCreateDate());
474             model.setModifiedDate(getModifiedDate());
475             model.setClassNameId(getClassNameId());
476             model.setClassPK(getClassPK());
477             model.setStartDate(getStartDate());
478             model.setEndDate(getEndDate());
479             model.setPublishDate(getPublishDate());
480             model.setExpirationDate(getExpirationDate());
481             model.setMimeType(HtmlUtil.escape(getMimeType()));
482             model.setTitle(HtmlUtil.escape(getTitle()));
483             model.setDescription(HtmlUtil.escape(getDescription()));
484             model.setSummary(HtmlUtil.escape(getSummary()));
485             model.setUrl(HtmlUtil.escape(getUrl()));
486             model.setHeight(getHeight());
487             model.setWidth(getWidth());
488             model.setPriority(getPriority());
489             model.setViewCount(getViewCount());
490 
491             model = (TagsAsset)Proxy.newProxyInstance(TagsAsset.class.getClassLoader(),
492                     new Class[] { TagsAsset.class },
493                     new ReadOnlyBeanHandler(model));
494 
495             return model;
496         }
497     }
498 
499     public Object clone() {
500         TagsAssetImpl clone = new TagsAssetImpl();
501 
502         clone.setAssetId(getAssetId());
503         clone.setGroupId(getGroupId());
504         clone.setCompanyId(getCompanyId());
505         clone.setUserId(getUserId());
506         clone.setUserName(getUserName());
507         clone.setCreateDate(getCreateDate());
508         clone.setModifiedDate(getModifiedDate());
509         clone.setClassNameId(getClassNameId());
510         clone.setClassPK(getClassPK());
511         clone.setStartDate(getStartDate());
512         clone.setEndDate(getEndDate());
513         clone.setPublishDate(getPublishDate());
514         clone.setExpirationDate(getExpirationDate());
515         clone.setMimeType(getMimeType());
516         clone.setTitle(getTitle());
517         clone.setDescription(getDescription());
518         clone.setSummary(getSummary());
519         clone.setUrl(getUrl());
520         clone.setHeight(getHeight());
521         clone.setWidth(getWidth());
522         clone.setPriority(getPriority());
523         clone.setViewCount(getViewCount());
524 
525         return clone;
526     }
527 
528     public int compareTo(Object obj) {
529         if (obj == null) {
530             return -1;
531         }
532 
533         TagsAssetImpl tagsAsset = (TagsAssetImpl)obj;
534 
535         long pk = tagsAsset.getPrimaryKey();
536 
537         if (getPrimaryKey() < pk) {
538             return -1;
539         }
540         else if (getPrimaryKey() > pk) {
541             return 1;
542         }
543         else {
544             return 0;
545         }
546     }
547 
548     public boolean equals(Object obj) {
549         if (obj == null) {
550             return false;
551         }
552 
553         TagsAssetImpl tagsAsset = null;
554 
555         try {
556             tagsAsset = (TagsAssetImpl)obj;
557         }
558         catch (ClassCastException cce) {
559             return false;
560         }
561 
562         long pk = tagsAsset.getPrimaryKey();
563 
564         if (getPrimaryKey() == pk) {
565             return true;
566         }
567         else {
568             return false;
569         }
570     }
571 
572     public int hashCode() {
573         return (int)getPrimaryKey();
574     }
575 
576     private long _assetId;
577     private long _groupId;
578     private long _companyId;
579     private long _userId;
580     private String _userName;
581     private Date _createDate;
582     private Date _modifiedDate;
583     private long _classNameId;
584     private long _classPK;
585     private Date _startDate;
586     private Date _endDate;
587     private Date _publishDate;
588     private Date _expirationDate;
589     private String _mimeType;
590     private String _title;
591     private String _description;
592     private String _summary;
593     private String _url;
594     private int _height;
595     private int _width;
596     private double _priority;
597     private int _viewCount;
598 }