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