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