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