001
014
015 package com.liferay.portal.model.impl;
016
017 import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018 import com.liferay.portal.kernel.util.GetterUtil;
019 import com.liferay.portal.kernel.util.ProxyUtil;
020 import com.liferay.portal.kernel.util.StringBundler;
021 import com.liferay.portal.kernel.util.StringPool;
022 import com.liferay.portal.model.CacheModel;
023 import com.liferay.portal.model.Ticket;
024 import com.liferay.portal.model.TicketModel;
025 import com.liferay.portal.service.ServiceContext;
026 import com.liferay.portal.util.PortalUtil;
027
028 import com.liferay.portlet.expando.model.ExpandoBridge;
029 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
030
031 import java.io.Serializable;
032
033 import java.sql.Types;
034
035 import java.util.Date;
036
037
050 public class TicketModelImpl extends BaseModelImpl<Ticket>
051 implements TicketModel {
052
057 public static final String TABLE_NAME = "Ticket";
058 public static final Object[][] TABLE_COLUMNS = {
059 { "ticketId", Types.BIGINT },
060 { "companyId", Types.BIGINT },
061 { "createDate", Types.TIMESTAMP },
062 { "classNameId", Types.BIGINT },
063 { "classPK", Types.BIGINT },
064 { "key_", Types.VARCHAR },
065 { "type_", Types.INTEGER },
066 { "extraInfo", Types.CLOB },
067 { "expirationDate", Types.TIMESTAMP }
068 };
069 public static final String TABLE_SQL_CREATE = "create table Ticket (ticketId LONG not null primary key,companyId LONG,createDate DATE null,classNameId LONG,classPK LONG,key_ VARCHAR(75) null,type_ INTEGER,extraInfo TEXT null,expirationDate DATE null)";
070 public static final String TABLE_SQL_DROP = "drop table Ticket";
071 public static final String ORDER_BY_JPQL = " ORDER BY ticket.ticketId ASC";
072 public static final String ORDER_BY_SQL = " ORDER BY Ticket.ticketId ASC";
073 public static final String DATA_SOURCE = "liferayDataSource";
074 public static final String SESSION_FACTORY = "liferaySessionFactory";
075 public static final String TX_MANAGER = "liferayTransactionManager";
076 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
077 "value.object.entity.cache.enabled.com.liferay.portal.model.Ticket"),
078 true);
079 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
080 "value.object.finder.cache.enabled.com.liferay.portal.model.Ticket"),
081 true);
082 public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
083 "value.object.column.bitmask.enabled.com.liferay.portal.model.Ticket"),
084 true);
085 public static long KEY_COLUMN_BITMASK = 1L;
086 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
087 "lock.expiration.time.com.liferay.portal.model.Ticket"));
088
089 public TicketModelImpl() {
090 }
091
092 public long getPrimaryKey() {
093 return _ticketId;
094 }
095
096 public void setPrimaryKey(long primaryKey) {
097 setTicketId(primaryKey);
098 }
099
100 public Serializable getPrimaryKeyObj() {
101 return new Long(_ticketId);
102 }
103
104 public void setPrimaryKeyObj(Serializable primaryKeyObj) {
105 setPrimaryKey(((Long)primaryKeyObj).longValue());
106 }
107
108 public Class<?> getModelClass() {
109 return Ticket.class;
110 }
111
112 public String getModelClassName() {
113 return Ticket.class.getName();
114 }
115
116 public long getTicketId() {
117 return _ticketId;
118 }
119
120 public void setTicketId(long ticketId) {
121 _columnBitmask = -1L;
122
123 _ticketId = ticketId;
124 }
125
126 public long getCompanyId() {
127 return _companyId;
128 }
129
130 public void setCompanyId(long companyId) {
131 _companyId = companyId;
132 }
133
134 public Date getCreateDate() {
135 return _createDate;
136 }
137
138 public void setCreateDate(Date createDate) {
139 _createDate = createDate;
140 }
141
142 public String getClassName() {
143 if (getClassNameId() <= 0) {
144 return StringPool.BLANK;
145 }
146
147 return PortalUtil.getClassName(getClassNameId());
148 }
149
150 public long getClassNameId() {
151 return _classNameId;
152 }
153
154 public void setClassNameId(long classNameId) {
155 _classNameId = classNameId;
156 }
157
158 public long getClassPK() {
159 return _classPK;
160 }
161
162 public void setClassPK(long classPK) {
163 _classPK = classPK;
164 }
165
166 public String getKey() {
167 if (_key == null) {
168 return StringPool.BLANK;
169 }
170 else {
171 return _key;
172 }
173 }
174
175 public void setKey(String key) {
176 _columnBitmask |= KEY_COLUMN_BITMASK;
177
178 if (_originalKey == null) {
179 _originalKey = _key;
180 }
181
182 _key = key;
183 }
184
185 public String getOriginalKey() {
186 return GetterUtil.getString(_originalKey);
187 }
188
189 public int getType() {
190 return _type;
191 }
192
193 public void setType(int type) {
194 _type = type;
195 }
196
197 public String getExtraInfo() {
198 if (_extraInfo == null) {
199 return StringPool.BLANK;
200 }
201 else {
202 return _extraInfo;
203 }
204 }
205
206 public void setExtraInfo(String extraInfo) {
207 _extraInfo = extraInfo;
208 }
209
210 public Date getExpirationDate() {
211 return _expirationDate;
212 }
213
214 public void setExpirationDate(Date expirationDate) {
215 _expirationDate = expirationDate;
216 }
217
218 public long getColumnBitmask() {
219 return _columnBitmask;
220 }
221
222 @Override
223 public Ticket toEscapedModel() {
224 if (_escapedModelProxy == null) {
225 _escapedModelProxy = (Ticket)ProxyUtil.newProxyInstance(_classLoader,
226 _escapedModelProxyInterfaces,
227 new AutoEscapeBeanHandler(this));
228 }
229
230 return _escapedModelProxy;
231 }
232
233 @Override
234 public ExpandoBridge getExpandoBridge() {
235 if (_expandoBridge == null) {
236 _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
237 Ticket.class.getName(), getPrimaryKey());
238 }
239
240 return _expandoBridge;
241 }
242
243 @Override
244 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
245 getExpandoBridge().setAttributes(serviceContext);
246 }
247
248 @Override
249 public Object clone() {
250 TicketImpl ticketImpl = new TicketImpl();
251
252 ticketImpl.setTicketId(getTicketId());
253 ticketImpl.setCompanyId(getCompanyId());
254 ticketImpl.setCreateDate(getCreateDate());
255 ticketImpl.setClassNameId(getClassNameId());
256 ticketImpl.setClassPK(getClassPK());
257 ticketImpl.setKey(getKey());
258 ticketImpl.setType(getType());
259 ticketImpl.setExtraInfo(getExtraInfo());
260 ticketImpl.setExpirationDate(getExpirationDate());
261
262 ticketImpl.resetOriginalValues();
263
264 return ticketImpl;
265 }
266
267 public int compareTo(Ticket ticket) {
268 int value = 0;
269
270 if (getTicketId() < ticket.getTicketId()) {
271 value = -1;
272 }
273 else if (getTicketId() > ticket.getTicketId()) {
274 value = 1;
275 }
276 else {
277 value = 0;
278 }
279
280 if (value != 0) {
281 return value;
282 }
283
284 return 0;
285 }
286
287 @Override
288 public boolean equals(Object obj) {
289 if (obj == null) {
290 return false;
291 }
292
293 Ticket ticket = null;
294
295 try {
296 ticket = (Ticket)obj;
297 }
298 catch (ClassCastException cce) {
299 return false;
300 }
301
302 long primaryKey = ticket.getPrimaryKey();
303
304 if (getPrimaryKey() == primaryKey) {
305 return true;
306 }
307 else {
308 return false;
309 }
310 }
311
312 @Override
313 public int hashCode() {
314 return (int)getPrimaryKey();
315 }
316
317 @Override
318 public void resetOriginalValues() {
319 TicketModelImpl ticketModelImpl = this;
320
321 ticketModelImpl._originalKey = ticketModelImpl._key;
322
323 ticketModelImpl._columnBitmask = 0;
324 }
325
326 @Override
327 public CacheModel<Ticket> toCacheModel() {
328 TicketCacheModel ticketCacheModel = new TicketCacheModel();
329
330 ticketCacheModel.ticketId = getTicketId();
331
332 ticketCacheModel.companyId = getCompanyId();
333
334 Date createDate = getCreateDate();
335
336 if (createDate != null) {
337 ticketCacheModel.createDate = createDate.getTime();
338 }
339 else {
340 ticketCacheModel.createDate = Long.MIN_VALUE;
341 }
342
343 ticketCacheModel.classNameId = getClassNameId();
344
345 ticketCacheModel.classPK = getClassPK();
346
347 ticketCacheModel.key = getKey();
348
349 String key = ticketCacheModel.key;
350
351 if ((key != null) && (key.length() == 0)) {
352 ticketCacheModel.key = null;
353 }
354
355 ticketCacheModel.type = getType();
356
357 ticketCacheModel.extraInfo = getExtraInfo();
358
359 String extraInfo = ticketCacheModel.extraInfo;
360
361 if ((extraInfo != null) && (extraInfo.length() == 0)) {
362 ticketCacheModel.extraInfo = null;
363 }
364
365 Date expirationDate = getExpirationDate();
366
367 if (expirationDate != null) {
368 ticketCacheModel.expirationDate = expirationDate.getTime();
369 }
370 else {
371 ticketCacheModel.expirationDate = Long.MIN_VALUE;
372 }
373
374 return ticketCacheModel;
375 }
376
377 @Override
378 public String toString() {
379 StringBundler sb = new StringBundler(19);
380
381 sb.append("{ticketId=");
382 sb.append(getTicketId());
383 sb.append(", companyId=");
384 sb.append(getCompanyId());
385 sb.append(", createDate=");
386 sb.append(getCreateDate());
387 sb.append(", classNameId=");
388 sb.append(getClassNameId());
389 sb.append(", classPK=");
390 sb.append(getClassPK());
391 sb.append(", key=");
392 sb.append(getKey());
393 sb.append(", type=");
394 sb.append(getType());
395 sb.append(", extraInfo=");
396 sb.append(getExtraInfo());
397 sb.append(", expirationDate=");
398 sb.append(getExpirationDate());
399 sb.append("}");
400
401 return sb.toString();
402 }
403
404 public String toXmlString() {
405 StringBundler sb = new StringBundler(31);
406
407 sb.append("<model><model-name>");
408 sb.append("com.liferay.portal.model.Ticket");
409 sb.append("</model-name>");
410
411 sb.append(
412 "<column><column-name>ticketId</column-name><column-value><![CDATA[");
413 sb.append(getTicketId());
414 sb.append("]]></column-value></column>");
415 sb.append(
416 "<column><column-name>companyId</column-name><column-value><![CDATA[");
417 sb.append(getCompanyId());
418 sb.append("]]></column-value></column>");
419 sb.append(
420 "<column><column-name>createDate</column-name><column-value><![CDATA[");
421 sb.append(getCreateDate());
422 sb.append("]]></column-value></column>");
423 sb.append(
424 "<column><column-name>classNameId</column-name><column-value><![CDATA[");
425 sb.append(getClassNameId());
426 sb.append("]]></column-value></column>");
427 sb.append(
428 "<column><column-name>classPK</column-name><column-value><![CDATA[");
429 sb.append(getClassPK());
430 sb.append("]]></column-value></column>");
431 sb.append(
432 "<column><column-name>key</column-name><column-value><![CDATA[");
433 sb.append(getKey());
434 sb.append("]]></column-value></column>");
435 sb.append(
436 "<column><column-name>type</column-name><column-value><![CDATA[");
437 sb.append(getType());
438 sb.append("]]></column-value></column>");
439 sb.append(
440 "<column><column-name>extraInfo</column-name><column-value><![CDATA[");
441 sb.append(getExtraInfo());
442 sb.append("]]></column-value></column>");
443 sb.append(
444 "<column><column-name>expirationDate</column-name><column-value><![CDATA[");
445 sb.append(getExpirationDate());
446 sb.append("]]></column-value></column>");
447
448 sb.append("</model>");
449
450 return sb.toString();
451 }
452
453 private static ClassLoader _classLoader = Ticket.class.getClassLoader();
454 private static Class<?>[] _escapedModelProxyInterfaces = new Class[] {
455 Ticket.class
456 };
457 private long _ticketId;
458 private long _companyId;
459 private Date _createDate;
460 private long _classNameId;
461 private long _classPK;
462 private String _key;
463 private String _originalKey;
464 private int _type;
465 private String _extraInfo;
466 private Date _expirationDate;
467 private transient ExpandoBridge _expandoBridge;
468 private long _columnBitmask;
469 private Ticket _escapedModelProxy;
470 }