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