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