001
014
015 package com.liferay.portal.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.util.GetterUtil;
020 import com.liferay.portal.kernel.util.ProxyUtil;
021 import com.liferay.portal.kernel.util.StringBundler;
022 import com.liferay.portal.kernel.util.StringPool;
023 import com.liferay.portal.model.CacheModel;
024 import com.liferay.portal.model.UserNotificationEvent;
025 import com.liferay.portal.model.UserNotificationEventModel;
026 import com.liferay.portal.service.ServiceContext;
027 import com.liferay.portal.util.PortalUtil;
028
029 import com.liferay.portlet.expando.model.ExpandoBridge;
030 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
031
032 import java.io.Serializable;
033
034 import java.sql.Types;
035
036
049 public class UserNotificationEventModelImpl extends BaseModelImpl<UserNotificationEvent>
050 implements UserNotificationEventModel {
051
056 public static final String TABLE_NAME = "UserNotificationEvent";
057 public static final Object[][] TABLE_COLUMNS = {
058 { "uuid_", Types.VARCHAR },
059 { "userNotificationEventId", Types.BIGINT },
060 { "companyId", Types.BIGINT },
061 { "userId", Types.BIGINT },
062 { "type_", Types.VARCHAR },
063 { "timestamp", Types.BIGINT },
064 { "deliverBy", Types.BIGINT },
065 { "payload", Types.CLOB },
066 { "archived", Types.BOOLEAN }
067 };
068 public static final String TABLE_SQL_CREATE = "create table UserNotificationEvent (uuid_ VARCHAR(75) null,userNotificationEventId LONG not null primary key,companyId LONG,userId LONG,type_ VARCHAR(75) null,timestamp LONG,deliverBy LONG,payload TEXT null,archived BOOLEAN)";
069 public static final String TABLE_SQL_DROP = "drop table UserNotificationEvent";
070 public static final String ORDER_BY_JPQL = " ORDER BY userNotificationEvent.timestamp DESC";
071 public static final String ORDER_BY_SQL = " ORDER BY UserNotificationEvent.timestamp DESC";
072 public static final String DATA_SOURCE = "liferayDataSource";
073 public static final String SESSION_FACTORY = "liferaySessionFactory";
074 public static final String TX_MANAGER = "liferayTransactionManager";
075 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
076 "value.object.entity.cache.enabled.com.liferay.portal.model.UserNotificationEvent"),
077 true);
078 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
079 "value.object.finder.cache.enabled.com.liferay.portal.model.UserNotificationEvent"),
080 true);
081 public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
082 "value.object.column.bitmask.enabled.com.liferay.portal.model.UserNotificationEvent"),
083 true);
084 public static long ARCHIVED_COLUMN_BITMASK = 1L;
085 public static long USERID_COLUMN_BITMASK = 2L;
086 public static long UUID_COLUMN_BITMASK = 4L;
087 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
088 "lock.expiration.time.com.liferay.portal.model.UserNotificationEvent"));
089
090 public UserNotificationEventModelImpl() {
091 }
092
093 public long getPrimaryKey() {
094 return _userNotificationEventId;
095 }
096
097 public void setPrimaryKey(long primaryKey) {
098 setUserNotificationEventId(primaryKey);
099 }
100
101 public Serializable getPrimaryKeyObj() {
102 return new Long(_userNotificationEventId);
103 }
104
105 public void setPrimaryKeyObj(Serializable primaryKeyObj) {
106 setPrimaryKey(((Long)primaryKeyObj).longValue());
107 }
108
109 public Class<?> getModelClass() {
110 return UserNotificationEvent.class;
111 }
112
113 public String getModelClassName() {
114 return UserNotificationEvent.class.getName();
115 }
116
117 public String getUuid() {
118 if (_uuid == null) {
119 return StringPool.BLANK;
120 }
121 else {
122 return _uuid;
123 }
124 }
125
126 public void setUuid(String uuid) {
127 if (_originalUuid == null) {
128 _originalUuid = _uuid;
129 }
130
131 _uuid = uuid;
132 }
133
134 public String getOriginalUuid() {
135 return GetterUtil.getString(_originalUuid);
136 }
137
138 public long getUserNotificationEventId() {
139 return _userNotificationEventId;
140 }
141
142 public void setUserNotificationEventId(long userNotificationEventId) {
143 _userNotificationEventId = userNotificationEventId;
144 }
145
146 public long getCompanyId() {
147 return _companyId;
148 }
149
150 public void setCompanyId(long companyId) {
151 _companyId = companyId;
152 }
153
154 public long getUserId() {
155 return _userId;
156 }
157
158 public void setUserId(long userId) {
159 _columnBitmask |= USERID_COLUMN_BITMASK;
160
161 if (!_setOriginalUserId) {
162 _setOriginalUserId = true;
163
164 _originalUserId = _userId;
165 }
166
167 _userId = userId;
168 }
169
170 public String getUserUuid() throws SystemException {
171 return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
172 }
173
174 public void setUserUuid(String userUuid) {
175 _userUuid = userUuid;
176 }
177
178 public long getOriginalUserId() {
179 return _originalUserId;
180 }
181
182 public String getType() {
183 if (_type == null) {
184 return StringPool.BLANK;
185 }
186 else {
187 return _type;
188 }
189 }
190
191 public void setType(String type) {
192 _type = type;
193 }
194
195 public long getTimestamp() {
196 return _timestamp;
197 }
198
199 public void setTimestamp(long timestamp) {
200 _timestamp = timestamp;
201 }
202
203 public long getDeliverBy() {
204 return _deliverBy;
205 }
206
207 public void setDeliverBy(long deliverBy) {
208 _deliverBy = deliverBy;
209 }
210
211 public String getPayload() {
212 if (_payload == null) {
213 return StringPool.BLANK;
214 }
215 else {
216 return _payload;
217 }
218 }
219
220 public void setPayload(String payload) {
221 _payload = payload;
222 }
223
224 public boolean getArchived() {
225 return _archived;
226 }
227
228 public boolean isArchived() {
229 return _archived;
230 }
231
232 public void setArchived(boolean archived) {
233 _columnBitmask |= ARCHIVED_COLUMN_BITMASK;
234
235 if (!_setOriginalArchived) {
236 _setOriginalArchived = true;
237
238 _originalArchived = _archived;
239 }
240
241 _archived = archived;
242 }
243
244 public boolean getOriginalArchived() {
245 return _originalArchived;
246 }
247
248 public long getColumnBitmask() {
249 return _columnBitmask;
250 }
251
252 @Override
253 public UserNotificationEvent toEscapedModel() {
254 if (_escapedModelProxy == null) {
255 _escapedModelProxy = (UserNotificationEvent)ProxyUtil.newProxyInstance(_classLoader,
256 _escapedModelProxyInterfaces,
257 new AutoEscapeBeanHandler(this));
258 }
259
260 return _escapedModelProxy;
261 }
262
263 @Override
264 public ExpandoBridge getExpandoBridge() {
265 if (_expandoBridge == null) {
266 _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
267 UserNotificationEvent.class.getName(), getPrimaryKey());
268 }
269
270 return _expandoBridge;
271 }
272
273 @Override
274 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
275 getExpandoBridge().setAttributes(serviceContext);
276 }
277
278 @Override
279 public Object clone() {
280 UserNotificationEventImpl userNotificationEventImpl = new UserNotificationEventImpl();
281
282 userNotificationEventImpl.setUuid(getUuid());
283 userNotificationEventImpl.setUserNotificationEventId(getUserNotificationEventId());
284 userNotificationEventImpl.setCompanyId(getCompanyId());
285 userNotificationEventImpl.setUserId(getUserId());
286 userNotificationEventImpl.setType(getType());
287 userNotificationEventImpl.setTimestamp(getTimestamp());
288 userNotificationEventImpl.setDeliverBy(getDeliverBy());
289 userNotificationEventImpl.setPayload(getPayload());
290 userNotificationEventImpl.setArchived(getArchived());
291
292 userNotificationEventImpl.resetOriginalValues();
293
294 return userNotificationEventImpl;
295 }
296
297 public int compareTo(UserNotificationEvent userNotificationEvent) {
298 int value = 0;
299
300 if (getTimestamp() < userNotificationEvent.getTimestamp()) {
301 value = -1;
302 }
303 else if (getTimestamp() > userNotificationEvent.getTimestamp()) {
304 value = 1;
305 }
306 else {
307 value = 0;
308 }
309
310 value = value * -1;
311
312 if (value != 0) {
313 return value;
314 }
315
316 return 0;
317 }
318
319 @Override
320 public boolean equals(Object obj) {
321 if (obj == null) {
322 return false;
323 }
324
325 UserNotificationEvent userNotificationEvent = null;
326
327 try {
328 userNotificationEvent = (UserNotificationEvent)obj;
329 }
330 catch (ClassCastException cce) {
331 return false;
332 }
333
334 long primaryKey = userNotificationEvent.getPrimaryKey();
335
336 if (getPrimaryKey() == primaryKey) {
337 return true;
338 }
339 else {
340 return false;
341 }
342 }
343
344 @Override
345 public int hashCode() {
346 return (int)getPrimaryKey();
347 }
348
349 @Override
350 public void resetOriginalValues() {
351 UserNotificationEventModelImpl userNotificationEventModelImpl = this;
352
353 userNotificationEventModelImpl._originalUuid = userNotificationEventModelImpl._uuid;
354
355 userNotificationEventModelImpl._originalUserId = userNotificationEventModelImpl._userId;
356
357 userNotificationEventModelImpl._setOriginalUserId = false;
358
359 userNotificationEventModelImpl._originalArchived = userNotificationEventModelImpl._archived;
360
361 userNotificationEventModelImpl._setOriginalArchived = false;
362
363 userNotificationEventModelImpl._columnBitmask = 0;
364 }
365
366 @Override
367 public CacheModel<UserNotificationEvent> toCacheModel() {
368 UserNotificationEventCacheModel userNotificationEventCacheModel = new UserNotificationEventCacheModel();
369
370 userNotificationEventCacheModel.uuid = getUuid();
371
372 String uuid = userNotificationEventCacheModel.uuid;
373
374 if ((uuid != null) && (uuid.length() == 0)) {
375 userNotificationEventCacheModel.uuid = null;
376 }
377
378 userNotificationEventCacheModel.userNotificationEventId = getUserNotificationEventId();
379
380 userNotificationEventCacheModel.companyId = getCompanyId();
381
382 userNotificationEventCacheModel.userId = getUserId();
383
384 userNotificationEventCacheModel.type = getType();
385
386 String type = userNotificationEventCacheModel.type;
387
388 if ((type != null) && (type.length() == 0)) {
389 userNotificationEventCacheModel.type = null;
390 }
391
392 userNotificationEventCacheModel.timestamp = getTimestamp();
393
394 userNotificationEventCacheModel.deliverBy = getDeliverBy();
395
396 userNotificationEventCacheModel.payload = getPayload();
397
398 String payload = userNotificationEventCacheModel.payload;
399
400 if ((payload != null) && (payload.length() == 0)) {
401 userNotificationEventCacheModel.payload = null;
402 }
403
404 userNotificationEventCacheModel.archived = getArchived();
405
406 return userNotificationEventCacheModel;
407 }
408
409 @Override
410 public String toString() {
411 StringBundler sb = new StringBundler(19);
412
413 sb.append("{uuid=");
414 sb.append(getUuid());
415 sb.append(", userNotificationEventId=");
416 sb.append(getUserNotificationEventId());
417 sb.append(", companyId=");
418 sb.append(getCompanyId());
419 sb.append(", userId=");
420 sb.append(getUserId());
421 sb.append(", type=");
422 sb.append(getType());
423 sb.append(", timestamp=");
424 sb.append(getTimestamp());
425 sb.append(", deliverBy=");
426 sb.append(getDeliverBy());
427 sb.append(", payload=");
428 sb.append(getPayload());
429 sb.append(", archived=");
430 sb.append(getArchived());
431 sb.append("}");
432
433 return sb.toString();
434 }
435
436 public String toXmlString() {
437 StringBundler sb = new StringBundler(31);
438
439 sb.append("<model><model-name>");
440 sb.append("com.liferay.portal.model.UserNotificationEvent");
441 sb.append("</model-name>");
442
443 sb.append(
444 "<column><column-name>uuid</column-name><column-value><![CDATA[");
445 sb.append(getUuid());
446 sb.append("]]></column-value></column>");
447 sb.append(
448 "<column><column-name>userNotificationEventId</column-name><column-value><![CDATA[");
449 sb.append(getUserNotificationEventId());
450 sb.append("]]></column-value></column>");
451 sb.append(
452 "<column><column-name>companyId</column-name><column-value><![CDATA[");
453 sb.append(getCompanyId());
454 sb.append("]]></column-value></column>");
455 sb.append(
456 "<column><column-name>userId</column-name><column-value><![CDATA[");
457 sb.append(getUserId());
458 sb.append("]]></column-value></column>");
459 sb.append(
460 "<column><column-name>type</column-name><column-value><![CDATA[");
461 sb.append(getType());
462 sb.append("]]></column-value></column>");
463 sb.append(
464 "<column><column-name>timestamp</column-name><column-value><![CDATA[");
465 sb.append(getTimestamp());
466 sb.append("]]></column-value></column>");
467 sb.append(
468 "<column><column-name>deliverBy</column-name><column-value><![CDATA[");
469 sb.append(getDeliverBy());
470 sb.append("]]></column-value></column>");
471 sb.append(
472 "<column><column-name>payload</column-name><column-value><![CDATA[");
473 sb.append(getPayload());
474 sb.append("]]></column-value></column>");
475 sb.append(
476 "<column><column-name>archived</column-name><column-value><![CDATA[");
477 sb.append(getArchived());
478 sb.append("]]></column-value></column>");
479
480 sb.append("</model>");
481
482 return sb.toString();
483 }
484
485 private static ClassLoader _classLoader = UserNotificationEvent.class.getClassLoader();
486 private static Class<?>[] _escapedModelProxyInterfaces = new Class[] {
487 UserNotificationEvent.class
488 };
489 private String _uuid;
490 private String _originalUuid;
491 private long _userNotificationEventId;
492 private long _companyId;
493 private long _userId;
494 private String _userUuid;
495 private long _originalUserId;
496 private boolean _setOriginalUserId;
497 private String _type;
498 private long _timestamp;
499 private long _deliverBy;
500 private String _payload;
501 private boolean _archived;
502 private boolean _originalArchived;
503 private boolean _setOriginalArchived;
504 private transient ExpandoBridge _expandoBridge;
505 private long _columnBitmask;
506 private UserNotificationEvent _escapedModelProxy;
507 }