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