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