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 _ticketId = ticketId;
122 }
123
124 public long getCompanyId() {
125 return _companyId;
126 }
127
128 public void setCompanyId(long companyId) {
129 _companyId = companyId;
130 }
131
132 public Date getCreateDate() {
133 return _createDate;
134 }
135
136 public void setCreateDate(Date createDate) {
137 _createDate = createDate;
138 }
139
140 public String getClassName() {
141 if (getClassNameId() <= 0) {
142 return StringPool.BLANK;
143 }
144
145 return PortalUtil.getClassName(getClassNameId());
146 }
147
148 public long getClassNameId() {
149 return _classNameId;
150 }
151
152 public void setClassNameId(long classNameId) {
153 _classNameId = classNameId;
154 }
155
156 public long getClassPK() {
157 return _classPK;
158 }
159
160 public void setClassPK(long classPK) {
161 _classPK = classPK;
162 }
163
164 public String getKey() {
165 if (_key == null) {
166 return StringPool.BLANK;
167 }
168 else {
169 return _key;
170 }
171 }
172
173 public void setKey(String key) {
174 _columnBitmask |= KEY_COLUMN_BITMASK;
175
176 if (_originalKey == null) {
177 _originalKey = _key;
178 }
179
180 _key = key;
181 }
182
183 public String getOriginalKey() {
184 return GetterUtil.getString(_originalKey);
185 }
186
187 public int getType() {
188 return _type;
189 }
190
191 public void setType(int type) {
192 _type = type;
193 }
194
195 public String getExtraInfo() {
196 if (_extraInfo == null) {
197 return StringPool.BLANK;
198 }
199 else {
200 return _extraInfo;
201 }
202 }
203
204 public void setExtraInfo(String extraInfo) {
205 _extraInfo = extraInfo;
206 }
207
208 public Date getExpirationDate() {
209 return _expirationDate;
210 }
211
212 public void setExpirationDate(Date expirationDate) {
213 _expirationDate = expirationDate;
214 }
215
216 public long getColumnBitmask() {
217 return _columnBitmask;
218 }
219
220 @Override
221 public Ticket toEscapedModel() {
222 if (_escapedModelProxy == null) {
223 _escapedModelProxy = (Ticket)ProxyUtil.newProxyInstance(_classLoader,
224 _escapedModelProxyInterfaces,
225 new AutoEscapeBeanHandler(this));
226 }
227
228 return _escapedModelProxy;
229 }
230
231 @Override
232 public ExpandoBridge getExpandoBridge() {
233 if (_expandoBridge == null) {
234 _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
235 Ticket.class.getName(), getPrimaryKey());
236 }
237
238 return _expandoBridge;
239 }
240
241 @Override
242 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
243 getExpandoBridge().setAttributes(serviceContext);
244 }
245
246 @Override
247 public Object clone() {
248 TicketImpl ticketImpl = new TicketImpl();
249
250 ticketImpl.setTicketId(getTicketId());
251 ticketImpl.setCompanyId(getCompanyId());
252 ticketImpl.setCreateDate(getCreateDate());
253 ticketImpl.setClassNameId(getClassNameId());
254 ticketImpl.setClassPK(getClassPK());
255 ticketImpl.setKey(getKey());
256 ticketImpl.setType(getType());
257 ticketImpl.setExtraInfo(getExtraInfo());
258 ticketImpl.setExpirationDate(getExpirationDate());
259
260 ticketImpl.resetOriginalValues();
261
262 return ticketImpl;
263 }
264
265 public int compareTo(Ticket ticket) {
266 int value = 0;
267
268 if (getTicketId() < ticket.getTicketId()) {
269 value = -1;
270 }
271 else if (getTicketId() > ticket.getTicketId()) {
272 value = 1;
273 }
274 else {
275 value = 0;
276 }
277
278 if (value != 0) {
279 return value;
280 }
281
282 return 0;
283 }
284
285 @Override
286 public boolean equals(Object obj) {
287 if (obj == null) {
288 return false;
289 }
290
291 Ticket ticket = null;
292
293 try {
294 ticket = (Ticket)obj;
295 }
296 catch (ClassCastException cce) {
297 return false;
298 }
299
300 long primaryKey = ticket.getPrimaryKey();
301
302 if (getPrimaryKey() == primaryKey) {
303 return true;
304 }
305 else {
306 return false;
307 }
308 }
309
310 @Override
311 public int hashCode() {
312 return (int)getPrimaryKey();
313 }
314
315 @Override
316 public void resetOriginalValues() {
317 TicketModelImpl ticketModelImpl = this;
318
319 ticketModelImpl._originalKey = ticketModelImpl._key;
320
321 ticketModelImpl._columnBitmask = 0;
322 }
323
324 @Override
325 public CacheModel<Ticket> toCacheModel() {
326 TicketCacheModel ticketCacheModel = new TicketCacheModel();
327
328 ticketCacheModel.ticketId = getTicketId();
329
330 ticketCacheModel.companyId = getCompanyId();
331
332 Date createDate = getCreateDate();
333
334 if (createDate != null) {
335 ticketCacheModel.createDate = createDate.getTime();
336 }
337 else {
338 ticketCacheModel.createDate = Long.MIN_VALUE;
339 }
340
341 ticketCacheModel.classNameId = getClassNameId();
342
343 ticketCacheModel.classPK = getClassPK();
344
345 ticketCacheModel.key = getKey();
346
347 String key = ticketCacheModel.key;
348
349 if ((key != null) && (key.length() == 0)) {
350 ticketCacheModel.key = null;
351 }
352
353 ticketCacheModel.type = getType();
354
355 ticketCacheModel.extraInfo = getExtraInfo();
356
357 String extraInfo = ticketCacheModel.extraInfo;
358
359 if ((extraInfo != null) && (extraInfo.length() == 0)) {
360 ticketCacheModel.extraInfo = null;
361 }
362
363 Date expirationDate = getExpirationDate();
364
365 if (expirationDate != null) {
366 ticketCacheModel.expirationDate = expirationDate.getTime();
367 }
368 else {
369 ticketCacheModel.expirationDate = Long.MIN_VALUE;
370 }
371
372 return ticketCacheModel;
373 }
374
375 @Override
376 public String toString() {
377 StringBundler sb = new StringBundler(19);
378
379 sb.append("{ticketId=");
380 sb.append(getTicketId());
381 sb.append(", companyId=");
382 sb.append(getCompanyId());
383 sb.append(", createDate=");
384 sb.append(getCreateDate());
385 sb.append(", classNameId=");
386 sb.append(getClassNameId());
387 sb.append(", classPK=");
388 sb.append(getClassPK());
389 sb.append(", key=");
390 sb.append(getKey());
391 sb.append(", type=");
392 sb.append(getType());
393 sb.append(", extraInfo=");
394 sb.append(getExtraInfo());
395 sb.append(", expirationDate=");
396 sb.append(getExpirationDate());
397 sb.append("}");
398
399 return sb.toString();
400 }
401
402 public String toXmlString() {
403 StringBundler sb = new StringBundler(31);
404
405 sb.append("<model><model-name>");
406 sb.append("com.liferay.portal.model.Ticket");
407 sb.append("</model-name>");
408
409 sb.append(
410 "<column><column-name>ticketId</column-name><column-value><![CDATA[");
411 sb.append(getTicketId());
412 sb.append("]]></column-value></column>");
413 sb.append(
414 "<column><column-name>companyId</column-name><column-value><![CDATA[");
415 sb.append(getCompanyId());
416 sb.append("]]></column-value></column>");
417 sb.append(
418 "<column><column-name>createDate</column-name><column-value><![CDATA[");
419 sb.append(getCreateDate());
420 sb.append("]]></column-value></column>");
421 sb.append(
422 "<column><column-name>classNameId</column-name><column-value><![CDATA[");
423 sb.append(getClassNameId());
424 sb.append("]]></column-value></column>");
425 sb.append(
426 "<column><column-name>classPK</column-name><column-value><![CDATA[");
427 sb.append(getClassPK());
428 sb.append("]]></column-value></column>");
429 sb.append(
430 "<column><column-name>key</column-name><column-value><![CDATA[");
431 sb.append(getKey());
432 sb.append("]]></column-value></column>");
433 sb.append(
434 "<column><column-name>type</column-name><column-value><![CDATA[");
435 sb.append(getType());
436 sb.append("]]></column-value></column>");
437 sb.append(
438 "<column><column-name>extraInfo</column-name><column-value><![CDATA[");
439 sb.append(getExtraInfo());
440 sb.append("]]></column-value></column>");
441 sb.append(
442 "<column><column-name>expirationDate</column-name><column-value><![CDATA[");
443 sb.append(getExpirationDate());
444 sb.append("]]></column-value></column>");
445
446 sb.append("</model>");
447
448 return sb.toString();
449 }
450
451 private static ClassLoader _classLoader = Ticket.class.getClassLoader();
452 private static Class<?>[] _escapedModelProxyInterfaces = new Class[] {
453 Ticket.class
454 };
455 private long _ticketId;
456 private long _companyId;
457 private Date _createDate;
458 private long _classNameId;
459 private long _classPK;
460 private String _key;
461 private String _originalKey;
462 private int _type;
463 private String _extraInfo;
464 private Date _expirationDate;
465 private transient ExpandoBridge _expandoBridge;
466 private long _columnBitmask;
467 private Ticket _escapedModelProxy;
468 }