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