1
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.kernel.util.StringPool;
26 import com.liferay.portal.model.impl.BaseModelImpl;
27 import com.liferay.portal.util.PortalUtil;
28
29 import com.liferay.portlet.tags.model.TagsAsset;
30 import com.liferay.portlet.tags.model.TagsAssetSoap;
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
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 String DATA_SOURCE = "liferayDataSource";
133 public static final String SESSION_FACTORY = "liferaySessionFactory";
134 public static final String TX_MANAGER = "liferayTransactionManager";
135 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
136 "value.object.finder.cache.enabled.com.liferay.portlet.tags.model.TagsAsset"),
137 true);
138
139 public static TagsAsset toModel(TagsAssetSoap soapModel) {
140 TagsAsset model = new TagsAssetImpl();
141
142 model.setAssetId(soapModel.getAssetId());
143 model.setGroupId(soapModel.getGroupId());
144 model.setCompanyId(soapModel.getCompanyId());
145 model.setUserId(soapModel.getUserId());
146 model.setUserName(soapModel.getUserName());
147 model.setCreateDate(soapModel.getCreateDate());
148 model.setModifiedDate(soapModel.getModifiedDate());
149 model.setClassNameId(soapModel.getClassNameId());
150 model.setClassPK(soapModel.getClassPK());
151 model.setStartDate(soapModel.getStartDate());
152 model.setEndDate(soapModel.getEndDate());
153 model.setPublishDate(soapModel.getPublishDate());
154 model.setExpirationDate(soapModel.getExpirationDate());
155 model.setMimeType(soapModel.getMimeType());
156 model.setTitle(soapModel.getTitle());
157 model.setDescription(soapModel.getDescription());
158 model.setSummary(soapModel.getSummary());
159 model.setUrl(soapModel.getUrl());
160 model.setHeight(soapModel.getHeight());
161 model.setWidth(soapModel.getWidth());
162 model.setPriority(soapModel.getPriority());
163 model.setViewCount(soapModel.getViewCount());
164
165 return model;
166 }
167
168 public static List<TagsAsset> toModels(TagsAssetSoap[] soapModels) {
169 List<TagsAsset> models = new ArrayList<TagsAsset>(soapModels.length);
170
171 for (TagsAssetSoap soapModel : soapModels) {
172 models.add(toModel(soapModel));
173 }
174
175 return models;
176 }
177
178 public static final boolean CACHE_ENABLED_TAGSASSETS_TAGSENTRIES = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
179 "value.object.finder.cache.enabled.TagsAssets_TagsEntries"),
180 true);
181 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
182 "lock.expiration.time.com.liferay.portlet.tags.model.TagsAsset"));
183
184 public TagsAssetModelImpl() {
185 }
186
187 public long getPrimaryKey() {
188 return _assetId;
189 }
190
191 public void setPrimaryKey(long pk) {
192 setAssetId(pk);
193 }
194
195 public Serializable getPrimaryKeyObj() {
196 return new Long(_assetId);
197 }
198
199 public long getAssetId() {
200 return _assetId;
201 }
202
203 public void setAssetId(long assetId) {
204 if (assetId != _assetId) {
205 _assetId = assetId;
206 }
207 }
208
209 public long getGroupId() {
210 return _groupId;
211 }
212
213 public void setGroupId(long groupId) {
214 if (groupId != _groupId) {
215 _groupId = groupId;
216 }
217 }
218
219 public long getCompanyId() {
220 return _companyId;
221 }
222
223 public void setCompanyId(long companyId) {
224 if (companyId != _companyId) {
225 _companyId = companyId;
226 }
227 }
228
229 public long getUserId() {
230 return _userId;
231 }
232
233 public void setUserId(long userId) {
234 if (userId != _userId) {
235 _userId = userId;
236 }
237 }
238
239 public String getUserName() {
240 return GetterUtil.getString(_userName);
241 }
242
243 public void setUserName(String userName) {
244 if (((userName == null) && (_userName != null)) ||
245 ((userName != null) && (_userName == null)) ||
246 ((userName != null) && (_userName != null) &&
247 !userName.equals(_userName))) {
248 _userName = userName;
249 }
250 }
251
252 public Date getCreateDate() {
253 return _createDate;
254 }
255
256 public void setCreateDate(Date createDate) {
257 if (((createDate == null) && (_createDate != null)) ||
258 ((createDate != null) && (_createDate == null)) ||
259 ((createDate != null) && (_createDate != null) &&
260 !createDate.equals(_createDate))) {
261 _createDate = createDate;
262 }
263 }
264
265 public Date getModifiedDate() {
266 return _modifiedDate;
267 }
268
269 public void setModifiedDate(Date modifiedDate) {
270 if (((modifiedDate == null) && (_modifiedDate != null)) ||
271 ((modifiedDate != null) && (_modifiedDate == null)) ||
272 ((modifiedDate != null) && (_modifiedDate != null) &&
273 !modifiedDate.equals(_modifiedDate))) {
274 _modifiedDate = modifiedDate;
275 }
276 }
277
278 public String getClassName() {
279 if (getClassNameId() <= 0) {
280 return StringPool.BLANK;
281 }
282
283 return PortalUtil.getClassName(getClassNameId());
284 }
285
286 public long getClassNameId() {
287 return _classNameId;
288 }
289
290 public void setClassNameId(long classNameId) {
291 if (classNameId != _classNameId) {
292 _classNameId = classNameId;
293 }
294 }
295
296 public long getClassPK() {
297 return _classPK;
298 }
299
300 public void setClassPK(long classPK) {
301 if (classPK != _classPK) {
302 _classPK = classPK;
303 }
304 }
305
306 public Date getStartDate() {
307 return _startDate;
308 }
309
310 public void setStartDate(Date startDate) {
311 if (((startDate == null) && (_startDate != null)) ||
312 ((startDate != null) && (_startDate == null)) ||
313 ((startDate != null) && (_startDate != null) &&
314 !startDate.equals(_startDate))) {
315 _startDate = startDate;
316 }
317 }
318
319 public Date getEndDate() {
320 return _endDate;
321 }
322
323 public void setEndDate(Date endDate) {
324 if (((endDate == null) && (_endDate != null)) ||
325 ((endDate != null) && (_endDate == null)) ||
326 ((endDate != null) && (_endDate != null) &&
327 !endDate.equals(_endDate))) {
328 _endDate = endDate;
329 }
330 }
331
332 public Date getPublishDate() {
333 return _publishDate;
334 }
335
336 public void setPublishDate(Date publishDate) {
337 if (((publishDate == null) && (_publishDate != null)) ||
338 ((publishDate != null) && (_publishDate == null)) ||
339 ((publishDate != null) && (_publishDate != null) &&
340 !publishDate.equals(_publishDate))) {
341 _publishDate = publishDate;
342 }
343 }
344
345 public Date getExpirationDate() {
346 return _expirationDate;
347 }
348
349 public void setExpirationDate(Date expirationDate) {
350 if (((expirationDate == null) && (_expirationDate != null)) ||
351 ((expirationDate != null) && (_expirationDate == null)) ||
352 ((expirationDate != null) && (_expirationDate != null) &&
353 !expirationDate.equals(_expirationDate))) {
354 _expirationDate = expirationDate;
355 }
356 }
357
358 public String getMimeType() {
359 return GetterUtil.getString(_mimeType);
360 }
361
362 public void setMimeType(String mimeType) {
363 if (((mimeType == null) && (_mimeType != null)) ||
364 ((mimeType != null) && (_mimeType == null)) ||
365 ((mimeType != null) && (_mimeType != null) &&
366 !mimeType.equals(_mimeType))) {
367 _mimeType = mimeType;
368 }
369 }
370
371 public String getTitle() {
372 return GetterUtil.getString(_title);
373 }
374
375 public void setTitle(String title) {
376 if (((title == null) && (_title != null)) ||
377 ((title != null) && (_title == null)) ||
378 ((title != null) && (_title != null) && !title.equals(_title))) {
379 _title = title;
380 }
381 }
382
383 public String getDescription() {
384 return GetterUtil.getString(_description);
385 }
386
387 public void setDescription(String description) {
388 if (((description == null) && (_description != null)) ||
389 ((description != null) && (_description == null)) ||
390 ((description != null) && (_description != null) &&
391 !description.equals(_description))) {
392 _description = description;
393 }
394 }
395
396 public String getSummary() {
397 return GetterUtil.getString(_summary);
398 }
399
400 public void setSummary(String summary) {
401 if (((summary == null) && (_summary != null)) ||
402 ((summary != null) && (_summary == null)) ||
403 ((summary != null) && (_summary != null) &&
404 !summary.equals(_summary))) {
405 _summary = summary;
406 }
407 }
408
409 public String getUrl() {
410 return GetterUtil.getString(_url);
411 }
412
413 public void setUrl(String url) {
414 if (((url == null) && (_url != null)) ||
415 ((url != null) && (_url == null)) ||
416 ((url != null) && (_url != null) && !url.equals(_url))) {
417 _url = url;
418 }
419 }
420
421 public int getHeight() {
422 return _height;
423 }
424
425 public void setHeight(int height) {
426 if (height != _height) {
427 _height = height;
428 }
429 }
430
431 public int getWidth() {
432 return _width;
433 }
434
435 public void setWidth(int width) {
436 if (width != _width) {
437 _width = width;
438 }
439 }
440
441 public double getPriority() {
442 return _priority;
443 }
444
445 public void setPriority(double priority) {
446 if (priority != _priority) {
447 _priority = priority;
448 }
449 }
450
451 public int getViewCount() {
452 return _viewCount;
453 }
454
455 public void setViewCount(int viewCount) {
456 if (viewCount != _viewCount) {
457 _viewCount = viewCount;
458 }
459 }
460
461 public TagsAsset toEscapedModel() {
462 if (isEscapedModel()) {
463 return (TagsAsset)this;
464 }
465 else {
466 TagsAsset model = new TagsAssetImpl();
467
468 model.setNew(isNew());
469 model.setEscapedModel(true);
470
471 model.setAssetId(getAssetId());
472 model.setGroupId(getGroupId());
473 model.setCompanyId(getCompanyId());
474 model.setUserId(getUserId());
475 model.setUserName(HtmlUtil.escape(getUserName()));
476 model.setCreateDate(getCreateDate());
477 model.setModifiedDate(getModifiedDate());
478 model.setClassNameId(getClassNameId());
479 model.setClassPK(getClassPK());
480 model.setStartDate(getStartDate());
481 model.setEndDate(getEndDate());
482 model.setPublishDate(getPublishDate());
483 model.setExpirationDate(getExpirationDate());
484 model.setMimeType(HtmlUtil.escape(getMimeType()));
485 model.setTitle(HtmlUtil.escape(getTitle()));
486 model.setDescription(HtmlUtil.escape(getDescription()));
487 model.setSummary(HtmlUtil.escape(getSummary()));
488 model.setUrl(HtmlUtil.escape(getUrl()));
489 model.setHeight(getHeight());
490 model.setWidth(getWidth());
491 model.setPriority(getPriority());
492 model.setViewCount(getViewCount());
493
494 model = (TagsAsset)Proxy.newProxyInstance(TagsAsset.class.getClassLoader(),
495 new Class[] { TagsAsset.class },
496 new ReadOnlyBeanHandler(model));
497
498 return model;
499 }
500 }
501
502 public Object clone() {
503 TagsAssetImpl clone = new TagsAssetImpl();
504
505 clone.setAssetId(getAssetId());
506 clone.setGroupId(getGroupId());
507 clone.setCompanyId(getCompanyId());
508 clone.setUserId(getUserId());
509 clone.setUserName(getUserName());
510 clone.setCreateDate(getCreateDate());
511 clone.setModifiedDate(getModifiedDate());
512 clone.setClassNameId(getClassNameId());
513 clone.setClassPK(getClassPK());
514 clone.setStartDate(getStartDate());
515 clone.setEndDate(getEndDate());
516 clone.setPublishDate(getPublishDate());
517 clone.setExpirationDate(getExpirationDate());
518 clone.setMimeType(getMimeType());
519 clone.setTitle(getTitle());
520 clone.setDescription(getDescription());
521 clone.setSummary(getSummary());
522 clone.setUrl(getUrl());
523 clone.setHeight(getHeight());
524 clone.setWidth(getWidth());
525 clone.setPriority(getPriority());
526 clone.setViewCount(getViewCount());
527
528 return clone;
529 }
530
531 public int compareTo(Object obj) {
532 if (obj == null) {
533 return -1;
534 }
535
536 TagsAssetImpl tagsAsset = (TagsAssetImpl)obj;
537
538 long pk = tagsAsset.getPrimaryKey();
539
540 if (getPrimaryKey() < pk) {
541 return -1;
542 }
543 else if (getPrimaryKey() > pk) {
544 return 1;
545 }
546 else {
547 return 0;
548 }
549 }
550
551 public boolean equals(Object obj) {
552 if (obj == null) {
553 return false;
554 }
555
556 TagsAssetImpl tagsAsset = null;
557
558 try {
559 tagsAsset = (TagsAssetImpl)obj;
560 }
561 catch (ClassCastException cce) {
562 return false;
563 }
564
565 long pk = tagsAsset.getPrimaryKey();
566
567 if (getPrimaryKey() == pk) {
568 return true;
569 }
570 else {
571 return false;
572 }
573 }
574
575 public int hashCode() {
576 return (int)getPrimaryKey();
577 }
578
579 private long _assetId;
580 private long _groupId;
581 private long _companyId;
582 private long _userId;
583 private String _userName;
584 private Date _createDate;
585 private Date _modifiedDate;
586 private long _classNameId;
587 private long _classPK;
588 private Date _startDate;
589 private Date _endDate;
590 private Date _publishDate;
591 private Date _expirationDate;
592 private String _mimeType;
593 private String _title;
594 private String _description;
595 private String _summary;
596 private String _url;
597 private int _height;
598 private int _width;
599 private double _priority;
600 private int _viewCount;
601 }