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.language.LanguageUtil;
020 import com.liferay.portal.kernel.util.GetterUtil;
021 import com.liferay.portal.kernel.util.HtmlUtil;
022 import com.liferay.portal.kernel.util.LocaleUtil;
023 import com.liferay.portal.kernel.util.LocalizationUtil;
024 import com.liferay.portal.kernel.util.StringBundler;
025 import com.liferay.portal.kernel.util.StringPool;
026 import com.liferay.portal.kernel.util.Validator;
027 import com.liferay.portal.model.impl.BaseModelImpl;
028 import com.liferay.portal.service.ServiceContext;
029 import com.liferay.portal.util.PortalUtil;
030
031 import com.liferay.portlet.asset.model.AssetCategory;
032 import com.liferay.portlet.asset.model.AssetCategoryModel;
033 import com.liferay.portlet.asset.model.AssetCategorySoap;
034 import com.liferay.portlet.expando.model.ExpandoBridge;
035 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
036
037 import java.io.Serializable;
038
039 import java.lang.reflect.Proxy;
040
041 import java.sql.Types;
042
043 import java.util.ArrayList;
044 import java.util.Date;
045 import java.util.List;
046 import java.util.Locale;
047 import java.util.Map;
048
049
066 public class AssetCategoryModelImpl extends BaseModelImpl<AssetCategory>
067 implements AssetCategoryModel {
068 public static final String TABLE_NAME = "AssetCategory";
069 public static final Object[][] TABLE_COLUMNS = {
070 { "uuid_", new Integer(Types.VARCHAR) },
071 { "categoryId", new Integer(Types.BIGINT) },
072 { "groupId", new Integer(Types.BIGINT) },
073 { "companyId", new Integer(Types.BIGINT) },
074 { "userId", new Integer(Types.BIGINT) },
075 { "userName", new Integer(Types.VARCHAR) },
076 { "createDate", new Integer(Types.TIMESTAMP) },
077 { "modifiedDate", new Integer(Types.TIMESTAMP) },
078 { "parentCategoryId", new Integer(Types.BIGINT) },
079 { "leftCategoryId", new Integer(Types.BIGINT) },
080 { "rightCategoryId", new Integer(Types.BIGINT) },
081 { "name", new Integer(Types.VARCHAR) },
082 { "title", new Integer(Types.VARCHAR) },
083 { "vocabularyId", new Integer(Types.BIGINT) }
084 };
085 public static final String TABLE_SQL_CREATE = "create table AssetCategory (uuid_ VARCHAR(75) null,categoryId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,parentCategoryId LONG,leftCategoryId LONG,rightCategoryId LONG,name VARCHAR(75) null,title STRING null,vocabularyId LONG)";
086 public static final String TABLE_SQL_DROP = "drop table AssetCategory";
087 public static final String ORDER_BY_JPQL = " ORDER BY assetCategory.name ASC";
088 public static final String ORDER_BY_SQL = " ORDER BY AssetCategory.name ASC";
089 public static final String DATA_SOURCE = "liferayDataSource";
090 public static final String SESSION_FACTORY = "liferaySessionFactory";
091 public static final String TX_MANAGER = "liferayTransactionManager";
092 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
093 "value.object.entity.cache.enabled.com.liferay.portlet.asset.model.AssetCategory"),
094 true);
095 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
096 "value.object.finder.cache.enabled.com.liferay.portlet.asset.model.AssetCategory"),
097 true);
098
099
105 public static AssetCategory toModel(AssetCategorySoap soapModel) {
106 AssetCategory model = new AssetCategoryImpl();
107
108 model.setUuid(soapModel.getUuid());
109 model.setCategoryId(soapModel.getCategoryId());
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.setParentCategoryId(soapModel.getParentCategoryId());
117 model.setLeftCategoryId(soapModel.getLeftCategoryId());
118 model.setRightCategoryId(soapModel.getRightCategoryId());
119 model.setName(soapModel.getName());
120 model.setTitle(soapModel.getTitle());
121 model.setVocabularyId(soapModel.getVocabularyId());
122
123 return model;
124 }
125
126
132 public static List<AssetCategory> toModels(AssetCategorySoap[] soapModels) {
133 List<AssetCategory> models = new ArrayList<AssetCategory>(soapModels.length);
134
135 for (AssetCategorySoap soapModel : soapModels) {
136 models.add(toModel(soapModel));
137 }
138
139 return models;
140 }
141
142 public static final String MAPPING_TABLE_ASSETENTRIES_ASSETCATEGORIES_NAME = com.liferay.portlet.asset.model.impl.AssetEntryModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETCATEGORIES_NAME;
143 public static final boolean FINDER_CACHE_ENABLED_ASSETENTRIES_ASSETCATEGORIES =
144 com.liferay.portlet.asset.model.impl.AssetEntryModelImpl.FINDER_CACHE_ENABLED_ASSETENTRIES_ASSETCATEGORIES;
145 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
146 "lock.expiration.time.com.liferay.portlet.asset.model.AssetCategory"));
147
148 public AssetCategoryModelImpl() {
149 }
150
151 public long getPrimaryKey() {
152 return _categoryId;
153 }
154
155 public void setPrimaryKey(long pk) {
156 setCategoryId(pk);
157 }
158
159 public Serializable getPrimaryKeyObj() {
160 return new Long(_categoryId);
161 }
162
163 public String getUuid() {
164 if (_uuid == null) {
165 return StringPool.BLANK;
166 }
167 else {
168 return _uuid;
169 }
170 }
171
172 public void setUuid(String uuid) {
173 if (_originalUuid == null) {
174 _originalUuid = _uuid;
175 }
176
177 _uuid = uuid;
178 }
179
180 public String getOriginalUuid() {
181 return GetterUtil.getString(_originalUuid);
182 }
183
184 public long getCategoryId() {
185 return _categoryId;
186 }
187
188 public void setCategoryId(long categoryId) {
189 _categoryId = categoryId;
190 }
191
192 public long getGroupId() {
193 return _groupId;
194 }
195
196 public void setGroupId(long groupId) {
197 if (!_setOriginalGroupId) {
198 _setOriginalGroupId = true;
199
200 _originalGroupId = _groupId;
201 }
202
203 _groupId = groupId;
204 }
205
206 public long getOriginalGroupId() {
207 return _originalGroupId;
208 }
209
210 public long getCompanyId() {
211 return _companyId;
212 }
213
214 public void setCompanyId(long companyId) {
215 _companyId = companyId;
216 }
217
218 public long getUserId() {
219 return _userId;
220 }
221
222 public void setUserId(long userId) {
223 _userId = userId;
224 }
225
226 public String getUserUuid() throws SystemException {
227 return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
228 }
229
230 public void setUserUuid(String userUuid) {
231 _userUuid = userUuid;
232 }
233
234 public String getUserName() {
235 if (_userName == null) {
236 return StringPool.BLANK;
237 }
238 else {
239 return _userName;
240 }
241 }
242
243 public void setUserName(String userName) {
244 _userName = userName;
245 }
246
247 public Date getCreateDate() {
248 return _createDate;
249 }
250
251 public void setCreateDate(Date createDate) {
252 _createDate = createDate;
253 }
254
255 public Date getModifiedDate() {
256 return _modifiedDate;
257 }
258
259 public void setModifiedDate(Date modifiedDate) {
260 _modifiedDate = modifiedDate;
261 }
262
263 public long getParentCategoryId() {
264 return _parentCategoryId;
265 }
266
267 public void setParentCategoryId(long parentCategoryId) {
268 if (!_setOriginalParentCategoryId) {
269 _setOriginalParentCategoryId = true;
270
271 _originalParentCategoryId = _parentCategoryId;
272 }
273
274 _parentCategoryId = parentCategoryId;
275 }
276
277 public long getOriginalParentCategoryId() {
278 return _originalParentCategoryId;
279 }
280
281 public long getLeftCategoryId() {
282 return _leftCategoryId;
283 }
284
285 public void setLeftCategoryId(long leftCategoryId) {
286 _leftCategoryId = leftCategoryId;
287 }
288
289 public long getRightCategoryId() {
290 return _rightCategoryId;
291 }
292
293 public void setRightCategoryId(long rightCategoryId) {
294 _rightCategoryId = rightCategoryId;
295 }
296
297 public String getName() {
298 if (_name == null) {
299 return StringPool.BLANK;
300 }
301 else {
302 return _name;
303 }
304 }
305
306 public void setName(String name) {
307 if (_originalName == null) {
308 _originalName = _name;
309 }
310
311 _name = name;
312 }
313
314 public String getOriginalName() {
315 return GetterUtil.getString(_originalName);
316 }
317
318 public String getTitle() {
319 if (_title == null) {
320 return StringPool.BLANK;
321 }
322 else {
323 return _title;
324 }
325 }
326
327 public String getTitle(Locale locale) {
328 String languageId = LocaleUtil.toLanguageId(locale);
329
330 return getTitle(languageId);
331 }
332
333 public String getTitle(Locale locale, boolean useDefault) {
334 String languageId = LocaleUtil.toLanguageId(locale);
335
336 return getTitle(languageId, useDefault);
337 }
338
339 public String getTitle(String languageId) {
340 String value = LocalizationUtil.getLocalization(getTitle(), languageId);
341
342 if (isEscapedModel()) {
343 return HtmlUtil.escape(value);
344 }
345 else {
346 return value;
347 }
348 }
349
350 public String getTitle(String languageId, boolean useDefault) {
351 String value = LocalizationUtil.getLocalization(getTitle(), languageId,
352 useDefault);
353
354 if (isEscapedModel()) {
355 return HtmlUtil.escape(value);
356 }
357 else {
358 return value;
359 }
360 }
361
362 public Map<Locale, String> getTitleMap() {
363 return LocalizationUtil.getLocalizationMap(getTitle());
364 }
365
366 public void setTitle(String title) {
367 _title = title;
368 }
369
370 public void setTitle(Locale locale, String title) {
371 String languageId = LocaleUtil.toLanguageId(locale);
372
373 if (Validator.isNotNull(title)) {
374 setTitle(LocalizationUtil.updateLocalization(getTitle(), "Title",
375 title, languageId));
376 }
377 else {
378 setTitle(LocalizationUtil.removeLocalization(getTitle(), "Title",
379 languageId));
380 }
381 }
382
383 public void setTitleMap(Map<Locale, String> titleMap) {
384 if (titleMap == null) {
385 return;
386 }
387
388 Locale[] locales = LanguageUtil.getAvailableLocales();
389
390 for (Locale locale : locales) {
391 String title = titleMap.get(locale);
392
393 setTitle(locale, title);
394 }
395 }
396
397 public long getVocabularyId() {
398 return _vocabularyId;
399 }
400
401 public void setVocabularyId(long vocabularyId) {
402 if (!_setOriginalVocabularyId) {
403 _setOriginalVocabularyId = true;
404
405 _originalVocabularyId = _vocabularyId;
406 }
407
408 _vocabularyId = vocabularyId;
409 }
410
411 public long getOriginalVocabularyId() {
412 return _originalVocabularyId;
413 }
414
415 public AssetCategory toEscapedModel() {
416 if (isEscapedModel()) {
417 return (AssetCategory)this;
418 }
419 else {
420 return (AssetCategory)Proxy.newProxyInstance(AssetCategory.class.getClassLoader(),
421 new Class[] { AssetCategory.class },
422 new AutoEscapeBeanHandler(this));
423 }
424 }
425
426 public ExpandoBridge getExpandoBridge() {
427 if (_expandoBridge == null) {
428 _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
429 AssetCategory.class.getName(), getPrimaryKey());
430 }
431
432 return _expandoBridge;
433 }
434
435 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
436 getExpandoBridge().setAttributes(serviceContext);
437 }
438
439 public Object clone() {
440 AssetCategoryImpl assetCategoryImpl = new AssetCategoryImpl();
441
442 assetCategoryImpl.setUuid(getUuid());
443
444 AssetCategoryModelImpl assetCategoryModelImpl = assetCategoryImpl;
445
446 assetCategoryModelImpl._originalUuid = assetCategoryModelImpl._uuid;
447
448 assetCategoryImpl.setCategoryId(getCategoryId());
449
450 assetCategoryImpl.setGroupId(getGroupId());
451
452 assetCategoryModelImpl._originalGroupId = assetCategoryModelImpl._groupId;
453
454 assetCategoryModelImpl._setOriginalGroupId = false;
455 assetCategoryImpl.setCompanyId(getCompanyId());
456
457 assetCategoryImpl.setUserId(getUserId());
458
459 assetCategoryImpl.setUserName(getUserName());
460
461 assetCategoryImpl.setCreateDate(getCreateDate());
462
463 assetCategoryImpl.setModifiedDate(getModifiedDate());
464
465 assetCategoryImpl.setParentCategoryId(getParentCategoryId());
466
467 assetCategoryModelImpl._originalParentCategoryId = assetCategoryModelImpl._parentCategoryId;
468
469 assetCategoryModelImpl._setOriginalParentCategoryId = false;
470 assetCategoryImpl.setLeftCategoryId(getLeftCategoryId());
471
472 assetCategoryImpl.setRightCategoryId(getRightCategoryId());
473
474 assetCategoryImpl.setName(getName());
475
476 assetCategoryModelImpl._originalName = assetCategoryModelImpl._name;
477
478 assetCategoryImpl.setTitle(getTitle());
479
480 assetCategoryImpl.setVocabularyId(getVocabularyId());
481
482 assetCategoryModelImpl._originalVocabularyId = assetCategoryModelImpl._vocabularyId;
483
484 assetCategoryModelImpl._setOriginalVocabularyId = false;
485
486 return assetCategoryImpl;
487 }
488
489 public int compareTo(AssetCategory assetCategory) {
490 int value = 0;
491
492 value = getName().compareTo(assetCategory.getName());
493
494 if (value != 0) {
495 return value;
496 }
497
498 return 0;
499 }
500
501 public boolean equals(Object obj) {
502 if (obj == null) {
503 return false;
504 }
505
506 AssetCategory assetCategory = null;
507
508 try {
509 assetCategory = (AssetCategory)obj;
510 }
511 catch (ClassCastException cce) {
512 return false;
513 }
514
515 long pk = assetCategory.getPrimaryKey();
516
517 if (getPrimaryKey() == pk) {
518 return true;
519 }
520 else {
521 return false;
522 }
523 }
524
525 public int hashCode() {
526 return (int)getPrimaryKey();
527 }
528
529 public String toString() {
530 StringBundler sb = new StringBundler(29);
531
532 sb.append("{uuid=");
533 sb.append(getUuid());
534 sb.append(", categoryId=");
535 sb.append(getCategoryId());
536 sb.append(", groupId=");
537 sb.append(getGroupId());
538 sb.append(", companyId=");
539 sb.append(getCompanyId());
540 sb.append(", userId=");
541 sb.append(getUserId());
542 sb.append(", userName=");
543 sb.append(getUserName());
544 sb.append(", createDate=");
545 sb.append(getCreateDate());
546 sb.append(", modifiedDate=");
547 sb.append(getModifiedDate());
548 sb.append(", parentCategoryId=");
549 sb.append(getParentCategoryId());
550 sb.append(", leftCategoryId=");
551 sb.append(getLeftCategoryId());
552 sb.append(", rightCategoryId=");
553 sb.append(getRightCategoryId());
554 sb.append(", name=");
555 sb.append(getName());
556 sb.append(", title=");
557 sb.append(getTitle());
558 sb.append(", vocabularyId=");
559 sb.append(getVocabularyId());
560 sb.append("}");
561
562 return sb.toString();
563 }
564
565 public String toXmlString() {
566 StringBundler sb = new StringBundler(46);
567
568 sb.append("<model><model-name>");
569 sb.append("com.liferay.portlet.asset.model.AssetCategory");
570 sb.append("</model-name>");
571
572 sb.append(
573 "<column><column-name>uuid</column-name><column-value><![CDATA[");
574 sb.append(getUuid());
575 sb.append("]]></column-value></column>");
576 sb.append(
577 "<column><column-name>categoryId</column-name><column-value><![CDATA[");
578 sb.append(getCategoryId());
579 sb.append("]]></column-value></column>");
580 sb.append(
581 "<column><column-name>groupId</column-name><column-value><![CDATA[");
582 sb.append(getGroupId());
583 sb.append("]]></column-value></column>");
584 sb.append(
585 "<column><column-name>companyId</column-name><column-value><![CDATA[");
586 sb.append(getCompanyId());
587 sb.append("]]></column-value></column>");
588 sb.append(
589 "<column><column-name>userId</column-name><column-value><![CDATA[");
590 sb.append(getUserId());
591 sb.append("]]></column-value></column>");
592 sb.append(
593 "<column><column-name>userName</column-name><column-value><![CDATA[");
594 sb.append(getUserName());
595 sb.append("]]></column-value></column>");
596 sb.append(
597 "<column><column-name>createDate</column-name><column-value><![CDATA[");
598 sb.append(getCreateDate());
599 sb.append("]]></column-value></column>");
600 sb.append(
601 "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
602 sb.append(getModifiedDate());
603 sb.append("]]></column-value></column>");
604 sb.append(
605 "<column><column-name>parentCategoryId</column-name><column-value><![CDATA[");
606 sb.append(getParentCategoryId());
607 sb.append("]]></column-value></column>");
608 sb.append(
609 "<column><column-name>leftCategoryId</column-name><column-value><![CDATA[");
610 sb.append(getLeftCategoryId());
611 sb.append("]]></column-value></column>");
612 sb.append(
613 "<column><column-name>rightCategoryId</column-name><column-value><![CDATA[");
614 sb.append(getRightCategoryId());
615 sb.append("]]></column-value></column>");
616 sb.append(
617 "<column><column-name>name</column-name><column-value><![CDATA[");
618 sb.append(getName());
619 sb.append("]]></column-value></column>");
620 sb.append(
621 "<column><column-name>title</column-name><column-value><![CDATA[");
622 sb.append(getTitle());
623 sb.append("]]></column-value></column>");
624 sb.append(
625 "<column><column-name>vocabularyId</column-name><column-value><![CDATA[");
626 sb.append(getVocabularyId());
627 sb.append("]]></column-value></column>");
628
629 sb.append("</model>");
630
631 return sb.toString();
632 }
633
634 private String _uuid;
635 private String _originalUuid;
636 private long _categoryId;
637 private long _groupId;
638 private long _originalGroupId;
639 private boolean _setOriginalGroupId;
640 private long _companyId;
641 private long _userId;
642 private String _userUuid;
643 private String _userName;
644 private Date _createDate;
645 private Date _modifiedDate;
646 private long _parentCategoryId;
647 private long _originalParentCategoryId;
648 private boolean _setOriginalParentCategoryId;
649 private long _leftCategoryId;
650 private long _rightCategoryId;
651 private String _name;
652 private String _originalName;
653 private String _title;
654 private long _vocabularyId;
655 private long _originalVocabularyId;
656 private boolean _setOriginalVocabularyId;
657 private transient ExpandoBridge _expandoBridge;
658 }