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