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