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