1
22
23 package com.liferay.portlet.journal.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.GetterUtil;
27 import com.liferay.portal.kernel.util.HtmlUtil;
28 import com.liferay.portal.model.impl.BaseModelImpl;
29
30 import com.liferay.portlet.journal.model.JournalTemplate;
31 import com.liferay.portlet.journal.model.JournalTemplateSoap;
32
33 import java.io.Serializable;
34
35 import java.lang.reflect.Proxy;
36
37 import java.sql.Types;
38
39 import java.util.ArrayList;
40 import java.util.Date;
41 import java.util.List;
42
43
63 public class JournalTemplateModelImpl extends BaseModelImpl {
64 public static final String TABLE_NAME = "JournalTemplate";
65 public static final Object[][] TABLE_COLUMNS = {
66 { "uuid_", new Integer(Types.VARCHAR) },
67
68
69 { "id_", new Integer(Types.BIGINT) },
70
71
72 { "groupId", new Integer(Types.BIGINT) },
73
74
75 { "companyId", new Integer(Types.BIGINT) },
76
77
78 { "userId", new Integer(Types.BIGINT) },
79
80
81 { "userName", new Integer(Types.VARCHAR) },
82
83
84 { "createDate", new Integer(Types.TIMESTAMP) },
85
86
87 { "modifiedDate", new Integer(Types.TIMESTAMP) },
88
89
90 { "templateId", new Integer(Types.VARCHAR) },
91
92
93 { "structureId", new Integer(Types.VARCHAR) },
94
95
96 { "name", new Integer(Types.VARCHAR) },
97
98
99 { "description", new Integer(Types.VARCHAR) },
100
101
102 { "xsl", new Integer(Types.CLOB) },
103
104
105 { "langType", new Integer(Types.VARCHAR) },
106
107
108 { "cacheable", new Integer(Types.BOOLEAN) },
109
110
111 { "smallImage", new Integer(Types.BOOLEAN) },
112
113
114 { "smallImageId", new Integer(Types.BIGINT) },
115
116
117 { "smallImageURL", new Integer(Types.VARCHAR) }
118 };
119 public static final String TABLE_SQL_CREATE = "create table JournalTemplate (uuid_ VARCHAR(75) null,id_ LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,templateId VARCHAR(75) null,structureId VARCHAR(75) null,name VARCHAR(75) null,description STRING null,xsl TEXT null,langType VARCHAR(75) null,cacheable BOOLEAN,smallImage BOOLEAN,smallImageId LONG,smallImageURL VARCHAR(75) null)";
120 public static final String TABLE_SQL_DROP = "drop table JournalTemplate";
121 public static final String DATA_SOURCE = "liferayDataSource";
122 public static final String SESSION_FACTORY = "liferaySessionFactory";
123 public static final String TX_MANAGER = "liferayTransactionManager";
124 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
125 "value.object.finder.cache.enabled.com.liferay.portlet.journal.model.JournalTemplate"),
126 true);
127
128 public static JournalTemplate toModel(JournalTemplateSoap soapModel) {
129 JournalTemplate model = new JournalTemplateImpl();
130
131 model.setUuid(soapModel.getUuid());
132 model.setId(soapModel.getId());
133 model.setGroupId(soapModel.getGroupId());
134 model.setCompanyId(soapModel.getCompanyId());
135 model.setUserId(soapModel.getUserId());
136 model.setUserName(soapModel.getUserName());
137 model.setCreateDate(soapModel.getCreateDate());
138 model.setModifiedDate(soapModel.getModifiedDate());
139 model.setTemplateId(soapModel.getTemplateId());
140 model.setStructureId(soapModel.getStructureId());
141 model.setName(soapModel.getName());
142 model.setDescription(soapModel.getDescription());
143 model.setXsl(soapModel.getXsl());
144 model.setLangType(soapModel.getLangType());
145 model.setCacheable(soapModel.getCacheable());
146 model.setSmallImage(soapModel.getSmallImage());
147 model.setSmallImageId(soapModel.getSmallImageId());
148 model.setSmallImageURL(soapModel.getSmallImageURL());
149
150 return model;
151 }
152
153 public static List<JournalTemplate> toModels(
154 JournalTemplateSoap[] soapModels) {
155 List<JournalTemplate> models = new ArrayList<JournalTemplate>(soapModels.length);
156
157 for (JournalTemplateSoap soapModel : soapModels) {
158 models.add(toModel(soapModel));
159 }
160
161 return models;
162 }
163
164 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
165 "lock.expiration.time.com.liferay.portlet.journal.model.JournalTemplate"));
166
167 public JournalTemplateModelImpl() {
168 }
169
170 public long getPrimaryKey() {
171 return _id;
172 }
173
174 public void setPrimaryKey(long pk) {
175 setId(pk);
176 }
177
178 public Serializable getPrimaryKeyObj() {
179 return new Long(_id);
180 }
181
182 public String getUuid() {
183 return GetterUtil.getString(_uuid);
184 }
185
186 public void setUuid(String uuid) {
187 if ((uuid != null) && (uuid != _uuid)) {
188 _uuid = uuid;
189 }
190 }
191
192 public long getId() {
193 return _id;
194 }
195
196 public void setId(long id) {
197 if (id != _id) {
198 _id = id;
199 }
200 }
201
202 public long getGroupId() {
203 return _groupId;
204 }
205
206 public void setGroupId(long groupId) {
207 if (groupId != _groupId) {
208 _groupId = groupId;
209 }
210 }
211
212 public long getCompanyId() {
213 return _companyId;
214 }
215
216 public void setCompanyId(long companyId) {
217 if (companyId != _companyId) {
218 _companyId = companyId;
219 }
220 }
221
222 public long getUserId() {
223 return _userId;
224 }
225
226 public void setUserId(long userId) {
227 if (userId != _userId) {
228 _userId = userId;
229 }
230 }
231
232 public String getUserName() {
233 return GetterUtil.getString(_userName);
234 }
235
236 public void setUserName(String userName) {
237 if (((userName == null) && (_userName != null)) ||
238 ((userName != null) && (_userName == null)) ||
239 ((userName != null) && (_userName != null) &&
240 !userName.equals(_userName))) {
241 _userName = userName;
242 }
243 }
244
245 public Date getCreateDate() {
246 return _createDate;
247 }
248
249 public void setCreateDate(Date createDate) {
250 if (((createDate == null) && (_createDate != null)) ||
251 ((createDate != null) && (_createDate == null)) ||
252 ((createDate != null) && (_createDate != null) &&
253 !createDate.equals(_createDate))) {
254 _createDate = createDate;
255 }
256 }
257
258 public Date getModifiedDate() {
259 return _modifiedDate;
260 }
261
262 public void setModifiedDate(Date modifiedDate) {
263 if (((modifiedDate == null) && (_modifiedDate != null)) ||
264 ((modifiedDate != null) && (_modifiedDate == null)) ||
265 ((modifiedDate != null) && (_modifiedDate != null) &&
266 !modifiedDate.equals(_modifiedDate))) {
267 _modifiedDate = modifiedDate;
268 }
269 }
270
271 public String getTemplateId() {
272 return GetterUtil.getString(_templateId);
273 }
274
275 public void setTemplateId(String templateId) {
276 if (((templateId == null) && (_templateId != null)) ||
277 ((templateId != null) && (_templateId == null)) ||
278 ((templateId != null) && (_templateId != null) &&
279 !templateId.equals(_templateId))) {
280 _templateId = templateId;
281 }
282 }
283
284 public String getStructureId() {
285 return GetterUtil.getString(_structureId);
286 }
287
288 public void setStructureId(String structureId) {
289 if (((structureId == null) && (_structureId != null)) ||
290 ((structureId != null) && (_structureId == null)) ||
291 ((structureId != null) && (_structureId != null) &&
292 !structureId.equals(_structureId))) {
293 _structureId = structureId;
294 }
295 }
296
297 public String getName() {
298 return GetterUtil.getString(_name);
299 }
300
301 public void setName(String name) {
302 if (((name == null) && (_name != null)) ||
303 ((name != null) && (_name == null)) ||
304 ((name != null) && (_name != null) && !name.equals(_name))) {
305 _name = name;
306 }
307 }
308
309 public String getDescription() {
310 return GetterUtil.getString(_description);
311 }
312
313 public void setDescription(String description) {
314 if (((description == null) && (_description != null)) ||
315 ((description != null) && (_description == null)) ||
316 ((description != null) && (_description != null) &&
317 !description.equals(_description))) {
318 _description = description;
319 }
320 }
321
322 public String getXsl() {
323 return GetterUtil.getString(_xsl);
324 }
325
326 public void setXsl(String xsl) {
327 if (((xsl == null) && (_xsl != null)) ||
328 ((xsl != null) && (_xsl == null)) ||
329 ((xsl != null) && (_xsl != null) && !xsl.equals(_xsl))) {
330 _xsl = xsl;
331 }
332 }
333
334 public String getLangType() {
335 return GetterUtil.getString(_langType);
336 }
337
338 public void setLangType(String langType) {
339 if (((langType == null) && (_langType != null)) ||
340 ((langType != null) && (_langType == null)) ||
341 ((langType != null) && (_langType != null) &&
342 !langType.equals(_langType))) {
343 _langType = langType;
344 }
345 }
346
347 public boolean getCacheable() {
348 return _cacheable;
349 }
350
351 public boolean isCacheable() {
352 return _cacheable;
353 }
354
355 public void setCacheable(boolean cacheable) {
356 if (cacheable != _cacheable) {
357 _cacheable = cacheable;
358 }
359 }
360
361 public boolean getSmallImage() {
362 return _smallImage;
363 }
364
365 public boolean isSmallImage() {
366 return _smallImage;
367 }
368
369 public void setSmallImage(boolean smallImage) {
370 if (smallImage != _smallImage) {
371 _smallImage = smallImage;
372 }
373 }
374
375 public long getSmallImageId() {
376 return _smallImageId;
377 }
378
379 public void setSmallImageId(long smallImageId) {
380 if (smallImageId != _smallImageId) {
381 _smallImageId = smallImageId;
382 }
383 }
384
385 public String getSmallImageURL() {
386 return GetterUtil.getString(_smallImageURL);
387 }
388
389 public void setSmallImageURL(String smallImageURL) {
390 if (((smallImageURL == null) && (_smallImageURL != null)) ||
391 ((smallImageURL != null) && (_smallImageURL == null)) ||
392 ((smallImageURL != null) && (_smallImageURL != null) &&
393 !smallImageURL.equals(_smallImageURL))) {
394 _smallImageURL = smallImageURL;
395 }
396 }
397
398 public JournalTemplate toEscapedModel() {
399 if (isEscapedModel()) {
400 return (JournalTemplate)this;
401 }
402 else {
403 JournalTemplate model = new JournalTemplateImpl();
404
405 model.setNew(isNew());
406 model.setEscapedModel(true);
407
408 model.setUuid(HtmlUtil.escape(getUuid()));
409 model.setId(getId());
410 model.setGroupId(getGroupId());
411 model.setCompanyId(getCompanyId());
412 model.setUserId(getUserId());
413 model.setUserName(HtmlUtil.escape(getUserName()));
414 model.setCreateDate(getCreateDate());
415 model.setModifiedDate(getModifiedDate());
416 model.setTemplateId(getTemplateId());
417 model.setStructureId(getStructureId());
418 model.setName(HtmlUtil.escape(getName()));
419 model.setDescription(HtmlUtil.escape(getDescription()));
420 model.setXsl(HtmlUtil.escape(getXsl()));
421 model.setLangType(HtmlUtil.escape(getLangType()));
422 model.setCacheable(getCacheable());
423 model.setSmallImage(getSmallImage());
424 model.setSmallImageId(getSmallImageId());
425 model.setSmallImageURL(HtmlUtil.escape(getSmallImageURL()));
426
427 model = (JournalTemplate)Proxy.newProxyInstance(JournalTemplate.class.getClassLoader(),
428 new Class[] { JournalTemplate.class },
429 new ReadOnlyBeanHandler(model));
430
431 return model;
432 }
433 }
434
435 public Object clone() {
436 JournalTemplateImpl clone = new JournalTemplateImpl();
437
438 clone.setUuid(getUuid());
439 clone.setId(getId());
440 clone.setGroupId(getGroupId());
441 clone.setCompanyId(getCompanyId());
442 clone.setUserId(getUserId());
443 clone.setUserName(getUserName());
444 clone.setCreateDate(getCreateDate());
445 clone.setModifiedDate(getModifiedDate());
446 clone.setTemplateId(getTemplateId());
447 clone.setStructureId(getStructureId());
448 clone.setName(getName());
449 clone.setDescription(getDescription());
450 clone.setXsl(getXsl());
451 clone.setLangType(getLangType());
452 clone.setCacheable(getCacheable());
453 clone.setSmallImage(getSmallImage());
454 clone.setSmallImageId(getSmallImageId());
455 clone.setSmallImageURL(getSmallImageURL());
456
457 return clone;
458 }
459
460 public int compareTo(Object obj) {
461 if (obj == null) {
462 return -1;
463 }
464
465 JournalTemplateImpl journalTemplate = (JournalTemplateImpl)obj;
466
467 int value = 0;
468
469 value = getTemplateId().compareTo(journalTemplate.getTemplateId());
470
471 if (value != 0) {
472 return value;
473 }
474
475 return 0;
476 }
477
478 public boolean equals(Object obj) {
479 if (obj == null) {
480 return false;
481 }
482
483 JournalTemplateImpl journalTemplate = null;
484
485 try {
486 journalTemplate = (JournalTemplateImpl)obj;
487 }
488 catch (ClassCastException cce) {
489 return false;
490 }
491
492 long pk = journalTemplate.getPrimaryKey();
493
494 if (getPrimaryKey() == pk) {
495 return true;
496 }
497 else {
498 return false;
499 }
500 }
501
502 public int hashCode() {
503 return (int)getPrimaryKey();
504 }
505
506 private String _uuid;
507 private long _id;
508 private long _groupId;
509 private long _companyId;
510 private long _userId;
511 private String _userName;
512 private Date _createDate;
513 private Date _modifiedDate;
514 private String _templateId;
515 private String _structureId;
516 private String _name;
517 private String _description;
518 private String _xsl;
519 private String _langType;
520 private boolean _cacheable;
521 private boolean _smallImage;
522 private long _smallImageId;
523 private String _smallImageURL;
524 }