001
014
015 package com.liferay.portlet.asset.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.asset.model.AssetCategoryProperty;
030 import com.liferay.portlet.asset.model.AssetCategoryPropertyModel;
031 import com.liferay.portlet.asset.model.AssetCategoryPropertySoap;
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 AssetCategoryPropertyModelImpl extends BaseModelImpl<AssetCategoryProperty>
060 implements AssetCategoryPropertyModel {
061
066 public static final String TABLE_NAME = "AssetCategoryProperty";
067 public static final Object[][] TABLE_COLUMNS = {
068 { "categoryPropertyId", Types.BIGINT },
069 { "companyId", Types.BIGINT },
070 { "userId", Types.BIGINT },
071 { "userName", Types.VARCHAR },
072 { "createDate", Types.TIMESTAMP },
073 { "modifiedDate", Types.TIMESTAMP },
074 { "categoryId", Types.BIGINT },
075 { "key_", Types.VARCHAR },
076 { "value", Types.VARCHAR }
077 };
078 public static final String TABLE_SQL_CREATE = "create table AssetCategoryProperty (categoryPropertyId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,categoryId LONG,key_ VARCHAR(75) null,value VARCHAR(75) null)";
079 public static final String TABLE_SQL_DROP = "drop table AssetCategoryProperty";
080 public static final String ORDER_BY_JPQL = " ORDER BY assetCategoryProperty.key ASC";
081 public static final String ORDER_BY_SQL = " ORDER BY AssetCategoryProperty.key_ ASC";
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.portlet.asset.model.AssetCategoryProperty"),
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.portlet.asset.model.AssetCategoryProperty"),
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.portlet.asset.model.AssetCategoryProperty"),
093 true);
094 public static long CATEGORYID_COLUMN_BITMASK = 1L;
095 public static long COMPANYID_COLUMN_BITMASK = 2L;
096 public static long KEY_COLUMN_BITMASK = 4L;
097
098
104 public static AssetCategoryProperty toModel(
105 AssetCategoryPropertySoap soapModel) {
106 if (soapModel == null) {
107 return null;
108 }
109
110 AssetCategoryProperty model = new AssetCategoryPropertyImpl();
111
112 model.setCategoryPropertyId(soapModel.getCategoryPropertyId());
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.setCategoryId(soapModel.getCategoryId());
119 model.setKey(soapModel.getKey());
120 model.setValue(soapModel.getValue());
121
122 return model;
123 }
124
125
131 public static List<AssetCategoryProperty> toModels(
132 AssetCategoryPropertySoap[] soapModels) {
133 if (soapModels == null) {
134 return null;
135 }
136
137 List<AssetCategoryProperty> models = new ArrayList<AssetCategoryProperty>(soapModels.length);
138
139 for (AssetCategoryPropertySoap soapModel : soapModels) {
140 models.add(toModel(soapModel));
141 }
142
143 return models;
144 }
145
146 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
147 "lock.expiration.time.com.liferay.portlet.asset.model.AssetCategoryProperty"));
148
149 public AssetCategoryPropertyModelImpl() {
150 }
151
152 public long getPrimaryKey() {
153 return _categoryPropertyId;
154 }
155
156 public void setPrimaryKey(long primaryKey) {
157 setCategoryPropertyId(primaryKey);
158 }
159
160 public Serializable getPrimaryKeyObj() {
161 return new Long(_categoryPropertyId);
162 }
163
164 public void setPrimaryKeyObj(Serializable primaryKeyObj) {
165 setPrimaryKey(((Long)primaryKeyObj).longValue());
166 }
167
168 public Class<?> getModelClass() {
169 return AssetCategoryProperty.class;
170 }
171
172 public String getModelClassName() {
173 return AssetCategoryProperty.class.getName();
174 }
175
176 @Override
177 public Map<String, Object> getModelAttributes() {
178 Map<String, Object> attributes = new HashMap<String, Object>();
179
180 attributes.put("categoryPropertyId", getCategoryPropertyId());
181 attributes.put("companyId", getCompanyId());
182 attributes.put("userId", getUserId());
183 attributes.put("userName", getUserName());
184 attributes.put("createDate", getCreateDate());
185 attributes.put("modifiedDate", getModifiedDate());
186 attributes.put("categoryId", getCategoryId());
187 attributes.put("key", getKey());
188 attributes.put("value", getValue());
189
190 return attributes;
191 }
192
193 @Override
194 public void setModelAttributes(Map<String, Object> attributes) {
195 Long categoryPropertyId = (Long)attributes.get("categoryPropertyId");
196
197 if (categoryPropertyId != null) {
198 setCategoryPropertyId(categoryPropertyId);
199 }
200
201 Long companyId = (Long)attributes.get("companyId");
202
203 if (companyId != null) {
204 setCompanyId(companyId);
205 }
206
207 Long userId = (Long)attributes.get("userId");
208
209 if (userId != null) {
210 setUserId(userId);
211 }
212
213 String userName = (String)attributes.get("userName");
214
215 if (userName != null) {
216 setUserName(userName);
217 }
218
219 Date createDate = (Date)attributes.get("createDate");
220
221 if (createDate != null) {
222 setCreateDate(createDate);
223 }
224
225 Date modifiedDate = (Date)attributes.get("modifiedDate");
226
227 if (modifiedDate != null) {
228 setModifiedDate(modifiedDate);
229 }
230
231 Long categoryId = (Long)attributes.get("categoryId");
232
233 if (categoryId != null) {
234 setCategoryId(categoryId);
235 }
236
237 String key = (String)attributes.get("key");
238
239 if (key != null) {
240 setKey(key);
241 }
242
243 String value = (String)attributes.get("value");
244
245 if (value != null) {
246 setValue(value);
247 }
248 }
249
250 @JSON
251 public long getCategoryPropertyId() {
252 return _categoryPropertyId;
253 }
254
255 public void setCategoryPropertyId(long categoryPropertyId) {
256 _categoryPropertyId = categoryPropertyId;
257 }
258
259 @JSON
260 public long getCompanyId() {
261 return _companyId;
262 }
263
264 public void setCompanyId(long companyId) {
265 _columnBitmask |= COMPANYID_COLUMN_BITMASK;
266
267 if (!_setOriginalCompanyId) {
268 _setOriginalCompanyId = true;
269
270 _originalCompanyId = _companyId;
271 }
272
273 _companyId = companyId;
274 }
275
276 public long getOriginalCompanyId() {
277 return _originalCompanyId;
278 }
279
280 @JSON
281 public long getUserId() {
282 return _userId;
283 }
284
285 public void setUserId(long userId) {
286 _userId = userId;
287 }
288
289 public String getUserUuid() throws SystemException {
290 return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
291 }
292
293 public void setUserUuid(String userUuid) {
294 _userUuid = userUuid;
295 }
296
297 @JSON
298 public String getUserName() {
299 if (_userName == null) {
300 return StringPool.BLANK;
301 }
302 else {
303 return _userName;
304 }
305 }
306
307 public void setUserName(String userName) {
308 _userName = userName;
309 }
310
311 @JSON
312 public Date getCreateDate() {
313 return _createDate;
314 }
315
316 public void setCreateDate(Date createDate) {
317 _createDate = createDate;
318 }
319
320 @JSON
321 public Date getModifiedDate() {
322 return _modifiedDate;
323 }
324
325 public void setModifiedDate(Date modifiedDate) {
326 _modifiedDate = modifiedDate;
327 }
328
329 @JSON
330 public long getCategoryId() {
331 return _categoryId;
332 }
333
334 public void setCategoryId(long categoryId) {
335 _columnBitmask |= CATEGORYID_COLUMN_BITMASK;
336
337 if (!_setOriginalCategoryId) {
338 _setOriginalCategoryId = true;
339
340 _originalCategoryId = _categoryId;
341 }
342
343 _categoryId = categoryId;
344 }
345
346 public long getOriginalCategoryId() {
347 return _originalCategoryId;
348 }
349
350 @JSON
351 public String getKey() {
352 if (_key == null) {
353 return StringPool.BLANK;
354 }
355 else {
356 return _key;
357 }
358 }
359
360 public void setKey(String key) {
361 _columnBitmask = -1L;
362
363 if (_originalKey == null) {
364 _originalKey = _key;
365 }
366
367 _key = key;
368 }
369
370 public String getOriginalKey() {
371 return GetterUtil.getString(_originalKey);
372 }
373
374 @JSON
375 public String getValue() {
376 if (_value == null) {
377 return StringPool.BLANK;
378 }
379 else {
380 return _value;
381 }
382 }
383
384 public void setValue(String value) {
385 _value = value;
386 }
387
388 public long getColumnBitmask() {
389 return _columnBitmask;
390 }
391
392 @Override
393 public ExpandoBridge getExpandoBridge() {
394 return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
395 AssetCategoryProperty.class.getName(), getPrimaryKey());
396 }
397
398 @Override
399 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
400 ExpandoBridge expandoBridge = getExpandoBridge();
401
402 expandoBridge.setAttributes(serviceContext);
403 }
404
405 @Override
406 public AssetCategoryProperty toEscapedModel() {
407 if (_escapedModelProxy == null) {
408 _escapedModelProxy = (AssetCategoryProperty)ProxyUtil.newProxyInstance(_classLoader,
409 _escapedModelProxyInterfaces,
410 new AutoEscapeBeanHandler(this));
411 }
412
413 return _escapedModelProxy;
414 }
415
416 @Override
417 public Object clone() {
418 AssetCategoryPropertyImpl assetCategoryPropertyImpl = new AssetCategoryPropertyImpl();
419
420 assetCategoryPropertyImpl.setCategoryPropertyId(getCategoryPropertyId());
421 assetCategoryPropertyImpl.setCompanyId(getCompanyId());
422 assetCategoryPropertyImpl.setUserId(getUserId());
423 assetCategoryPropertyImpl.setUserName(getUserName());
424 assetCategoryPropertyImpl.setCreateDate(getCreateDate());
425 assetCategoryPropertyImpl.setModifiedDate(getModifiedDate());
426 assetCategoryPropertyImpl.setCategoryId(getCategoryId());
427 assetCategoryPropertyImpl.setKey(getKey());
428 assetCategoryPropertyImpl.setValue(getValue());
429
430 assetCategoryPropertyImpl.resetOriginalValues();
431
432 return assetCategoryPropertyImpl;
433 }
434
435 public int compareTo(AssetCategoryProperty assetCategoryProperty) {
436 int value = 0;
437
438 value = getKey().compareTo(assetCategoryProperty.getKey());
439
440 if (value != 0) {
441 return value;
442 }
443
444 return 0;
445 }
446
447 @Override
448 public boolean equals(Object obj) {
449 if (obj == null) {
450 return false;
451 }
452
453 AssetCategoryProperty assetCategoryProperty = null;
454
455 try {
456 assetCategoryProperty = (AssetCategoryProperty)obj;
457 }
458 catch (ClassCastException cce) {
459 return false;
460 }
461
462 long primaryKey = assetCategoryProperty.getPrimaryKey();
463
464 if (getPrimaryKey() == primaryKey) {
465 return true;
466 }
467 else {
468 return false;
469 }
470 }
471
472 @Override
473 public int hashCode() {
474 return (int)getPrimaryKey();
475 }
476
477 @Override
478 public void resetOriginalValues() {
479 AssetCategoryPropertyModelImpl assetCategoryPropertyModelImpl = this;
480
481 assetCategoryPropertyModelImpl._originalCompanyId = assetCategoryPropertyModelImpl._companyId;
482
483 assetCategoryPropertyModelImpl._setOriginalCompanyId = false;
484
485 assetCategoryPropertyModelImpl._originalCategoryId = assetCategoryPropertyModelImpl._categoryId;
486
487 assetCategoryPropertyModelImpl._setOriginalCategoryId = false;
488
489 assetCategoryPropertyModelImpl._originalKey = assetCategoryPropertyModelImpl._key;
490
491 assetCategoryPropertyModelImpl._columnBitmask = 0;
492 }
493
494 @Override
495 public CacheModel<AssetCategoryProperty> toCacheModel() {
496 AssetCategoryPropertyCacheModel assetCategoryPropertyCacheModel = new AssetCategoryPropertyCacheModel();
497
498 assetCategoryPropertyCacheModel.categoryPropertyId = getCategoryPropertyId();
499
500 assetCategoryPropertyCacheModel.companyId = getCompanyId();
501
502 assetCategoryPropertyCacheModel.userId = getUserId();
503
504 assetCategoryPropertyCacheModel.userName = getUserName();
505
506 String userName = assetCategoryPropertyCacheModel.userName;
507
508 if ((userName != null) && (userName.length() == 0)) {
509 assetCategoryPropertyCacheModel.userName = null;
510 }
511
512 Date createDate = getCreateDate();
513
514 if (createDate != null) {
515 assetCategoryPropertyCacheModel.createDate = createDate.getTime();
516 }
517 else {
518 assetCategoryPropertyCacheModel.createDate = Long.MIN_VALUE;
519 }
520
521 Date modifiedDate = getModifiedDate();
522
523 if (modifiedDate != null) {
524 assetCategoryPropertyCacheModel.modifiedDate = modifiedDate.getTime();
525 }
526 else {
527 assetCategoryPropertyCacheModel.modifiedDate = Long.MIN_VALUE;
528 }
529
530 assetCategoryPropertyCacheModel.categoryId = getCategoryId();
531
532 assetCategoryPropertyCacheModel.key = getKey();
533
534 String key = assetCategoryPropertyCacheModel.key;
535
536 if ((key != null) && (key.length() == 0)) {
537 assetCategoryPropertyCacheModel.key = null;
538 }
539
540 assetCategoryPropertyCacheModel.value = getValue();
541
542 String value = assetCategoryPropertyCacheModel.value;
543
544 if ((value != null) && (value.length() == 0)) {
545 assetCategoryPropertyCacheModel.value = null;
546 }
547
548 return assetCategoryPropertyCacheModel;
549 }
550
551 @Override
552 public String toString() {
553 StringBundler sb = new StringBundler(19);
554
555 sb.append("{categoryPropertyId=");
556 sb.append(getCategoryPropertyId());
557 sb.append(", companyId=");
558 sb.append(getCompanyId());
559 sb.append(", userId=");
560 sb.append(getUserId());
561 sb.append(", userName=");
562 sb.append(getUserName());
563 sb.append(", createDate=");
564 sb.append(getCreateDate());
565 sb.append(", modifiedDate=");
566 sb.append(getModifiedDate());
567 sb.append(", categoryId=");
568 sb.append(getCategoryId());
569 sb.append(", key=");
570 sb.append(getKey());
571 sb.append(", value=");
572 sb.append(getValue());
573 sb.append("}");
574
575 return sb.toString();
576 }
577
578 public String toXmlString() {
579 StringBundler sb = new StringBundler(31);
580
581 sb.append("<model><model-name>");
582 sb.append("com.liferay.portlet.asset.model.AssetCategoryProperty");
583 sb.append("</model-name>");
584
585 sb.append(
586 "<column><column-name>categoryPropertyId</column-name><column-value><![CDATA[");
587 sb.append(getCategoryPropertyId());
588 sb.append("]]></column-value></column>");
589 sb.append(
590 "<column><column-name>companyId</column-name><column-value><![CDATA[");
591 sb.append(getCompanyId());
592 sb.append("]]></column-value></column>");
593 sb.append(
594 "<column><column-name>userId</column-name><column-value><![CDATA[");
595 sb.append(getUserId());
596 sb.append("]]></column-value></column>");
597 sb.append(
598 "<column><column-name>userName</column-name><column-value><![CDATA[");
599 sb.append(getUserName());
600 sb.append("]]></column-value></column>");
601 sb.append(
602 "<column><column-name>createDate</column-name><column-value><![CDATA[");
603 sb.append(getCreateDate());
604 sb.append("]]></column-value></column>");
605 sb.append(
606 "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
607 sb.append(getModifiedDate());
608 sb.append("]]></column-value></column>");
609 sb.append(
610 "<column><column-name>categoryId</column-name><column-value><![CDATA[");
611 sb.append(getCategoryId());
612 sb.append("]]></column-value></column>");
613 sb.append(
614 "<column><column-name>key</column-name><column-value><![CDATA[");
615 sb.append(getKey());
616 sb.append("]]></column-value></column>");
617 sb.append(
618 "<column><column-name>value</column-name><column-value><![CDATA[");
619 sb.append(getValue());
620 sb.append("]]></column-value></column>");
621
622 sb.append("</model>");
623
624 return sb.toString();
625 }
626
627 private static ClassLoader _classLoader = AssetCategoryProperty.class.getClassLoader();
628 private static Class<?>[] _escapedModelProxyInterfaces = new Class[] {
629 AssetCategoryProperty.class
630 };
631 private long _categoryPropertyId;
632 private long _companyId;
633 private long _originalCompanyId;
634 private boolean _setOriginalCompanyId;
635 private long _userId;
636 private String _userUuid;
637 private String _userName;
638 private Date _createDate;
639 private Date _modifiedDate;
640 private long _categoryId;
641 private long _originalCategoryId;
642 private boolean _setOriginalCategoryId;
643 private String _key;
644 private String _originalKey;
645 private String _value;
646 private long _columnBitmask;
647 private AssetCategoryProperty _escapedModelProxy;
648 }