1   /**
2    * Copyright (c) 2000-2007 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.util.GetterUtil;
26  import com.liferay.portal.model.impl.BaseModelImpl;
27  import com.liferay.portal.util.PropsUtil;
28  
29  import com.liferay.util.XSSUtil;
30  
31  import java.io.Serializable;
32  
33  import java.sql.Types;
34  
35  import java.util.Date;
36  
37  /**
38   * <a href="TagsAssetModelImpl.java.html"><b><i>View Source</i></b></a>
39   *
40   * <p>
41   * ServiceBuilder generated this class. Modifications in this class will be overwritten
42   * the next time is generated.
43   * </p>
44   *
45   * <p>
46   * This class is a model that represents the <code>TagsAsset</code> table in the
47   * database.
48   * </p>
49   *
50   * @author Brian Wing Shun Chan
51   *
52   * @see com.liferay.portlet.tags.service.model.TagsAsset
53   * @see com.liferay.portlet.tags.service.model.TagsAssetModel
54   * @see com.liferay.portlet.tags.service.model.impl.TagsAssetImpl
55   *
56   */
57  public class TagsAssetModelImpl extends BaseModelImpl {
58      public static String TABLE_NAME = "TagsAsset";
59      public static Object[][] TABLE_COLUMNS = {
60              { "assetId", new Integer(Types.BIGINT) },
61              { "companyId", new Integer(Types.BIGINT) },
62              { "userId", new Integer(Types.BIGINT) },
63              { "userName", new Integer(Types.VARCHAR) },
64              { "createDate", new Integer(Types.TIMESTAMP) },
65              { "modifiedDate", new Integer(Types.TIMESTAMP) },
66              { "classNameId", new Integer(Types.BIGINT) },
67              { "classPK", new Integer(Types.BIGINT) },
68              { "startDate", new Integer(Types.TIMESTAMP) },
69              { "endDate", new Integer(Types.TIMESTAMP) },
70              { "publishDate", new Integer(Types.TIMESTAMP) },
71              { "expirationDate", new Integer(Types.TIMESTAMP) },
72              { "mimeType", new Integer(Types.VARCHAR) },
73              { "title", new Integer(Types.VARCHAR) },
74              { "description", new Integer(Types.VARCHAR) },
75              { "summary", new Integer(Types.VARCHAR) },
76              { "url", new Integer(Types.VARCHAR) },
77              { "height", new Integer(Types.INTEGER) },
78              { "width", new Integer(Types.INTEGER) }
79          };
80      public static String TABLE_SQL_CREATE = "create table TagsAsset (assetId LONG not null primary key,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)";
81      public static String TABLE_SQL_DROP = "drop table TagsAsset";
82      public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
83                  "xss.allow.com.liferay.portlet.tags.model.TagsAsset"), XSS_ALLOW);
84      public static boolean XSS_ALLOW_USERNAME = GetterUtil.getBoolean(PropsUtil.get(
85                  "xss.allow.com.liferay.portlet.tags.model.TagsAsset.userName"),
86              XSS_ALLOW_BY_MODEL);
87      public static boolean XSS_ALLOW_MIMETYPE = GetterUtil.getBoolean(PropsUtil.get(
88                  "xss.allow.com.liferay.portlet.tags.model.TagsAsset.mimeType"),
89              XSS_ALLOW_BY_MODEL);
90      public static boolean XSS_ALLOW_TITLE = GetterUtil.getBoolean(PropsUtil.get(
91                  "xss.allow.com.liferay.portlet.tags.model.TagsAsset.title"),
92              XSS_ALLOW_BY_MODEL);
93      public static boolean XSS_ALLOW_DESCRIPTION = GetterUtil.getBoolean(PropsUtil.get(
94                  "xss.allow.com.liferay.portlet.tags.model.TagsAsset.description"),
95              XSS_ALLOW_BY_MODEL);
96      public static boolean XSS_ALLOW_SUMMARY = GetterUtil.getBoolean(PropsUtil.get(
97                  "xss.allow.com.liferay.portlet.tags.model.TagsAsset.summary"),
98              XSS_ALLOW_BY_MODEL);
99      public static boolean XSS_ALLOW_URL = GetterUtil.getBoolean(PropsUtil.get(
100                 "xss.allow.com.liferay.portlet.tags.model.TagsAsset.url"),
101             XSS_ALLOW_BY_MODEL);
102     public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
103                 "lock.expiration.time.com.liferay.portlet.tags.model.TagsAssetModel"));
104 
105     public TagsAssetModelImpl() {
106     }
107 
108     public long getPrimaryKey() {
109         return _assetId;
110     }
111 
112     public void setPrimaryKey(long pk) {
113         setAssetId(pk);
114     }
115 
116     public Serializable getPrimaryKeyObj() {
117         return new Long(_assetId);
118     }
119 
120     public long getAssetId() {
121         return _assetId;
122     }
123 
124     public void setAssetId(long assetId) {
125         if (assetId != _assetId) {
126             _assetId = assetId;
127         }
128     }
129 
130     public long getCompanyId() {
131         return _companyId;
132     }
133 
134     public void setCompanyId(long companyId) {
135         if (companyId != _companyId) {
136             _companyId = companyId;
137         }
138     }
139 
140     public long getUserId() {
141         return _userId;
142     }
143 
144     public void setUserId(long userId) {
145         if (userId != _userId) {
146             _userId = userId;
147         }
148     }
149 
150     public String getUserName() {
151         return GetterUtil.getString(_userName);
152     }
153 
154     public void setUserName(String userName) {
155         if (((userName == null) && (_userName != null)) ||
156                 ((userName != null) && (_userName == null)) ||
157                 ((userName != null) && (_userName != null) &&
158                 !userName.equals(_userName))) {
159             if (!XSS_ALLOW_USERNAME) {
160                 userName = XSSUtil.strip(userName);
161             }
162 
163             _userName = userName;
164         }
165     }
166 
167     public Date getCreateDate() {
168         return _createDate;
169     }
170 
171     public void setCreateDate(Date createDate) {
172         if (((createDate == null) && (_createDate != null)) ||
173                 ((createDate != null) && (_createDate == null)) ||
174                 ((createDate != null) && (_createDate != null) &&
175                 !createDate.equals(_createDate))) {
176             _createDate = createDate;
177         }
178     }
179 
180     public Date getModifiedDate() {
181         return _modifiedDate;
182     }
183 
184     public void setModifiedDate(Date modifiedDate) {
185         if (((modifiedDate == null) && (_modifiedDate != null)) ||
186                 ((modifiedDate != null) && (_modifiedDate == null)) ||
187                 ((modifiedDate != null) && (_modifiedDate != null) &&
188                 !modifiedDate.equals(_modifiedDate))) {
189             _modifiedDate = modifiedDate;
190         }
191     }
192 
193     public long getClassNameId() {
194         return _classNameId;
195     }
196 
197     public void setClassNameId(long classNameId) {
198         if (classNameId != _classNameId) {
199             _classNameId = classNameId;
200         }
201     }
202 
203     public long getClassPK() {
204         return _classPK;
205     }
206 
207     public void setClassPK(long classPK) {
208         if (classPK != _classPK) {
209             _classPK = classPK;
210         }
211     }
212 
213     public Date getStartDate() {
214         return _startDate;
215     }
216 
217     public void setStartDate(Date startDate) {
218         if (((startDate == null) && (_startDate != null)) ||
219                 ((startDate != null) && (_startDate == null)) ||
220                 ((startDate != null) && (_startDate != null) &&
221                 !startDate.equals(_startDate))) {
222             _startDate = startDate;
223         }
224     }
225 
226     public Date getEndDate() {
227         return _endDate;
228     }
229 
230     public void setEndDate(Date endDate) {
231         if (((endDate == null) && (_endDate != null)) ||
232                 ((endDate != null) && (_endDate == null)) ||
233                 ((endDate != null) && (_endDate != null) &&
234                 !endDate.equals(_endDate))) {
235             _endDate = endDate;
236         }
237     }
238 
239     public Date getPublishDate() {
240         return _publishDate;
241     }
242 
243     public void setPublishDate(Date publishDate) {
244         if (((publishDate == null) && (_publishDate != null)) ||
245                 ((publishDate != null) && (_publishDate == null)) ||
246                 ((publishDate != null) && (_publishDate != null) &&
247                 !publishDate.equals(_publishDate))) {
248             _publishDate = publishDate;
249         }
250     }
251 
252     public Date getExpirationDate() {
253         return _expirationDate;
254     }
255 
256     public void setExpirationDate(Date expirationDate) {
257         if (((expirationDate == null) && (_expirationDate != null)) ||
258                 ((expirationDate != null) && (_expirationDate == null)) ||
259                 ((expirationDate != null) && (_expirationDate != null) &&
260                 !expirationDate.equals(_expirationDate))) {
261             _expirationDate = expirationDate;
262         }
263     }
264 
265     public String getMimeType() {
266         return GetterUtil.getString(_mimeType);
267     }
268 
269     public void setMimeType(String mimeType) {
270         if (((mimeType == null) && (_mimeType != null)) ||
271                 ((mimeType != null) && (_mimeType == null)) ||
272                 ((mimeType != null) && (_mimeType != null) &&
273                 !mimeType.equals(_mimeType))) {
274             if (!XSS_ALLOW_MIMETYPE) {
275                 mimeType = XSSUtil.strip(mimeType);
276             }
277 
278             _mimeType = mimeType;
279         }
280     }
281 
282     public String getTitle() {
283         return GetterUtil.getString(_title);
284     }
285 
286     public void setTitle(String title) {
287         if (((title == null) && (_title != null)) ||
288                 ((title != null) && (_title == null)) ||
289                 ((title != null) && (_title != null) && !title.equals(_title))) {
290             if (!XSS_ALLOW_TITLE) {
291                 title = XSSUtil.strip(title);
292             }
293 
294             _title = title;
295         }
296     }
297 
298     public String getDescription() {
299         return GetterUtil.getString(_description);
300     }
301 
302     public void setDescription(String description) {
303         if (((description == null) && (_description != null)) ||
304                 ((description != null) && (_description == null)) ||
305                 ((description != null) && (_description != null) &&
306                 !description.equals(_description))) {
307             if (!XSS_ALLOW_DESCRIPTION) {
308                 description = XSSUtil.strip(description);
309             }
310 
311             _description = description;
312         }
313     }
314 
315     public String getSummary() {
316         return GetterUtil.getString(_summary);
317     }
318 
319     public void setSummary(String summary) {
320         if (((summary == null) && (_summary != null)) ||
321                 ((summary != null) && (_summary == null)) ||
322                 ((summary != null) && (_summary != null) &&
323                 !summary.equals(_summary))) {
324             if (!XSS_ALLOW_SUMMARY) {
325                 summary = XSSUtil.strip(summary);
326             }
327 
328             _summary = summary;
329         }
330     }
331 
332     public String getUrl() {
333         return GetterUtil.getString(_url);
334     }
335 
336     public void setUrl(String url) {
337         if (((url == null) && (_url != null)) ||
338                 ((url != null) && (_url == null)) ||
339                 ((url != null) && (_url != null) && !url.equals(_url))) {
340             if (!XSS_ALLOW_URL) {
341                 url = XSSUtil.strip(url);
342             }
343 
344             _url = url;
345         }
346     }
347 
348     public int getHeight() {
349         return _height;
350     }
351 
352     public void setHeight(int height) {
353         if (height != _height) {
354             _height = height;
355         }
356     }
357 
358     public int getWidth() {
359         return _width;
360     }
361 
362     public void setWidth(int width) {
363         if (width != _width) {
364             _width = width;
365         }
366     }
367 
368     public Object clone() {
369         TagsAssetImpl clone = new TagsAssetImpl();
370         clone.setAssetId(getAssetId());
371         clone.setCompanyId(getCompanyId());
372         clone.setUserId(getUserId());
373         clone.setUserName(getUserName());
374         clone.setCreateDate(getCreateDate());
375         clone.setModifiedDate(getModifiedDate());
376         clone.setClassNameId(getClassNameId());
377         clone.setClassPK(getClassPK());
378         clone.setStartDate(getStartDate());
379         clone.setEndDate(getEndDate());
380         clone.setPublishDate(getPublishDate());
381         clone.setExpirationDate(getExpirationDate());
382         clone.setMimeType(getMimeType());
383         clone.setTitle(getTitle());
384         clone.setDescription(getDescription());
385         clone.setSummary(getSummary());
386         clone.setUrl(getUrl());
387         clone.setHeight(getHeight());
388         clone.setWidth(getWidth());
389 
390         return clone;
391     }
392 
393     public int compareTo(Object obj) {
394         if (obj == null) {
395             return -1;
396         }
397 
398         TagsAssetImpl tagsAsset = (TagsAssetImpl)obj;
399         long pk = tagsAsset.getPrimaryKey();
400 
401         if (getPrimaryKey() < pk) {
402             return -1;
403         }
404         else if (getPrimaryKey() > pk) {
405             return 1;
406         }
407         else {
408             return 0;
409         }
410     }
411 
412     public boolean equals(Object obj) {
413         if (obj == null) {
414             return false;
415         }
416 
417         TagsAssetImpl tagsAsset = null;
418 
419         try {
420             tagsAsset = (TagsAssetImpl)obj;
421         }
422         catch (ClassCastException cce) {
423             return false;
424         }
425 
426         long pk = tagsAsset.getPrimaryKey();
427 
428         if (getPrimaryKey() == pk) {
429             return true;
430         }
431         else {
432             return false;
433         }
434     }
435 
436     public int hashCode() {
437         return (int)getPrimaryKey();
438     }
439 
440     private long _assetId;
441     private long _companyId;
442     private long _userId;
443     private String _userName;
444     private Date _createDate;
445     private Date _modifiedDate;
446     private long _classNameId;
447     private long _classPK;
448     private Date _startDate;
449     private Date _endDate;
450     private Date _publishDate;
451     private Date _expirationDate;
452     private String _mimeType;
453     private String _title;
454     private String _description;
455     private String _summary;
456     private String _url;
457     private int _height;
458     private int _width;
459 }