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.StringBundler;
020 import com.liferay.portal.kernel.util.StringPool;
021 import com.liferay.portal.model.Ticket;
022 import com.liferay.portal.model.TicketModel;
023 import com.liferay.portal.service.ServiceContext;
024 import com.liferay.portal.util.PortalUtil;
025
026 import com.liferay.portlet.expando.model.ExpandoBridge;
027 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
028
029 import java.io.Serializable;
030
031 import java.lang.reflect.Proxy;
032
033 import java.sql.Types;
034
035 import java.util.Date;
036
037
054 public class TicketModelImpl extends BaseModelImpl<Ticket>
055 implements TicketModel {
056 public static final String TABLE_NAME = "Ticket";
057 public static final Object[][] TABLE_COLUMNS = {
058 { "ticketId", new Integer(Types.BIGINT) },
059 { "companyId", new Integer(Types.BIGINT) },
060 { "createDate", new Integer(Types.TIMESTAMP) },
061 { "classNameId", new Integer(Types.BIGINT) },
062 { "classPK", new Integer(Types.BIGINT) },
063 { "key_", new Integer(Types.VARCHAR) },
064 { "expirationDate", new Integer(Types.TIMESTAMP) }
065 };
066 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,expirationDate DATE null)";
067 public static final String TABLE_SQL_DROP = "drop table Ticket";
068 public static final String ORDER_BY_JPQL = " ORDER BY ticket.ticketId ASC";
069 public static final String ORDER_BY_SQL = " ORDER BY Ticket.ticketId ASC";
070 public static final String DATA_SOURCE = "liferayDataSource";
071 public static final String SESSION_FACTORY = "liferaySessionFactory";
072 public static final String TX_MANAGER = "liferayTransactionManager";
073 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
074 "value.object.entity.cache.enabled.com.liferay.portal.model.Ticket"),
075 true);
076 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
077 "value.object.finder.cache.enabled.com.liferay.portal.model.Ticket"),
078 true);
079 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
080 "lock.expiration.time.com.liferay.portal.model.Ticket"));
081
082 public TicketModelImpl() {
083 }
084
085 public long getPrimaryKey() {
086 return _ticketId;
087 }
088
089 public void setPrimaryKey(long pk) {
090 setTicketId(pk);
091 }
092
093 public Serializable getPrimaryKeyObj() {
094 return new Long(_ticketId);
095 }
096
097 public long getTicketId() {
098 return _ticketId;
099 }
100
101 public void setTicketId(long ticketId) {
102 _ticketId = ticketId;
103 }
104
105 public long getCompanyId() {
106 return _companyId;
107 }
108
109 public void setCompanyId(long companyId) {
110 _companyId = companyId;
111 }
112
113 public Date getCreateDate() {
114 return _createDate;
115 }
116
117 public void setCreateDate(Date createDate) {
118 _createDate = createDate;
119 }
120
121 public String getClassName() {
122 if (getClassNameId() <= 0) {
123 return StringPool.BLANK;
124 }
125
126 return PortalUtil.getClassName(getClassNameId());
127 }
128
129 public long getClassNameId() {
130 return _classNameId;
131 }
132
133 public void setClassNameId(long classNameId) {
134 _classNameId = classNameId;
135 }
136
137 public long getClassPK() {
138 return _classPK;
139 }
140
141 public void setClassPK(long classPK) {
142 _classPK = classPK;
143 }
144
145 public String getKey() {
146 if (_key == null) {
147 return StringPool.BLANK;
148 }
149 else {
150 return _key;
151 }
152 }
153
154 public void setKey(String key) {
155 if (_originalKey == null) {
156 _originalKey = _key;
157 }
158
159 _key = key;
160 }
161
162 public String getOriginalKey() {
163 return GetterUtil.getString(_originalKey);
164 }
165
166 public Date getExpirationDate() {
167 return _expirationDate;
168 }
169
170 public void setExpirationDate(Date expirationDate) {
171 _expirationDate = expirationDate;
172 }
173
174 public Ticket toEscapedModel() {
175 if (isEscapedModel()) {
176 return (Ticket)this;
177 }
178 else {
179 return (Ticket)Proxy.newProxyInstance(Ticket.class.getClassLoader(),
180 new Class[] { Ticket.class }, new AutoEscapeBeanHandler(this));
181 }
182 }
183
184 public ExpandoBridge getExpandoBridge() {
185 if (_expandoBridge == null) {
186 _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
187 Ticket.class.getName(), getPrimaryKey());
188 }
189
190 return _expandoBridge;
191 }
192
193 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
194 getExpandoBridge().setAttributes(serviceContext);
195 }
196
197 public Object clone() {
198 TicketImpl ticketImpl = new TicketImpl();
199
200 ticketImpl.setTicketId(getTicketId());
201
202 ticketImpl.setCompanyId(getCompanyId());
203
204 ticketImpl.setCreateDate(getCreateDate());
205
206 ticketImpl.setClassNameId(getClassNameId());
207
208 ticketImpl.setClassPK(getClassPK());
209
210 ticketImpl.setKey(getKey());
211
212 TicketModelImpl ticketModelImpl = ticketImpl;
213
214 ticketModelImpl._originalKey = ticketModelImpl._key;
215
216 ticketImpl.setExpirationDate(getExpirationDate());
217
218 return ticketImpl;
219 }
220
221 public int compareTo(Ticket ticket) {
222 int value = 0;
223
224 if (getTicketId() < ticket.getTicketId()) {
225 value = -1;
226 }
227 else if (getTicketId() > ticket.getTicketId()) {
228 value = 1;
229 }
230 else {
231 value = 0;
232 }
233
234 if (value != 0) {
235 return value;
236 }
237
238 return 0;
239 }
240
241 public boolean equals(Object obj) {
242 if (obj == null) {
243 return false;
244 }
245
246 Ticket ticket = null;
247
248 try {
249 ticket = (Ticket)obj;
250 }
251 catch (ClassCastException cce) {
252 return false;
253 }
254
255 long pk = ticket.getPrimaryKey();
256
257 if (getPrimaryKey() == pk) {
258 return true;
259 }
260 else {
261 return false;
262 }
263 }
264
265 public int hashCode() {
266 return (int)getPrimaryKey();
267 }
268
269 public String toString() {
270 StringBundler sb = new StringBundler(15);
271
272 sb.append("{ticketId=");
273 sb.append(getTicketId());
274 sb.append(", companyId=");
275 sb.append(getCompanyId());
276 sb.append(", createDate=");
277 sb.append(getCreateDate());
278 sb.append(", classNameId=");
279 sb.append(getClassNameId());
280 sb.append(", classPK=");
281 sb.append(getClassPK());
282 sb.append(", key=");
283 sb.append(getKey());
284 sb.append(", expirationDate=");
285 sb.append(getExpirationDate());
286 sb.append("}");
287
288 return sb.toString();
289 }
290
291 public String toXmlString() {
292 StringBundler sb = new StringBundler(25);
293
294 sb.append("<model><model-name>");
295 sb.append("com.liferay.portal.model.Ticket");
296 sb.append("</model-name>");
297
298 sb.append(
299 "<column><column-name>ticketId</column-name><column-value><![CDATA[");
300 sb.append(getTicketId());
301 sb.append("]]></column-value></column>");
302 sb.append(
303 "<column><column-name>companyId</column-name><column-value><![CDATA[");
304 sb.append(getCompanyId());
305 sb.append("]]></column-value></column>");
306 sb.append(
307 "<column><column-name>createDate</column-name><column-value><![CDATA[");
308 sb.append(getCreateDate());
309 sb.append("]]></column-value></column>");
310 sb.append(
311 "<column><column-name>classNameId</column-name><column-value><![CDATA[");
312 sb.append(getClassNameId());
313 sb.append("]]></column-value></column>");
314 sb.append(
315 "<column><column-name>classPK</column-name><column-value><![CDATA[");
316 sb.append(getClassPK());
317 sb.append("]]></column-value></column>");
318 sb.append(
319 "<column><column-name>key</column-name><column-value><![CDATA[");
320 sb.append(getKey());
321 sb.append("]]></column-value></column>");
322 sb.append(
323 "<column><column-name>expirationDate</column-name><column-value><![CDATA[");
324 sb.append(getExpirationDate());
325 sb.append("]]></column-value></column>");
326
327 sb.append("</model>");
328
329 return sb.toString();
330 }
331
332 private long _ticketId;
333 private long _companyId;
334 private Date _createDate;
335 private long _classNameId;
336 private long _classPK;
337 private String _key;
338 private String _originalKey;
339 private Date _expirationDate;
340 private transient ExpandoBridge _expandoBridge;
341 }