1   /**
2    * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
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.model.impl.BaseModelImpl;
28  import com.liferay.portal.util.PropsUtil;
29  
30  import com.liferay.portlet.journal.model.JournalTemplate;
31  
32  import com.liferay.util.Html;
33  
34  import java.io.Serializable;
35  
36  import java.lang.reflect.Proxy;
37  
38  import java.sql.Types;
39  
40  import java.util.Date;
41  
42  /**
43   * <a href="JournalTemplateModelImpl.java.html"><b><i>View Source</i></b></a>
44   *
45   * <p>
46   * ServiceBuilder generated this class. Modifications in this class will be
47   * overwritten the next time is generated.
48   * </p>
49   *
50   * <p>
51   * This class is a model that represents the <code>JournalTemplate</code> table
52   * in the database.
53   * </p>
54   *
55   * @author Brian Wing Shun Chan
56   *
57   * @see com.liferay.portlet.journal.service.model.JournalTemplate
58   * @see com.liferay.portlet.journal.service.model.JournalTemplateModel
59   * @see com.liferay.portlet.journal.service.model.impl.JournalTemplateImpl
60   *
61   */
62  public class JournalTemplateModelImpl extends BaseModelImpl {
63      public static final String TABLE_NAME = "JournalTemplate";
64      public static final Object[][] TABLE_COLUMNS = {
65              { "uuid_", new Integer(Types.VARCHAR) },
66              
67  
68              { "id_", new Integer(Types.BIGINT) },
69              
70  
71              { "groupId", new Integer(Types.BIGINT) },
72              
73  
74              { "companyId", new Integer(Types.BIGINT) },
75              
76  
77              { "userId", new Integer(Types.BIGINT) },
78              
79  
80              { "userName", new Integer(Types.VARCHAR) },
81              
82  
83              { "createDate", new Integer(Types.TIMESTAMP) },
84              
85  
86              { "modifiedDate", new Integer(Types.TIMESTAMP) },
87              
88  
89              { "templateId", new Integer(Types.VARCHAR) },
90              
91  
92              { "structureId", new Integer(Types.VARCHAR) },
93              
94  
95              { "name", new Integer(Types.VARCHAR) },
96              
97  
98              { "description", new Integer(Types.VARCHAR) },
99              
100 
101             { "xsl", new Integer(Types.CLOB) },
102             
103 
104             { "langType", new Integer(Types.VARCHAR) },
105             
106 
107             { "cacheable", new Integer(Types.BOOLEAN) },
108             
109 
110             { "smallImage", new Integer(Types.BOOLEAN) },
111             
112 
113             { "smallImageId", new Integer(Types.BIGINT) },
114             
115 
116             { "smallImageURL", new Integer(Types.VARCHAR) }
117         };
118     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)";
119     public static final String TABLE_SQL_DROP = "drop table JournalTemplate";
120     public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
121                 "value.object.finder.cache.enabled.com.liferay.portlet.journal.model.JournalTemplate"),
122             true);
123     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
124                 "lock.expiration.time.com.liferay.portlet.journal.model.JournalTemplate"));
125 
126     public JournalTemplateModelImpl() {
127     }
128 
129     public long getPrimaryKey() {
130         return _id;
131     }
132 
133     public void setPrimaryKey(long pk) {
134         setId(pk);
135     }
136 
137     public Serializable getPrimaryKeyObj() {
138         return new Long(_id);
139     }
140 
141     public String getUuid() {
142         return GetterUtil.getString(_uuid);
143     }
144 
145     public void setUuid(String uuid) {
146         if ((uuid != null) && (uuid != _uuid)) {
147             _uuid = uuid;
148         }
149     }
150 
151     public long getId() {
152         return _id;
153     }
154 
155     public void setId(long id) {
156         if (id != _id) {
157             _id = id;
158         }
159     }
160 
161     public long getGroupId() {
162         return _groupId;
163     }
164 
165     public void setGroupId(long groupId) {
166         if (groupId != _groupId) {
167             _groupId = groupId;
168         }
169     }
170 
171     public long getCompanyId() {
172         return _companyId;
173     }
174 
175     public void setCompanyId(long companyId) {
176         if (companyId != _companyId) {
177             _companyId = companyId;
178         }
179     }
180 
181     public long getUserId() {
182         return _userId;
183     }
184 
185     public void setUserId(long userId) {
186         if (userId != _userId) {
187             _userId = userId;
188         }
189     }
190 
191     public String getUserName() {
192         return GetterUtil.getString(_userName);
193     }
194 
195     public void setUserName(String userName) {
196         if (((userName == null) && (_userName != null)) ||
197                 ((userName != null) && (_userName == null)) ||
198                 ((userName != null) && (_userName != null) &&
199                 !userName.equals(_userName))) {
200             _userName = userName;
201         }
202     }
203 
204     public Date getCreateDate() {
205         return _createDate;
206     }
207 
208     public void setCreateDate(Date createDate) {
209         if (((createDate == null) && (_createDate != null)) ||
210                 ((createDate != null) && (_createDate == null)) ||
211                 ((createDate != null) && (_createDate != null) &&
212                 !createDate.equals(_createDate))) {
213             _createDate = createDate;
214         }
215     }
216 
217     public Date getModifiedDate() {
218         return _modifiedDate;
219     }
220 
221     public void setModifiedDate(Date modifiedDate) {
222         if (((modifiedDate == null) && (_modifiedDate != null)) ||
223                 ((modifiedDate != null) && (_modifiedDate == null)) ||
224                 ((modifiedDate != null) && (_modifiedDate != null) &&
225                 !modifiedDate.equals(_modifiedDate))) {
226             _modifiedDate = modifiedDate;
227         }
228     }
229 
230     public String getTemplateId() {
231         return GetterUtil.getString(_templateId);
232     }
233 
234     public void setTemplateId(String templateId) {
235         if (((templateId == null) && (_templateId != null)) ||
236                 ((templateId != null) && (_templateId == null)) ||
237                 ((templateId != null) && (_templateId != null) &&
238                 !templateId.equals(_templateId))) {
239             _templateId = templateId;
240         }
241     }
242 
243     public String getStructureId() {
244         return GetterUtil.getString(_structureId);
245     }
246 
247     public void setStructureId(String structureId) {
248         if (((structureId == null) && (_structureId != null)) ||
249                 ((structureId != null) && (_structureId == null)) ||
250                 ((structureId != null) && (_structureId != null) &&
251                 !structureId.equals(_structureId))) {
252             _structureId = structureId;
253         }
254     }
255 
256     public String getName() {
257         return GetterUtil.getString(_name);
258     }
259 
260     public void setName(String name) {
261         if (((name == null) && (_name != null)) ||
262                 ((name != null) && (_name == null)) ||
263                 ((name != null) && (_name != null) && !name.equals(_name))) {
264             _name = name;
265         }
266     }
267 
268     public String getDescription() {
269         return GetterUtil.getString(_description);
270     }
271 
272     public void setDescription(String description) {
273         if (((description == null) && (_description != null)) ||
274                 ((description != null) && (_description == null)) ||
275                 ((description != null) && (_description != null) &&
276                 !description.equals(_description))) {
277             _description = description;
278         }
279     }
280 
281     public String getXsl() {
282         return GetterUtil.getString(_xsl);
283     }
284 
285     public void setXsl(String xsl) {
286         if (((xsl == null) && (_xsl != null)) ||
287                 ((xsl != null) && (_xsl == null)) ||
288                 ((xsl != null) && (_xsl != null) && !xsl.equals(_xsl))) {
289             _xsl = xsl;
290         }
291     }
292 
293     public String getLangType() {
294         return GetterUtil.getString(_langType);
295     }
296 
297     public void setLangType(String langType) {
298         if (((langType == null) && (_langType != null)) ||
299                 ((langType != null) && (_langType == null)) ||
300                 ((langType != null) && (_langType != null) &&
301                 !langType.equals(_langType))) {
302             _langType = langType;
303         }
304     }
305 
306     public boolean getCacheable() {
307         return _cacheable;
308     }
309 
310     public boolean isCacheable() {
311         return _cacheable;
312     }
313 
314     public void setCacheable(boolean cacheable) {
315         if (cacheable != _cacheable) {
316             _cacheable = cacheable;
317         }
318     }
319 
320     public boolean getSmallImage() {
321         return _smallImage;
322     }
323 
324     public boolean isSmallImage() {
325         return _smallImage;
326     }
327 
328     public void setSmallImage(boolean smallImage) {
329         if (smallImage != _smallImage) {
330             _smallImage = smallImage;
331         }
332     }
333 
334     public long getSmallImageId() {
335         return _smallImageId;
336     }
337 
338     public void setSmallImageId(long smallImageId) {
339         if (smallImageId != _smallImageId) {
340             _smallImageId = smallImageId;
341         }
342     }
343 
344     public String getSmallImageURL() {
345         return GetterUtil.getString(_smallImageURL);
346     }
347 
348     public void setSmallImageURL(String smallImageURL) {
349         if (((smallImageURL == null) && (_smallImageURL != null)) ||
350                 ((smallImageURL != null) && (_smallImageURL == null)) ||
351                 ((smallImageURL != null) && (_smallImageURL != null) &&
352                 !smallImageURL.equals(_smallImageURL))) {
353             _smallImageURL = smallImageURL;
354         }
355     }
356 
357     public JournalTemplate toEscapedModel() {
358         if (isEscapedModel()) {
359             return (JournalTemplate)this;
360         }
361         else {
362             JournalTemplate model = new JournalTemplateImpl();
363 
364             model.setEscapedModel(true);
365 
366             model.setUuid(Html.escape(getUuid()));
367             model.setId(getId());
368             model.setGroupId(getGroupId());
369             model.setCompanyId(getCompanyId());
370             model.setUserId(getUserId());
371             model.setUserName(Html.escape(getUserName()));
372             model.setCreateDate(getCreateDate());
373             model.setModifiedDate(getModifiedDate());
374             model.setTemplateId(getTemplateId());
375             model.setStructureId(getStructureId());
376             model.setName(Html.escape(getName()));
377             model.setDescription(Html.escape(getDescription()));
378             model.setXsl(Html.escape(getXsl()));
379             model.setLangType(Html.escape(getLangType()));
380             model.setCacheable(getCacheable());
381             model.setSmallImage(getSmallImage());
382             model.setSmallImageId(getSmallImageId());
383             model.setSmallImageURL(Html.escape(getSmallImageURL()));
384 
385             model = (JournalTemplate)Proxy.newProxyInstance(JournalTemplate.class.getClassLoader(),
386                     new Class[] { JournalTemplate.class },
387                     new ReadOnlyBeanHandler(model));
388 
389             return model;
390         }
391     }
392 
393     public Object clone() {
394         JournalTemplateImpl clone = new JournalTemplateImpl();
395 
396         clone.setUuid(getUuid());
397         clone.setId(getId());
398         clone.setGroupId(getGroupId());
399         clone.setCompanyId(getCompanyId());
400         clone.setUserId(getUserId());
401         clone.setUserName(getUserName());
402         clone.setCreateDate(getCreateDate());
403         clone.setModifiedDate(getModifiedDate());
404         clone.setTemplateId(getTemplateId());
405         clone.setStructureId(getStructureId());
406         clone.setName(getName());
407         clone.setDescription(getDescription());
408         clone.setXsl(getXsl());
409         clone.setLangType(getLangType());
410         clone.setCacheable(getCacheable());
411         clone.setSmallImage(getSmallImage());
412         clone.setSmallImageId(getSmallImageId());
413         clone.setSmallImageURL(getSmallImageURL());
414 
415         return clone;
416     }
417 
418     public int compareTo(Object obj) {
419         if (obj == null) {
420             return -1;
421         }
422 
423         JournalTemplateImpl journalTemplate = (JournalTemplateImpl)obj;
424 
425         int value = 0;
426 
427         value = getTemplateId().compareTo(journalTemplate.getTemplateId());
428 
429         if (value != 0) {
430             return value;
431         }
432 
433         return 0;
434     }
435 
436     public boolean equals(Object obj) {
437         if (obj == null) {
438             return false;
439         }
440 
441         JournalTemplateImpl journalTemplate = null;
442 
443         try {
444             journalTemplate = (JournalTemplateImpl)obj;
445         }
446         catch (ClassCastException cce) {
447             return false;
448         }
449 
450         long pk = journalTemplate.getPrimaryKey();
451 
452         if (getPrimaryKey() == pk) {
453             return true;
454         }
455         else {
456             return false;
457         }
458     }
459 
460     public int hashCode() {
461         return (int)getPrimaryKey();
462     }
463 
464     private String _uuid;
465     private long _id;
466     private long _groupId;
467     private long _companyId;
468     private long _userId;
469     private String _userName;
470     private Date _createDate;
471     private Date _modifiedDate;
472     private String _templateId;
473     private String _structureId;
474     private String _name;
475     private String _description;
476     private String _xsl;
477     private String _langType;
478     private boolean _cacheable;
479     private boolean _smallImage;
480     private long _smallImageId;
481     private String _smallImageURL;
482 }