1
14
15 package com.liferay.portlet.asset.model.impl;
16
17 import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
18 import com.liferay.portal.kernel.exception.SystemException;
19 import com.liferay.portal.kernel.util.GetterUtil;
20 import com.liferay.portal.kernel.util.StringBundler;
21 import com.liferay.portal.kernel.util.StringPool;
22 import com.liferay.portal.model.impl.BaseModelImpl;
23 import com.liferay.portal.service.ServiceContext;
24 import com.liferay.portal.util.PortalUtil;
25
26 import com.liferay.portlet.asset.model.AssetEntry;
27 import com.liferay.portlet.asset.model.AssetEntrySoap;
28 import com.liferay.portlet.expando.model.ExpandoBridge;
29 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
30
31 import java.io.Serializable;
32
33 import java.lang.reflect.Proxy;
34
35 import java.sql.Types;
36
37 import java.util.ArrayList;
38 import java.util.Date;
39 import java.util.List;
40
41
60 public class AssetEntryModelImpl extends BaseModelImpl<AssetEntry> {
61 public static final String TABLE_NAME = "AssetEntry";
62 public static final Object[][] TABLE_COLUMNS = {
63 { "entryId", new Integer(Types.BIGINT) },
64 { "groupId", new Integer(Types.BIGINT) },
65 { "companyId", new Integer(Types.BIGINT) },
66 { "userId", new Integer(Types.BIGINT) },
67 { "userName", new Integer(Types.VARCHAR) },
68 { "createDate", new Integer(Types.TIMESTAMP) },
69 { "modifiedDate", new Integer(Types.TIMESTAMP) },
70 { "classNameId", new Integer(Types.BIGINT) },
71 { "classPK", new Integer(Types.BIGINT) },
72 { "visible", new Integer(Types.BOOLEAN) },
73 { "startDate", new Integer(Types.TIMESTAMP) },
74 { "endDate", new Integer(Types.TIMESTAMP) },
75 { "publishDate", new Integer(Types.TIMESTAMP) },
76 { "expirationDate", new Integer(Types.TIMESTAMP) },
77 { "mimeType", new Integer(Types.VARCHAR) },
78 { "title", new Integer(Types.VARCHAR) },
79 { "description", new Integer(Types.VARCHAR) },
80 { "summary", new Integer(Types.VARCHAR) },
81 { "url", new Integer(Types.VARCHAR) },
82 { "height", new Integer(Types.INTEGER) },
83 { "width", new Integer(Types.INTEGER) },
84 { "priority", new Integer(Types.DOUBLE) },
85 { "viewCount", new Integer(Types.INTEGER) }
86 };
87 public static final String TABLE_SQL_CREATE = "create table AssetEntry (entryId 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,visible BOOLEAN,startDate DATE null,endDate DATE null,publishDate DATE null,expirationDate DATE null,mimeType VARCHAR(75) null,title VARCHAR(255) null,description STRING null,summary STRING null,url STRING null,height INTEGER,width INTEGER,priority DOUBLE,viewCount INTEGER)";
88 public static final String TABLE_SQL_DROP = "drop table AssetEntry";
89 public static final String DATA_SOURCE = "liferayDataSource";
90 public static final String SESSION_FACTORY = "liferaySessionFactory";
91 public static final String TX_MANAGER = "liferayTransactionManager";
92 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
93 "value.object.entity.cache.enabled.com.liferay.portlet.asset.model.AssetEntry"),
94 true);
95 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
96 "value.object.finder.cache.enabled.com.liferay.portlet.asset.model.AssetEntry"),
97 true);
98
99 public static AssetEntry toModel(AssetEntrySoap soapModel) {
100 AssetEntry model = new AssetEntryImpl();
101
102 model.setEntryId(soapModel.getEntryId());
103 model.setGroupId(soapModel.getGroupId());
104 model.setCompanyId(soapModel.getCompanyId());
105 model.setUserId(soapModel.getUserId());
106 model.setUserName(soapModel.getUserName());
107 model.setCreateDate(soapModel.getCreateDate());
108 model.setModifiedDate(soapModel.getModifiedDate());
109 model.setClassNameId(soapModel.getClassNameId());
110 model.setClassPK(soapModel.getClassPK());
111 model.setVisible(soapModel.getVisible());
112 model.setStartDate(soapModel.getStartDate());
113 model.setEndDate(soapModel.getEndDate());
114 model.setPublishDate(soapModel.getPublishDate());
115 model.setExpirationDate(soapModel.getExpirationDate());
116 model.setMimeType(soapModel.getMimeType());
117 model.setTitle(soapModel.getTitle());
118 model.setDescription(soapModel.getDescription());
119 model.setSummary(soapModel.getSummary());
120 model.setUrl(soapModel.getUrl());
121 model.setHeight(soapModel.getHeight());
122 model.setWidth(soapModel.getWidth());
123 model.setPriority(soapModel.getPriority());
124 model.setViewCount(soapModel.getViewCount());
125
126 return model;
127 }
128
129 public static List<AssetEntry> toModels(AssetEntrySoap[] soapModels) {
130 List<AssetEntry> models = new ArrayList<AssetEntry>(soapModels.length);
131
132 for (AssetEntrySoap soapModel : soapModels) {
133 models.add(toModel(soapModel));
134 }
135
136 return models;
137 }
138
139 public static final String MAPPING_TABLE_ASSETENTRIES_ASSETCATEGORIES_NAME = "AssetEntries_AssetCategories";
140 public static final Object[][] MAPPING_TABLE_ASSETENTRIES_ASSETCATEGORIES_COLUMNS =
141 {
142 { "entryId", new Integer(Types.BIGINT) },
143 { "categoryId", new Integer(Types.BIGINT) }
144 };
145 public static final String MAPPING_TABLE_ASSETENTRIES_ASSETCATEGORIES_SQL_CREATE =
146 "create table AssetEntries_AssetCategories (entryId LONG not null,categoryId LONG not null,primary key (entryId, categoryId))";
147 public static final boolean FINDER_CACHE_ENABLED_ASSETENTRIES_ASSETCATEGORIES =
148 GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
149 "value.object.finder.cache.enabled.AssetEntries_AssetCategories"),
150 true);
151 public static final String MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME = "AssetEntries_AssetTags";
152 public static final Object[][] MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_COLUMNS = {
153 { "entryId", new Integer(Types.BIGINT) },
154 { "tagId", new Integer(Types.BIGINT) }
155 };
156 public static final String MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_SQL_CREATE = "create table AssetEntries_AssetTags (entryId LONG not null,tagId LONG not null,primary key (entryId, tagId))";
157 public static final boolean FINDER_CACHE_ENABLED_ASSETENTRIES_ASSETTAGS = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
158 "value.object.finder.cache.enabled.AssetEntries_AssetTags"),
159 true);
160 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
161 "lock.expiration.time.com.liferay.portlet.asset.model.AssetEntry"));
162
163 public AssetEntryModelImpl() {
164 }
165
166 public long getPrimaryKey() {
167 return _entryId;
168 }
169
170 public void setPrimaryKey(long pk) {
171 setEntryId(pk);
172 }
173
174 public Serializable getPrimaryKeyObj() {
175 return new Long(_entryId);
176 }
177
178 public long getEntryId() {
179 return _entryId;
180 }
181
182 public void setEntryId(long entryId) {
183 _entryId = entryId;
184 }
185
186 public long getGroupId() {
187 return _groupId;
188 }
189
190 public void setGroupId(long groupId) {
191 _groupId = groupId;
192 }
193
194 public long getCompanyId() {
195 return _companyId;
196 }
197
198 public void setCompanyId(long companyId) {
199 _companyId = companyId;
200 }
201
202 public long getUserId() {
203 return _userId;
204 }
205
206 public void setUserId(long userId) {
207 _userId = userId;
208 }
209
210 public String getUserUuid() throws SystemException {
211 return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
212 }
213
214 public void setUserUuid(String userUuid) {
215 _userUuid = userUuid;
216 }
217
218 public String getUserName() {
219 if (_userName == null) {
220 return StringPool.BLANK;
221 }
222 else {
223 return _userName;
224 }
225 }
226
227 public void setUserName(String userName) {
228 _userName = userName;
229 }
230
231 public Date getCreateDate() {
232 return _createDate;
233 }
234
235 public void setCreateDate(Date createDate) {
236 _createDate = createDate;
237 }
238
239 public Date getModifiedDate() {
240 return _modifiedDate;
241 }
242
243 public void setModifiedDate(Date modifiedDate) {
244 _modifiedDate = modifiedDate;
245 }
246
247 public String getClassName() {
248 if (getClassNameId() <= 0) {
249 return StringPool.BLANK;
250 }
251
252 return PortalUtil.getClassName(getClassNameId());
253 }
254
255 public long getClassNameId() {
256 return _classNameId;
257 }
258
259 public void setClassNameId(long classNameId) {
260 _classNameId = classNameId;
261
262 if (!_setOriginalClassNameId) {
263 _setOriginalClassNameId = true;
264
265 _originalClassNameId = classNameId;
266 }
267 }
268
269 public long getOriginalClassNameId() {
270 return _originalClassNameId;
271 }
272
273 public long getClassPK() {
274 return _classPK;
275 }
276
277 public void setClassPK(long classPK) {
278 _classPK = classPK;
279
280 if (!_setOriginalClassPK) {
281 _setOriginalClassPK = true;
282
283 _originalClassPK = classPK;
284 }
285 }
286
287 public long getOriginalClassPK() {
288 return _originalClassPK;
289 }
290
291 public boolean getVisible() {
292 return _visible;
293 }
294
295 public boolean isVisible() {
296 return _visible;
297 }
298
299 public void setVisible(boolean visible) {
300 _visible = visible;
301 }
302
303 public Date getStartDate() {
304 return _startDate;
305 }
306
307 public void setStartDate(Date startDate) {
308 _startDate = startDate;
309 }
310
311 public Date getEndDate() {
312 return _endDate;
313 }
314
315 public void setEndDate(Date endDate) {
316 _endDate = endDate;
317 }
318
319 public Date getPublishDate() {
320 return _publishDate;
321 }
322
323 public void setPublishDate(Date publishDate) {
324 _publishDate = publishDate;
325 }
326
327 public Date getExpirationDate() {
328 return _expirationDate;
329 }
330
331 public void setExpirationDate(Date expirationDate) {
332 _expirationDate = expirationDate;
333 }
334
335 public String getMimeType() {
336 if (_mimeType == null) {
337 return StringPool.BLANK;
338 }
339 else {
340 return _mimeType;
341 }
342 }
343
344 public void setMimeType(String mimeType) {
345 _mimeType = mimeType;
346 }
347
348 public String getTitle() {
349 if (_title == null) {
350 return StringPool.BLANK;
351 }
352 else {
353 return _title;
354 }
355 }
356
357 public void setTitle(String title) {
358 _title = title;
359 }
360
361 public String getDescription() {
362 if (_description == null) {
363 return StringPool.BLANK;
364 }
365 else {
366 return _description;
367 }
368 }
369
370 public void setDescription(String description) {
371 _description = description;
372 }
373
374 public String getSummary() {
375 if (_summary == null) {
376 return StringPool.BLANK;
377 }
378 else {
379 return _summary;
380 }
381 }
382
383 public void setSummary(String summary) {
384 _summary = summary;
385 }
386
387 public String getUrl() {
388 if (_url == null) {
389 return StringPool.BLANK;
390 }
391 else {
392 return _url;
393 }
394 }
395
396 public void setUrl(String url) {
397 _url = url;
398 }
399
400 public int getHeight() {
401 return _height;
402 }
403
404 public void setHeight(int height) {
405 _height = height;
406 }
407
408 public int getWidth() {
409 return _width;
410 }
411
412 public void setWidth(int width) {
413 _width = width;
414 }
415
416 public double getPriority() {
417 return _priority;
418 }
419
420 public void setPriority(double priority) {
421 _priority = priority;
422 }
423
424 public int getViewCount() {
425 return _viewCount;
426 }
427
428 public void setViewCount(int viewCount) {
429 _viewCount = viewCount;
430 }
431
432 public AssetEntry toEscapedModel() {
433 if (isEscapedModel()) {
434 return (AssetEntry)this;
435 }
436 else {
437 return (AssetEntry)Proxy.newProxyInstance(AssetEntry.class.getClassLoader(),
438 new Class[] { AssetEntry.class },
439 new AutoEscapeBeanHandler(this));
440 }
441 }
442
443 public ExpandoBridge getExpandoBridge() {
444 if (_expandoBridge == null) {
445 _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
446 AssetEntry.class.getName(), getPrimaryKey());
447 }
448
449 return _expandoBridge;
450 }
451
452 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
453 getExpandoBridge().setAttributes(serviceContext);
454 }
455
456 public Object clone() {
457 AssetEntryImpl clone = new AssetEntryImpl();
458
459 clone.setEntryId(getEntryId());
460 clone.setGroupId(getGroupId());
461 clone.setCompanyId(getCompanyId());
462 clone.setUserId(getUserId());
463 clone.setUserName(getUserName());
464 clone.setCreateDate(getCreateDate());
465 clone.setModifiedDate(getModifiedDate());
466 clone.setClassNameId(getClassNameId());
467 clone.setClassPK(getClassPK());
468 clone.setVisible(getVisible());
469 clone.setStartDate(getStartDate());
470 clone.setEndDate(getEndDate());
471 clone.setPublishDate(getPublishDate());
472 clone.setExpirationDate(getExpirationDate());
473 clone.setMimeType(getMimeType());
474 clone.setTitle(getTitle());
475 clone.setDescription(getDescription());
476 clone.setSummary(getSummary());
477 clone.setUrl(getUrl());
478 clone.setHeight(getHeight());
479 clone.setWidth(getWidth());
480 clone.setPriority(getPriority());
481 clone.setViewCount(getViewCount());
482
483 return clone;
484 }
485
486 public int compareTo(AssetEntry assetEntry) {
487 long pk = assetEntry.getPrimaryKey();
488
489 if (getPrimaryKey() < pk) {
490 return -1;
491 }
492 else if (getPrimaryKey() > pk) {
493 return 1;
494 }
495 else {
496 return 0;
497 }
498 }
499
500 public boolean equals(Object obj) {
501 if (obj == null) {
502 return false;
503 }
504
505 AssetEntry assetEntry = null;
506
507 try {
508 assetEntry = (AssetEntry)obj;
509 }
510 catch (ClassCastException cce) {
511 return false;
512 }
513
514 long pk = assetEntry.getPrimaryKey();
515
516 if (getPrimaryKey() == pk) {
517 return true;
518 }
519 else {
520 return false;
521 }
522 }
523
524 public int hashCode() {
525 return (int)getPrimaryKey();
526 }
527
528 public String toString() {
529 StringBundler sb = new StringBundler(47);
530
531 sb.append("{entryId=");
532 sb.append(getEntryId());
533 sb.append(", groupId=");
534 sb.append(getGroupId());
535 sb.append(", companyId=");
536 sb.append(getCompanyId());
537 sb.append(", userId=");
538 sb.append(getUserId());
539 sb.append(", userName=");
540 sb.append(getUserName());
541 sb.append(", createDate=");
542 sb.append(getCreateDate());
543 sb.append(", modifiedDate=");
544 sb.append(getModifiedDate());
545 sb.append(", classNameId=");
546 sb.append(getClassNameId());
547 sb.append(", classPK=");
548 sb.append(getClassPK());
549 sb.append(", visible=");
550 sb.append(getVisible());
551 sb.append(", startDate=");
552 sb.append(getStartDate());
553 sb.append(", endDate=");
554 sb.append(getEndDate());
555 sb.append(", publishDate=");
556 sb.append(getPublishDate());
557 sb.append(", expirationDate=");
558 sb.append(getExpirationDate());
559 sb.append(", mimeType=");
560 sb.append(getMimeType());
561 sb.append(", title=");
562 sb.append(getTitle());
563 sb.append(", description=");
564 sb.append(getDescription());
565 sb.append(", summary=");
566 sb.append(getSummary());
567 sb.append(", url=");
568 sb.append(getUrl());
569 sb.append(", height=");
570 sb.append(getHeight());
571 sb.append(", width=");
572 sb.append(getWidth());
573 sb.append(", priority=");
574 sb.append(getPriority());
575 sb.append(", viewCount=");
576 sb.append(getViewCount());
577 sb.append("}");
578
579 return sb.toString();
580 }
581
582 public String toXmlString() {
583 StringBundler sb = new StringBundler(73);
584
585 sb.append("<model><model-name>");
586 sb.append("com.liferay.portlet.asset.model.AssetEntry");
587 sb.append("</model-name>");
588
589 sb.append(
590 "<column><column-name>entryId</column-name><column-value><![CDATA[");
591 sb.append(getEntryId());
592 sb.append("]]></column-value></column>");
593 sb.append(
594 "<column><column-name>groupId</column-name><column-value><![CDATA[");
595 sb.append(getGroupId());
596 sb.append("]]></column-value></column>");
597 sb.append(
598 "<column><column-name>companyId</column-name><column-value><![CDATA[");
599 sb.append(getCompanyId());
600 sb.append("]]></column-value></column>");
601 sb.append(
602 "<column><column-name>userId</column-name><column-value><![CDATA[");
603 sb.append(getUserId());
604 sb.append("]]></column-value></column>");
605 sb.append(
606 "<column><column-name>userName</column-name><column-value><![CDATA[");
607 sb.append(getUserName());
608 sb.append("]]></column-value></column>");
609 sb.append(
610 "<column><column-name>createDate</column-name><column-value><![CDATA[");
611 sb.append(getCreateDate());
612 sb.append("]]></column-value></column>");
613 sb.append(
614 "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
615 sb.append(getModifiedDate());
616 sb.append("]]></column-value></column>");
617 sb.append(
618 "<column><column-name>classNameId</column-name><column-value><![CDATA[");
619 sb.append(getClassNameId());
620 sb.append("]]></column-value></column>");
621 sb.append(
622 "<column><column-name>classPK</column-name><column-value><![CDATA[");
623 sb.append(getClassPK());
624 sb.append("]]></column-value></column>");
625 sb.append(
626 "<column><column-name>visible</column-name><column-value><![CDATA[");
627 sb.append(getVisible());
628 sb.append("]]></column-value></column>");
629 sb.append(
630 "<column><column-name>startDate</column-name><column-value><![CDATA[");
631 sb.append(getStartDate());
632 sb.append("]]></column-value></column>");
633 sb.append(
634 "<column><column-name>endDate</column-name><column-value><![CDATA[");
635 sb.append(getEndDate());
636 sb.append("]]></column-value></column>");
637 sb.append(
638 "<column><column-name>publishDate</column-name><column-value><![CDATA[");
639 sb.append(getPublishDate());
640 sb.append("]]></column-value></column>");
641 sb.append(
642 "<column><column-name>expirationDate</column-name><column-value><![CDATA[");
643 sb.append(getExpirationDate());
644 sb.append("]]></column-value></column>");
645 sb.append(
646 "<column><column-name>mimeType</column-name><column-value><![CDATA[");
647 sb.append(getMimeType());
648 sb.append("]]></column-value></column>");
649 sb.append(
650 "<column><column-name>title</column-name><column-value><![CDATA[");
651 sb.append(getTitle());
652 sb.append("]]></column-value></column>");
653 sb.append(
654 "<column><column-name>description</column-name><column-value><![CDATA[");
655 sb.append(getDescription());
656 sb.append("]]></column-value></column>");
657 sb.append(
658 "<column><column-name>summary</column-name><column-value><![CDATA[");
659 sb.append(getSummary());
660 sb.append("]]></column-value></column>");
661 sb.append(
662 "<column><column-name>url</column-name><column-value><![CDATA[");
663 sb.append(getUrl());
664 sb.append("]]></column-value></column>");
665 sb.append(
666 "<column><column-name>height</column-name><column-value><![CDATA[");
667 sb.append(getHeight());
668 sb.append("]]></column-value></column>");
669 sb.append(
670 "<column><column-name>width</column-name><column-value><![CDATA[");
671 sb.append(getWidth());
672 sb.append("]]></column-value></column>");
673 sb.append(
674 "<column><column-name>priority</column-name><column-value><![CDATA[");
675 sb.append(getPriority());
676 sb.append("]]></column-value></column>");
677 sb.append(
678 "<column><column-name>viewCount</column-name><column-value><![CDATA[");
679 sb.append(getViewCount());
680 sb.append("]]></column-value></column>");
681
682 sb.append("</model>");
683
684 return sb.toString();
685 }
686
687 private long _entryId;
688 private long _groupId;
689 private long _companyId;
690 private long _userId;
691 private String _userUuid;
692 private String _userName;
693 private Date _createDate;
694 private Date _modifiedDate;
695 private long _classNameId;
696 private long _originalClassNameId;
697 private boolean _setOriginalClassNameId;
698 private long _classPK;
699 private long _originalClassPK;
700 private boolean _setOriginalClassPK;
701 private boolean _visible;
702 private Date _startDate;
703 private Date _endDate;
704 private Date _publishDate;
705 private Date _expirationDate;
706 private String _mimeType;
707 private String _title;
708 private String _description;
709 private String _summary;
710 private String _url;
711 private int _height;
712 private int _width;
713 private double _priority;
714 private int _viewCount;
715 private transient ExpandoBridge _expandoBridge;
716 }