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