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