001
014
015 package com.liferay.portal.model.impl;
016
017 import aQute.bnd.annotation.ProviderType;
018
019 import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
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.kernel.util.Validator;
025 import com.liferay.portal.model.CacheModel;
026 import com.liferay.portal.model.WebDAVProps;
027 import com.liferay.portal.model.WebDAVPropsModel;
028 import com.liferay.portal.service.ServiceContext;
029 import com.liferay.portal.util.PortalUtil;
030
031 import com.liferay.portlet.expando.model.ExpandoBridge;
032 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
033
034 import java.io.Serializable;
035
036 import java.sql.Types;
037
038 import java.util.Date;
039 import java.util.HashMap;
040 import java.util.Map;
041
042
055 @ProviderType
056 public class WebDAVPropsModelImpl extends BaseModelImpl<WebDAVProps>
057 implements WebDAVPropsModel {
058
063 public static final String TABLE_NAME = "WebDAVProps";
064 public static final Object[][] TABLE_COLUMNS = {
065 { "mvccVersion", Types.BIGINT },
066 { "webDavPropsId", Types.BIGINT },
067 { "companyId", Types.BIGINT },
068 { "createDate", Types.TIMESTAMP },
069 { "modifiedDate", Types.TIMESTAMP },
070 { "classNameId", Types.BIGINT },
071 { "classPK", Types.BIGINT },
072 { "props", Types.CLOB }
073 };
074 public static final Map<String, Integer> TABLE_COLUMNS_MAP = new HashMap<String, Integer>();
075
076 static {
077 TABLE_COLUMNS_MAP.put("mvccVersion", Types.BIGINT);
078 TABLE_COLUMNS_MAP.put("webDavPropsId", Types.BIGINT);
079 TABLE_COLUMNS_MAP.put("companyId", Types.BIGINT);
080 TABLE_COLUMNS_MAP.put("createDate", Types.TIMESTAMP);
081 TABLE_COLUMNS_MAP.put("modifiedDate", Types.TIMESTAMP);
082 TABLE_COLUMNS_MAP.put("classNameId", Types.BIGINT);
083 TABLE_COLUMNS_MAP.put("classPK", Types.BIGINT);
084 TABLE_COLUMNS_MAP.put("props", Types.CLOB);
085 }
086
087 public static final String TABLE_SQL_CREATE = "create table WebDAVProps (mvccVersion LONG default 0,webDavPropsId LONG not null primary key,companyId LONG,createDate DATE null,modifiedDate DATE null,classNameId LONG,classPK LONG,props TEXT null)";
088 public static final String TABLE_SQL_DROP = "drop table WebDAVProps";
089 public static final String ORDER_BY_JPQL = " ORDER BY webDAVProps.webDavPropsId ASC";
090 public static final String ORDER_BY_SQL = " ORDER BY WebDAVProps.webDavPropsId ASC";
091 public static final String DATA_SOURCE = "liferayDataSource";
092 public static final String SESSION_FACTORY = "liferaySessionFactory";
093 public static final String TX_MANAGER = "liferayTransactionManager";
094 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
095 "value.object.entity.cache.enabled.com.liferay.portal.model.WebDAVProps"),
096 true);
097 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
098 "value.object.finder.cache.enabled.com.liferay.portal.model.WebDAVProps"),
099 true);
100 public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
101 "value.object.column.bitmask.enabled.com.liferay.portal.model.WebDAVProps"),
102 true);
103 public static final long CLASSNAMEID_COLUMN_BITMASK = 1L;
104 public static final long CLASSPK_COLUMN_BITMASK = 2L;
105 public static final long WEBDAVPROPSID_COLUMN_BITMASK = 4L;
106 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
107 "lock.expiration.time.com.liferay.portal.model.WebDAVProps"));
108
109 public WebDAVPropsModelImpl() {
110 }
111
112 @Override
113 public long getPrimaryKey() {
114 return _webDavPropsId;
115 }
116
117 @Override
118 public void setPrimaryKey(long primaryKey) {
119 setWebDavPropsId(primaryKey);
120 }
121
122 @Override
123 public Serializable getPrimaryKeyObj() {
124 return _webDavPropsId;
125 }
126
127 @Override
128 public void setPrimaryKeyObj(Serializable primaryKeyObj) {
129 setPrimaryKey(((Long)primaryKeyObj).longValue());
130 }
131
132 @Override
133 public Class<?> getModelClass() {
134 return WebDAVProps.class;
135 }
136
137 @Override
138 public String getModelClassName() {
139 return WebDAVProps.class.getName();
140 }
141
142 @Override
143 public Map<String, Object> getModelAttributes() {
144 Map<String, Object> attributes = new HashMap<String, Object>();
145
146 attributes.put("mvccVersion", getMvccVersion());
147 attributes.put("webDavPropsId", getWebDavPropsId());
148 attributes.put("companyId", getCompanyId());
149 attributes.put("createDate", getCreateDate());
150 attributes.put("modifiedDate", getModifiedDate());
151 attributes.put("classNameId", getClassNameId());
152 attributes.put("classPK", getClassPK());
153 attributes.put("props", getProps());
154
155 attributes.put("entityCacheEnabled", isEntityCacheEnabled());
156 attributes.put("finderCacheEnabled", isFinderCacheEnabled());
157
158 return attributes;
159 }
160
161 @Override
162 public void setModelAttributes(Map<String, Object> attributes) {
163 Long mvccVersion = (Long)attributes.get("mvccVersion");
164
165 if (mvccVersion != null) {
166 setMvccVersion(mvccVersion);
167 }
168
169 Long webDavPropsId = (Long)attributes.get("webDavPropsId");
170
171 if (webDavPropsId != null) {
172 setWebDavPropsId(webDavPropsId);
173 }
174
175 Long companyId = (Long)attributes.get("companyId");
176
177 if (companyId != null) {
178 setCompanyId(companyId);
179 }
180
181 Date createDate = (Date)attributes.get("createDate");
182
183 if (createDate != null) {
184 setCreateDate(createDate);
185 }
186
187 Date modifiedDate = (Date)attributes.get("modifiedDate");
188
189 if (modifiedDate != null) {
190 setModifiedDate(modifiedDate);
191 }
192
193 Long classNameId = (Long)attributes.get("classNameId");
194
195 if (classNameId != null) {
196 setClassNameId(classNameId);
197 }
198
199 Long classPK = (Long)attributes.get("classPK");
200
201 if (classPK != null) {
202 setClassPK(classPK);
203 }
204
205 String props = (String)attributes.get("props");
206
207 if (props != null) {
208 setProps(props);
209 }
210 }
211
212 @Override
213 public long getMvccVersion() {
214 return _mvccVersion;
215 }
216
217 @Override
218 public void setMvccVersion(long mvccVersion) {
219 _mvccVersion = mvccVersion;
220 }
221
222 @Override
223 public long getWebDavPropsId() {
224 return _webDavPropsId;
225 }
226
227 @Override
228 public void setWebDavPropsId(long webDavPropsId) {
229 _webDavPropsId = webDavPropsId;
230 }
231
232 @Override
233 public long getCompanyId() {
234 return _companyId;
235 }
236
237 @Override
238 public void setCompanyId(long companyId) {
239 _companyId = companyId;
240 }
241
242 @Override
243 public Date getCreateDate() {
244 return _createDate;
245 }
246
247 @Override
248 public void setCreateDate(Date createDate) {
249 _createDate = createDate;
250 }
251
252 @Override
253 public Date getModifiedDate() {
254 return _modifiedDate;
255 }
256
257 public boolean hasSetModifiedDate() {
258 return _setModifiedDate;
259 }
260
261 @Override
262 public void setModifiedDate(Date modifiedDate) {
263 _setModifiedDate = true;
264
265 _modifiedDate = modifiedDate;
266 }
267
268 @Override
269 public String getClassName() {
270 if (getClassNameId() <= 0) {
271 return StringPool.BLANK;
272 }
273
274 return PortalUtil.getClassName(getClassNameId());
275 }
276
277 @Override
278 public void setClassName(String className) {
279 long classNameId = 0;
280
281 if (Validator.isNotNull(className)) {
282 classNameId = PortalUtil.getClassNameId(className);
283 }
284
285 setClassNameId(classNameId);
286 }
287
288 @Override
289 public long getClassNameId() {
290 return _classNameId;
291 }
292
293 @Override
294 public void setClassNameId(long classNameId) {
295 _columnBitmask |= CLASSNAMEID_COLUMN_BITMASK;
296
297 if (!_setOriginalClassNameId) {
298 _setOriginalClassNameId = true;
299
300 _originalClassNameId = _classNameId;
301 }
302
303 _classNameId = classNameId;
304 }
305
306 public long getOriginalClassNameId() {
307 return _originalClassNameId;
308 }
309
310 @Override
311 public long getClassPK() {
312 return _classPK;
313 }
314
315 @Override
316 public void setClassPK(long classPK) {
317 _columnBitmask |= CLASSPK_COLUMN_BITMASK;
318
319 if (!_setOriginalClassPK) {
320 _setOriginalClassPK = true;
321
322 _originalClassPK = _classPK;
323 }
324
325 _classPK = classPK;
326 }
327
328 public long getOriginalClassPK() {
329 return _originalClassPK;
330 }
331
332 @Override
333 public String getProps() {
334 if (_props == null) {
335 return StringPool.BLANK;
336 }
337 else {
338 return _props;
339 }
340 }
341
342 @Override
343 public void setProps(String props) {
344 _props = props;
345 }
346
347 public long getColumnBitmask() {
348 return _columnBitmask;
349 }
350
351 @Override
352 public ExpandoBridge getExpandoBridge() {
353 return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
354 WebDAVProps.class.getName(), getPrimaryKey());
355 }
356
357 @Override
358 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
359 ExpandoBridge expandoBridge = getExpandoBridge();
360
361 expandoBridge.setAttributes(serviceContext);
362 }
363
364 @Override
365 public WebDAVProps toEscapedModel() {
366 if (_escapedModel == null) {
367 _escapedModel = (WebDAVProps)ProxyUtil.newProxyInstance(_classLoader,
368 _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
369 }
370
371 return _escapedModel;
372 }
373
374 @Override
375 public Object clone() {
376 WebDAVPropsImpl webDAVPropsImpl = new WebDAVPropsImpl();
377
378 webDAVPropsImpl.setMvccVersion(getMvccVersion());
379 webDAVPropsImpl.setWebDavPropsId(getWebDavPropsId());
380 webDAVPropsImpl.setCompanyId(getCompanyId());
381 webDAVPropsImpl.setCreateDate(getCreateDate());
382 webDAVPropsImpl.setModifiedDate(getModifiedDate());
383 webDAVPropsImpl.setClassNameId(getClassNameId());
384 webDAVPropsImpl.setClassPK(getClassPK());
385 webDAVPropsImpl.setProps(getProps());
386
387 webDAVPropsImpl.resetOriginalValues();
388
389 return webDAVPropsImpl;
390 }
391
392 @Override
393 public int compareTo(WebDAVProps webDAVProps) {
394 long primaryKey = webDAVProps.getPrimaryKey();
395
396 if (getPrimaryKey() < primaryKey) {
397 return -1;
398 }
399 else if (getPrimaryKey() > primaryKey) {
400 return 1;
401 }
402 else {
403 return 0;
404 }
405 }
406
407 @Override
408 public boolean equals(Object obj) {
409 if (this == obj) {
410 return true;
411 }
412
413 if (!(obj instanceof WebDAVProps)) {
414 return false;
415 }
416
417 WebDAVProps webDAVProps = (WebDAVProps)obj;
418
419 long primaryKey = webDAVProps.getPrimaryKey();
420
421 if (getPrimaryKey() == primaryKey) {
422 return true;
423 }
424 else {
425 return false;
426 }
427 }
428
429 @Override
430 public int hashCode() {
431 return (int)getPrimaryKey();
432 }
433
434 @Override
435 public boolean isEntityCacheEnabled() {
436 return ENTITY_CACHE_ENABLED;
437 }
438
439 @Override
440 public boolean isFinderCacheEnabled() {
441 return FINDER_CACHE_ENABLED;
442 }
443
444 @Override
445 public void resetOriginalValues() {
446 WebDAVPropsModelImpl webDAVPropsModelImpl = this;
447
448 webDAVPropsModelImpl._setModifiedDate = false;
449
450 webDAVPropsModelImpl._originalClassNameId = webDAVPropsModelImpl._classNameId;
451
452 webDAVPropsModelImpl._setOriginalClassNameId = false;
453
454 webDAVPropsModelImpl._originalClassPK = webDAVPropsModelImpl._classPK;
455
456 webDAVPropsModelImpl._setOriginalClassPK = false;
457
458 webDAVPropsModelImpl._columnBitmask = 0;
459 }
460
461 @Override
462 public CacheModel<WebDAVProps> toCacheModel() {
463 WebDAVPropsCacheModel webDAVPropsCacheModel = new WebDAVPropsCacheModel();
464
465 webDAVPropsCacheModel.mvccVersion = getMvccVersion();
466
467 webDAVPropsCacheModel.webDavPropsId = getWebDavPropsId();
468
469 webDAVPropsCacheModel.companyId = getCompanyId();
470
471 Date createDate = getCreateDate();
472
473 if (createDate != null) {
474 webDAVPropsCacheModel.createDate = createDate.getTime();
475 }
476 else {
477 webDAVPropsCacheModel.createDate = Long.MIN_VALUE;
478 }
479
480 Date modifiedDate = getModifiedDate();
481
482 if (modifiedDate != null) {
483 webDAVPropsCacheModel.modifiedDate = modifiedDate.getTime();
484 }
485 else {
486 webDAVPropsCacheModel.modifiedDate = Long.MIN_VALUE;
487 }
488
489 webDAVPropsCacheModel.classNameId = getClassNameId();
490
491 webDAVPropsCacheModel.classPK = getClassPK();
492
493 webDAVPropsCacheModel.props = getProps();
494
495 String props = webDAVPropsCacheModel.props;
496
497 if ((props != null) && (props.length() == 0)) {
498 webDAVPropsCacheModel.props = null;
499 }
500
501 return webDAVPropsCacheModel;
502 }
503
504 @Override
505 public String toString() {
506 StringBundler sb = new StringBundler(17);
507
508 sb.append("{mvccVersion=");
509 sb.append(getMvccVersion());
510 sb.append(", webDavPropsId=");
511 sb.append(getWebDavPropsId());
512 sb.append(", companyId=");
513 sb.append(getCompanyId());
514 sb.append(", createDate=");
515 sb.append(getCreateDate());
516 sb.append(", modifiedDate=");
517 sb.append(getModifiedDate());
518 sb.append(", classNameId=");
519 sb.append(getClassNameId());
520 sb.append(", classPK=");
521 sb.append(getClassPK());
522 sb.append(", props=");
523 sb.append(getProps());
524 sb.append("}");
525
526 return sb.toString();
527 }
528
529 @Override
530 public String toXmlString() {
531 StringBundler sb = new StringBundler(28);
532
533 sb.append("<model><model-name>");
534 sb.append("com.liferay.portal.model.WebDAVProps");
535 sb.append("</model-name>");
536
537 sb.append(
538 "<column><column-name>mvccVersion</column-name><column-value><![CDATA[");
539 sb.append(getMvccVersion());
540 sb.append("]]></column-value></column>");
541 sb.append(
542 "<column><column-name>webDavPropsId</column-name><column-value><![CDATA[");
543 sb.append(getWebDavPropsId());
544 sb.append("]]></column-value></column>");
545 sb.append(
546 "<column><column-name>companyId</column-name><column-value><![CDATA[");
547 sb.append(getCompanyId());
548 sb.append("]]></column-value></column>");
549 sb.append(
550 "<column><column-name>createDate</column-name><column-value><![CDATA[");
551 sb.append(getCreateDate());
552 sb.append("]]></column-value></column>");
553 sb.append(
554 "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
555 sb.append(getModifiedDate());
556 sb.append("]]></column-value></column>");
557 sb.append(
558 "<column><column-name>classNameId</column-name><column-value><![CDATA[");
559 sb.append(getClassNameId());
560 sb.append("]]></column-value></column>");
561 sb.append(
562 "<column><column-name>classPK</column-name><column-value><![CDATA[");
563 sb.append(getClassPK());
564 sb.append("]]></column-value></column>");
565 sb.append(
566 "<column><column-name>props</column-name><column-value><![CDATA[");
567 sb.append(getProps());
568 sb.append("]]></column-value></column>");
569
570 sb.append("</model>");
571
572 return sb.toString();
573 }
574
575 private static final ClassLoader _classLoader = WebDAVProps.class.getClassLoader();
576 private static final Class<?>[] _escapedModelInterfaces = new Class[] {
577 WebDAVProps.class
578 };
579 private long _mvccVersion;
580 private long _webDavPropsId;
581 private long _companyId;
582 private Date _createDate;
583 private Date _modifiedDate;
584 private boolean _setModifiedDate;
585 private long _classNameId;
586 private long _originalClassNameId;
587 private boolean _setOriginalClassNameId;
588 private long _classPK;
589 private long _originalClassPK;
590 private boolean _setOriginalClassPK;
591 private String _props;
592 private long _columnBitmask;
593 private WebDAVProps _escapedModel;
594 }