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