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