001
014
015 package com.liferay.portal.model.impl;
016
017 import com.liferay.portal.LocaleException;
018 import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
019 import com.liferay.portal.kernel.json.JSON;
020 import com.liferay.portal.kernel.util.GetterUtil;
021 import com.liferay.portal.kernel.util.LocaleUtil;
022 import com.liferay.portal.kernel.util.LocalizationUtil;
023 import com.liferay.portal.kernel.util.ProxyUtil;
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.CacheModel;
028 import com.liferay.portal.model.LayoutSetPrototype;
029 import com.liferay.portal.model.LayoutSetPrototypeModel;
030 import com.liferay.portal.model.LayoutSetPrototypeSoap;
031 import com.liferay.portal.service.ServiceContext;
032
033 import com.liferay.portlet.expando.model.ExpandoBridge;
034 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
035
036 import java.io.Serializable;
037
038 import java.sql.Types;
039
040 import java.util.ArrayList;
041 import java.util.Date;
042 import java.util.HashMap;
043 import java.util.List;
044 import java.util.Locale;
045 import java.util.Map;
046
047
060 @JSON(strict = true)
061 public class LayoutSetPrototypeModelImpl extends BaseModelImpl<LayoutSetPrototype>
062 implements LayoutSetPrototypeModel {
063
068 public static final String TABLE_NAME = "LayoutSetPrototype";
069 public static final Object[][] TABLE_COLUMNS = {
070 { "uuid_", Types.VARCHAR },
071 { "layoutSetPrototypeId", Types.BIGINT },
072 { "companyId", Types.BIGINT },
073 { "createDate", Types.TIMESTAMP },
074 { "modifiedDate", Types.TIMESTAMP },
075 { "name", Types.VARCHAR },
076 { "description", Types.VARCHAR },
077 { "settings_", Types.VARCHAR },
078 { "active_", Types.BOOLEAN }
079 };
080 public static final String TABLE_SQL_CREATE = "create table LayoutSetPrototype (uuid_ VARCHAR(75) null,layoutSetPrototypeId LONG not null primary key,companyId LONG,createDate DATE null,modifiedDate DATE null,name STRING null,description STRING null,settings_ STRING null,active_ BOOLEAN)";
081 public static final String TABLE_SQL_DROP = "drop table LayoutSetPrototype";
082 public static final String ORDER_BY_JPQL = " ORDER BY layoutSetPrototype.layoutSetPrototypeId ASC";
083 public static final String ORDER_BY_SQL = " ORDER BY LayoutSetPrototype.layoutSetPrototypeId ASC";
084 public static final String DATA_SOURCE = "liferayDataSource";
085 public static final String SESSION_FACTORY = "liferaySessionFactory";
086 public static final String TX_MANAGER = "liferayTransactionManager";
087 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
088 "value.object.entity.cache.enabled.com.liferay.portal.model.LayoutSetPrototype"),
089 true);
090 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
091 "value.object.finder.cache.enabled.com.liferay.portal.model.LayoutSetPrototype"),
092 true);
093 public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
094 "value.object.column.bitmask.enabled.com.liferay.portal.model.LayoutSetPrototype"),
095 true);
096 public static long ACTIVE_COLUMN_BITMASK = 1L;
097 public static long COMPANYID_COLUMN_BITMASK = 2L;
098 public static long UUID_COLUMN_BITMASK = 4L;
099 public static long LAYOUTSETPROTOTYPEID_COLUMN_BITMASK = 8L;
100
101
107 public static LayoutSetPrototype toModel(LayoutSetPrototypeSoap soapModel) {
108 if (soapModel == null) {
109 return null;
110 }
111
112 LayoutSetPrototype model = new LayoutSetPrototypeImpl();
113
114 model.setUuid(soapModel.getUuid());
115 model.setLayoutSetPrototypeId(soapModel.getLayoutSetPrototypeId());
116 model.setCompanyId(soapModel.getCompanyId());
117 model.setCreateDate(soapModel.getCreateDate());
118 model.setModifiedDate(soapModel.getModifiedDate());
119 model.setName(soapModel.getName());
120 model.setDescription(soapModel.getDescription());
121 model.setSettings(soapModel.getSettings());
122 model.setActive(soapModel.getActive());
123
124 return model;
125 }
126
127
133 public static List<LayoutSetPrototype> toModels(
134 LayoutSetPrototypeSoap[] soapModels) {
135 if (soapModels == null) {
136 return null;
137 }
138
139 List<LayoutSetPrototype> models = new ArrayList<LayoutSetPrototype>(soapModels.length);
140
141 for (LayoutSetPrototypeSoap soapModel : soapModels) {
142 models.add(toModel(soapModel));
143 }
144
145 return models;
146 }
147
148 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
149 "lock.expiration.time.com.liferay.portal.model.LayoutSetPrototype"));
150
151 public LayoutSetPrototypeModelImpl() {
152 }
153
154 public long getPrimaryKey() {
155 return _layoutSetPrototypeId;
156 }
157
158 public void setPrimaryKey(long primaryKey) {
159 setLayoutSetPrototypeId(primaryKey);
160 }
161
162 public Serializable getPrimaryKeyObj() {
163 return new Long(_layoutSetPrototypeId);
164 }
165
166 public void setPrimaryKeyObj(Serializable primaryKeyObj) {
167 setPrimaryKey(((Long)primaryKeyObj).longValue());
168 }
169
170 public Class<?> getModelClass() {
171 return LayoutSetPrototype.class;
172 }
173
174 public String getModelClassName() {
175 return LayoutSetPrototype.class.getName();
176 }
177
178 @Override
179 public Map<String, Object> getModelAttributes() {
180 Map<String, Object> attributes = new HashMap<String, Object>();
181
182 attributes.put("uuid", getUuid());
183 attributes.put("layoutSetPrototypeId", getLayoutSetPrototypeId());
184 attributes.put("companyId", getCompanyId());
185 attributes.put("createDate", getCreateDate());
186 attributes.put("modifiedDate", getModifiedDate());
187 attributes.put("name", getName());
188 attributes.put("description", getDescription());
189 attributes.put("settings", getSettings());
190 attributes.put("active", getActive());
191
192 return attributes;
193 }
194
195 @Override
196 public void setModelAttributes(Map<String, Object> attributes) {
197 String uuid = (String)attributes.get("uuid");
198
199 if (uuid != null) {
200 setUuid(uuid);
201 }
202
203 Long layoutSetPrototypeId = (Long)attributes.get("layoutSetPrototypeId");
204
205 if (layoutSetPrototypeId != null) {
206 setLayoutSetPrototypeId(layoutSetPrototypeId);
207 }
208
209 Long companyId = (Long)attributes.get("companyId");
210
211 if (companyId != null) {
212 setCompanyId(companyId);
213 }
214
215 Date createDate = (Date)attributes.get("createDate");
216
217 if (createDate != null) {
218 setCreateDate(createDate);
219 }
220
221 Date modifiedDate = (Date)attributes.get("modifiedDate");
222
223 if (modifiedDate != null) {
224 setModifiedDate(modifiedDate);
225 }
226
227 String name = (String)attributes.get("name");
228
229 if (name != null) {
230 setName(name);
231 }
232
233 String description = (String)attributes.get("description");
234
235 if (description != null) {
236 setDescription(description);
237 }
238
239 String settings = (String)attributes.get("settings");
240
241 if (settings != null) {
242 setSettings(settings);
243 }
244
245 Boolean active = (Boolean)attributes.get("active");
246
247 if (active != null) {
248 setActive(active);
249 }
250 }
251
252 @JSON
253 public String getUuid() {
254 if (_uuid == null) {
255 return StringPool.BLANK;
256 }
257 else {
258 return _uuid;
259 }
260 }
261
262 public void setUuid(String uuid) {
263 if (_originalUuid == null) {
264 _originalUuid = _uuid;
265 }
266
267 _uuid = uuid;
268 }
269
270 public String getOriginalUuid() {
271 return GetterUtil.getString(_originalUuid);
272 }
273
274 @JSON
275 public long getLayoutSetPrototypeId() {
276 return _layoutSetPrototypeId;
277 }
278
279 public void setLayoutSetPrototypeId(long layoutSetPrototypeId) {
280 _layoutSetPrototypeId = layoutSetPrototypeId;
281 }
282
283 @JSON
284 public long getCompanyId() {
285 return _companyId;
286 }
287
288 public void setCompanyId(long companyId) {
289 _columnBitmask |= COMPANYID_COLUMN_BITMASK;
290
291 if (!_setOriginalCompanyId) {
292 _setOriginalCompanyId = true;
293
294 _originalCompanyId = _companyId;
295 }
296
297 _companyId = companyId;
298 }
299
300 public long getOriginalCompanyId() {
301 return _originalCompanyId;
302 }
303
304 @JSON
305 public Date getCreateDate() {
306 return _createDate;
307 }
308
309 public void setCreateDate(Date createDate) {
310 _createDate = createDate;
311 }
312
313 @JSON
314 public Date getModifiedDate() {
315 return _modifiedDate;
316 }
317
318 public void setModifiedDate(Date modifiedDate) {
319 _modifiedDate = modifiedDate;
320 }
321
322 @JSON
323 public String getName() {
324 if (_name == null) {
325 return StringPool.BLANK;
326 }
327 else {
328 return _name;
329 }
330 }
331
332 public String getName(Locale locale) {
333 String languageId = LocaleUtil.toLanguageId(locale);
334
335 return getName(languageId);
336 }
337
338 public String getName(Locale locale, boolean useDefault) {
339 String languageId = LocaleUtil.toLanguageId(locale);
340
341 return getName(languageId, useDefault);
342 }
343
344 public String getName(String languageId) {
345 return LocalizationUtil.getLocalization(getName(), languageId);
346 }
347
348 public String getName(String languageId, boolean useDefault) {
349 return LocalizationUtil.getLocalization(getName(), languageId,
350 useDefault);
351 }
352
353 public String getNameCurrentLanguageId() {
354 return _nameCurrentLanguageId;
355 }
356
357 @JSON
358 public String getNameCurrentValue() {
359 Locale locale = getLocale(_nameCurrentLanguageId);
360
361 return getName(locale);
362 }
363
364 public Map<Locale, String> getNameMap() {
365 return LocalizationUtil.getLocalizationMap(getName());
366 }
367
368 public void setName(String name) {
369 _name = name;
370 }
371
372 public void setName(String name, Locale locale) {
373 setName(name, locale, LocaleUtil.getDefault());
374 }
375
376 public void setName(String name, Locale locale, Locale defaultLocale) {
377 String languageId = LocaleUtil.toLanguageId(locale);
378 String defaultLanguageId = LocaleUtil.toLanguageId(defaultLocale);
379
380 if (Validator.isNotNull(name)) {
381 setName(LocalizationUtil.updateLocalization(getName(), "Name",
382 name, languageId, defaultLanguageId));
383 }
384 else {
385 setName(LocalizationUtil.removeLocalization(getName(), "Name",
386 languageId));
387 }
388 }
389
390 public void setNameCurrentLanguageId(String languageId) {
391 _nameCurrentLanguageId = languageId;
392 }
393
394 public void setNameMap(Map<Locale, String> nameMap) {
395 setNameMap(nameMap, LocaleUtil.getDefault());
396 }
397
398 public void setNameMap(Map<Locale, String> nameMap, Locale defaultLocale) {
399 if (nameMap == null) {
400 return;
401 }
402
403 setName(LocalizationUtil.updateLocalization(nameMap, getName(), "Name",
404 LocaleUtil.toLanguageId(defaultLocale)));
405 }
406
407 @JSON
408 public String getDescription() {
409 if (_description == null) {
410 return StringPool.BLANK;
411 }
412 else {
413 return _description;
414 }
415 }
416
417 public void setDescription(String description) {
418 _description = description;
419 }
420
421 @JSON
422 public String getSettings() {
423 if (_settings == null) {
424 return StringPool.BLANK;
425 }
426 else {
427 return _settings;
428 }
429 }
430
431 public void setSettings(String settings) {
432 _settings = settings;
433 }
434
435 @JSON
436 public boolean getActive() {
437 return _active;
438 }
439
440 public boolean isActive() {
441 return _active;
442 }
443
444 public void setActive(boolean active) {
445 _columnBitmask |= ACTIVE_COLUMN_BITMASK;
446
447 if (!_setOriginalActive) {
448 _setOriginalActive = true;
449
450 _originalActive = _active;
451 }
452
453 _active = active;
454 }
455
456 public boolean getOriginalActive() {
457 return _originalActive;
458 }
459
460 public long getColumnBitmask() {
461 return _columnBitmask;
462 }
463
464 @Override
465 public ExpandoBridge getExpandoBridge() {
466 return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
467 LayoutSetPrototype.class.getName(), getPrimaryKey());
468 }
469
470 @Override
471 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
472 ExpandoBridge expandoBridge = getExpandoBridge();
473
474 expandoBridge.setAttributes(serviceContext);
475 }
476
477 @SuppressWarnings("unused")
478 public void prepareLocalizedFieldsForImport(Locale defaultImportLocale)
479 throws LocaleException {
480 setName(getName(defaultImportLocale), defaultImportLocale,
481 defaultImportLocale);
482 }
483
484 @Override
485 public LayoutSetPrototype toEscapedModel() {
486 if (_escapedModel == null) {
487 _escapedModel = (LayoutSetPrototype)ProxyUtil.newProxyInstance(_classLoader,
488 _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
489 }
490
491 return _escapedModel;
492 }
493
494 @Override
495 public Object clone() {
496 LayoutSetPrototypeImpl layoutSetPrototypeImpl = new LayoutSetPrototypeImpl();
497
498 layoutSetPrototypeImpl.setUuid(getUuid());
499 layoutSetPrototypeImpl.setLayoutSetPrototypeId(getLayoutSetPrototypeId());
500 layoutSetPrototypeImpl.setCompanyId(getCompanyId());
501 layoutSetPrototypeImpl.setCreateDate(getCreateDate());
502 layoutSetPrototypeImpl.setModifiedDate(getModifiedDate());
503 layoutSetPrototypeImpl.setName(getName());
504 layoutSetPrototypeImpl.setDescription(getDescription());
505 layoutSetPrototypeImpl.setSettings(getSettings());
506 layoutSetPrototypeImpl.setActive(getActive());
507
508 layoutSetPrototypeImpl.resetOriginalValues();
509
510 return layoutSetPrototypeImpl;
511 }
512
513 public int compareTo(LayoutSetPrototype layoutSetPrototype) {
514 long primaryKey = layoutSetPrototype.getPrimaryKey();
515
516 if (getPrimaryKey() < primaryKey) {
517 return -1;
518 }
519 else if (getPrimaryKey() > primaryKey) {
520 return 1;
521 }
522 else {
523 return 0;
524 }
525 }
526
527 @Override
528 public boolean equals(Object obj) {
529 if (obj == null) {
530 return false;
531 }
532
533 LayoutSetPrototype layoutSetPrototype = null;
534
535 try {
536 layoutSetPrototype = (LayoutSetPrototype)obj;
537 }
538 catch (ClassCastException cce) {
539 return false;
540 }
541
542 long primaryKey = layoutSetPrototype.getPrimaryKey();
543
544 if (getPrimaryKey() == primaryKey) {
545 return true;
546 }
547 else {
548 return false;
549 }
550 }
551
552 @Override
553 public int hashCode() {
554 return (int)getPrimaryKey();
555 }
556
557 @Override
558 public void resetOriginalValues() {
559 LayoutSetPrototypeModelImpl layoutSetPrototypeModelImpl = this;
560
561 layoutSetPrototypeModelImpl._originalUuid = layoutSetPrototypeModelImpl._uuid;
562
563 layoutSetPrototypeModelImpl._originalCompanyId = layoutSetPrototypeModelImpl._companyId;
564
565 layoutSetPrototypeModelImpl._setOriginalCompanyId = false;
566
567 layoutSetPrototypeModelImpl._originalActive = layoutSetPrototypeModelImpl._active;
568
569 layoutSetPrototypeModelImpl._setOriginalActive = false;
570
571 layoutSetPrototypeModelImpl._columnBitmask = 0;
572 }
573
574 @Override
575 public CacheModel<LayoutSetPrototype> toCacheModel() {
576 LayoutSetPrototypeCacheModel layoutSetPrototypeCacheModel = new LayoutSetPrototypeCacheModel();
577
578 layoutSetPrototypeCacheModel.uuid = getUuid();
579
580 String uuid = layoutSetPrototypeCacheModel.uuid;
581
582 if ((uuid != null) && (uuid.length() == 0)) {
583 layoutSetPrototypeCacheModel.uuid = null;
584 }
585
586 layoutSetPrototypeCacheModel.layoutSetPrototypeId = getLayoutSetPrototypeId();
587
588 layoutSetPrototypeCacheModel.companyId = getCompanyId();
589
590 Date createDate = getCreateDate();
591
592 if (createDate != null) {
593 layoutSetPrototypeCacheModel.createDate = createDate.getTime();
594 }
595 else {
596 layoutSetPrototypeCacheModel.createDate = Long.MIN_VALUE;
597 }
598
599 Date modifiedDate = getModifiedDate();
600
601 if (modifiedDate != null) {
602 layoutSetPrototypeCacheModel.modifiedDate = modifiedDate.getTime();
603 }
604 else {
605 layoutSetPrototypeCacheModel.modifiedDate = Long.MIN_VALUE;
606 }
607
608 layoutSetPrototypeCacheModel.name = getName();
609
610 String name = layoutSetPrototypeCacheModel.name;
611
612 if ((name != null) && (name.length() == 0)) {
613 layoutSetPrototypeCacheModel.name = null;
614 }
615
616 layoutSetPrototypeCacheModel.description = getDescription();
617
618 String description = layoutSetPrototypeCacheModel.description;
619
620 if ((description != null) && (description.length() == 0)) {
621 layoutSetPrototypeCacheModel.description = null;
622 }
623
624 layoutSetPrototypeCacheModel.settings = getSettings();
625
626 String settings = layoutSetPrototypeCacheModel.settings;
627
628 if ((settings != null) && (settings.length() == 0)) {
629 layoutSetPrototypeCacheModel.settings = null;
630 }
631
632 layoutSetPrototypeCacheModel.active = getActive();
633
634 return layoutSetPrototypeCacheModel;
635 }
636
637 @Override
638 public String toString() {
639 StringBundler sb = new StringBundler(19);
640
641 sb.append("{uuid=");
642 sb.append(getUuid());
643 sb.append(", layoutSetPrototypeId=");
644 sb.append(getLayoutSetPrototypeId());
645 sb.append(", companyId=");
646 sb.append(getCompanyId());
647 sb.append(", createDate=");
648 sb.append(getCreateDate());
649 sb.append(", modifiedDate=");
650 sb.append(getModifiedDate());
651 sb.append(", name=");
652 sb.append(getName());
653 sb.append(", description=");
654 sb.append(getDescription());
655 sb.append(", settings=");
656 sb.append(getSettings());
657 sb.append(", active=");
658 sb.append(getActive());
659 sb.append("}");
660
661 return sb.toString();
662 }
663
664 public String toXmlString() {
665 StringBundler sb = new StringBundler(31);
666
667 sb.append("<model><model-name>");
668 sb.append("com.liferay.portal.model.LayoutSetPrototype");
669 sb.append("</model-name>");
670
671 sb.append(
672 "<column><column-name>uuid</column-name><column-value><![CDATA[");
673 sb.append(getUuid());
674 sb.append("]]></column-value></column>");
675 sb.append(
676 "<column><column-name>layoutSetPrototypeId</column-name><column-value><![CDATA[");
677 sb.append(getLayoutSetPrototypeId());
678 sb.append("]]></column-value></column>");
679 sb.append(
680 "<column><column-name>companyId</column-name><column-value><![CDATA[");
681 sb.append(getCompanyId());
682 sb.append("]]></column-value></column>");
683 sb.append(
684 "<column><column-name>createDate</column-name><column-value><![CDATA[");
685 sb.append(getCreateDate());
686 sb.append("]]></column-value></column>");
687 sb.append(
688 "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
689 sb.append(getModifiedDate());
690 sb.append("]]></column-value></column>");
691 sb.append(
692 "<column><column-name>name</column-name><column-value><![CDATA[");
693 sb.append(getName());
694 sb.append("]]></column-value></column>");
695 sb.append(
696 "<column><column-name>description</column-name><column-value><![CDATA[");
697 sb.append(getDescription());
698 sb.append("]]></column-value></column>");
699 sb.append(
700 "<column><column-name>settings</column-name><column-value><![CDATA[");
701 sb.append(getSettings());
702 sb.append("]]></column-value></column>");
703 sb.append(
704 "<column><column-name>active</column-name><column-value><![CDATA[");
705 sb.append(getActive());
706 sb.append("]]></column-value></column>");
707
708 sb.append("</model>");
709
710 return sb.toString();
711 }
712
713 private static ClassLoader _classLoader = LayoutSetPrototype.class.getClassLoader();
714 private static Class<?>[] _escapedModelInterfaces = new Class[] {
715 LayoutSetPrototype.class
716 };
717 private String _uuid;
718 private String _originalUuid;
719 private long _layoutSetPrototypeId;
720 private long _companyId;
721 private long _originalCompanyId;
722 private boolean _setOriginalCompanyId;
723 private Date _createDate;
724 private Date _modifiedDate;
725 private String _name;
726 private String _nameCurrentLanguageId;
727 private String _description;
728 private String _settings;
729 private boolean _active;
730 private boolean _originalActive;
731 private boolean _setOriginalActive;
732 private long _columnBitmask;
733 private LayoutSetPrototype _escapedModel;
734 }