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