1   /**
2    * Copyright (c) 2000-2007 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.util.GetterUtil;
26  import com.liferay.portal.model.impl.BaseModelImpl;
27  import com.liferay.portal.util.PropsUtil;
28  
29  import com.liferay.util.XSSUtil;
30  
31  import java.io.Serializable;
32  
33  import java.sql.Types;
34  
35  import java.util.Date;
36  
37  /**
38   * <a href="JournalTemplateModelImpl.java.html"><b><i>View Source</i></b></a>
39   *
40   * <p>
41   * ServiceBuilder generated this class. Modifications in this class will be overwritten
42   * the next time is generated.
43   * </p>
44   *
45   * <p>
46   * This class is a model that represents the <code>JournalTemplate</code> table
47   * in the database.
48   * </p>
49   *
50   * @author Brian Wing Shun Chan
51   *
52   * @see com.liferay.portlet.journal.service.model.JournalTemplate
53   * @see com.liferay.portlet.journal.service.model.JournalTemplateModel
54   * @see com.liferay.portlet.journal.service.model.impl.JournalTemplateImpl
55   *
56   */
57  public class JournalTemplateModelImpl extends BaseModelImpl {
58      public static String TABLE_NAME = "JournalTemplate";
59      public static Object[][] TABLE_COLUMNS = {
60              { "id_", new Integer(Types.BIGINT) },
61              { "groupId", new Integer(Types.BIGINT) },
62              { "companyId", new Integer(Types.BIGINT) },
63              { "userId", new Integer(Types.BIGINT) },
64              { "userName", new Integer(Types.VARCHAR) },
65              { "createDate", new Integer(Types.TIMESTAMP) },
66              { "modifiedDate", new Integer(Types.TIMESTAMP) },
67              { "templateId", new Integer(Types.VARCHAR) },
68              { "structureId", new Integer(Types.VARCHAR) },
69              { "name", new Integer(Types.VARCHAR) },
70              { "description", new Integer(Types.VARCHAR) },
71              { "xsl", new Integer(Types.CLOB) },
72              { "langType", new Integer(Types.VARCHAR) },
73              { "smallImage", new Integer(Types.BOOLEAN) },
74              { "smallImageId", new Integer(Types.BIGINT) },
75              { "smallImageURL", new Integer(Types.VARCHAR) }
76          };
77      public static String TABLE_SQL_CREATE = "create table JournalTemplate (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,smallImage BOOLEAN,smallImageId LONG,smallImageURL VARCHAR(75) null)";
78      public static String TABLE_SQL_DROP = "drop table JournalTemplate";
79      public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
80                  "xss.allow.com.liferay.portlet.journal.model.JournalTemplate"),
81              XSS_ALLOW);
82      public static boolean XSS_ALLOW_USERNAME = GetterUtil.getBoolean(PropsUtil.get(
83                  "xss.allow.com.liferay.portlet.journal.model.JournalTemplate.userName"),
84              XSS_ALLOW_BY_MODEL);
85      public static boolean XSS_ALLOW_TEMPLATEID = GetterUtil.getBoolean(PropsUtil.get(
86                  "xss.allow.com.liferay.portlet.journal.model.JournalTemplate.templateId"),
87              XSS_ALLOW_BY_MODEL);
88      public static boolean XSS_ALLOW_STRUCTUREID = GetterUtil.getBoolean(PropsUtil.get(
89                  "xss.allow.com.liferay.portlet.journal.model.JournalTemplate.structureId"),
90              XSS_ALLOW_BY_MODEL);
91      public static boolean XSS_ALLOW_NAME = GetterUtil.getBoolean(PropsUtil.get(
92                  "xss.allow.com.liferay.portlet.journal.model.JournalTemplate.name"),
93              XSS_ALLOW_BY_MODEL);
94      public static boolean XSS_ALLOW_DESCRIPTION = GetterUtil.getBoolean(PropsUtil.get(
95                  "xss.allow.com.liferay.portlet.journal.model.JournalTemplate.description"),
96              XSS_ALLOW_BY_MODEL);
97      public static boolean XSS_ALLOW_XSL = GetterUtil.getBoolean(PropsUtil.get(
98                  "xss.allow.com.liferay.portlet.journal.model.JournalTemplate.xsl"),
99              XSS_ALLOW_BY_MODEL);
100     public static boolean XSS_ALLOW_LANGTYPE = GetterUtil.getBoolean(PropsUtil.get(
101                 "xss.allow.com.liferay.portlet.journal.model.JournalTemplate.langType"),
102             XSS_ALLOW_BY_MODEL);
103     public static boolean XSS_ALLOW_SMALLIMAGEURL = GetterUtil.getBoolean(PropsUtil.get(
104                 "xss.allow.com.liferay.portlet.journal.model.JournalTemplate.smallImageURL"),
105             XSS_ALLOW_BY_MODEL);
106     public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
107                 "lock.expiration.time.com.liferay.portlet.journal.model.JournalTemplateModel"));
108 
109     public JournalTemplateModelImpl() {
110     }
111 
112     public long getPrimaryKey() {
113         return _id;
114     }
115 
116     public void setPrimaryKey(long pk) {
117         setId(pk);
118     }
119 
120     public Serializable getPrimaryKeyObj() {
121         return new Long(_id);
122     }
123 
124     public long getId() {
125         return _id;
126     }
127 
128     public void setId(long id) {
129         if (id != _id) {
130             _id = id;
131         }
132     }
133 
134     public long getGroupId() {
135         return _groupId;
136     }
137 
138     public void setGroupId(long groupId) {
139         if (groupId != _groupId) {
140             _groupId = groupId;
141         }
142     }
143 
144     public long getCompanyId() {
145         return _companyId;
146     }
147 
148     public void setCompanyId(long companyId) {
149         if (companyId != _companyId) {
150             _companyId = companyId;
151         }
152     }
153 
154     public long getUserId() {
155         return _userId;
156     }
157 
158     public void setUserId(long userId) {
159         if (userId != _userId) {
160             _userId = userId;
161         }
162     }
163 
164     public String getUserName() {
165         return GetterUtil.getString(_userName);
166     }
167 
168     public void setUserName(String userName) {
169         if (((userName == null) && (_userName != null)) ||
170                 ((userName != null) && (_userName == null)) ||
171                 ((userName != null) && (_userName != null) &&
172                 !userName.equals(_userName))) {
173             if (!XSS_ALLOW_USERNAME) {
174                 userName = XSSUtil.strip(userName);
175             }
176 
177             _userName = userName;
178         }
179     }
180 
181     public Date getCreateDate() {
182         return _createDate;
183     }
184 
185     public void setCreateDate(Date createDate) {
186         if (((createDate == null) && (_createDate != null)) ||
187                 ((createDate != null) && (_createDate == null)) ||
188                 ((createDate != null) && (_createDate != null) &&
189                 !createDate.equals(_createDate))) {
190             _createDate = createDate;
191         }
192     }
193 
194     public Date getModifiedDate() {
195         return _modifiedDate;
196     }
197 
198     public void setModifiedDate(Date modifiedDate) {
199         if (((modifiedDate == null) && (_modifiedDate != null)) ||
200                 ((modifiedDate != null) && (_modifiedDate == null)) ||
201                 ((modifiedDate != null) && (_modifiedDate != null) &&
202                 !modifiedDate.equals(_modifiedDate))) {
203             _modifiedDate = modifiedDate;
204         }
205     }
206 
207     public String getTemplateId() {
208         return GetterUtil.getString(_templateId);
209     }
210 
211     public void setTemplateId(String templateId) {
212         if (((templateId == null) && (_templateId != null)) ||
213                 ((templateId != null) && (_templateId == null)) ||
214                 ((templateId != null) && (_templateId != null) &&
215                 !templateId.equals(_templateId))) {
216             if (!XSS_ALLOW_TEMPLATEID) {
217                 templateId = XSSUtil.strip(templateId);
218             }
219 
220             _templateId = templateId;
221         }
222     }
223 
224     public String getStructureId() {
225         return GetterUtil.getString(_structureId);
226     }
227 
228     public void setStructureId(String structureId) {
229         if (((structureId == null) && (_structureId != null)) ||
230                 ((structureId != null) && (_structureId == null)) ||
231                 ((structureId != null) && (_structureId != null) &&
232                 !structureId.equals(_structureId))) {
233             if (!XSS_ALLOW_STRUCTUREID) {
234                 structureId = XSSUtil.strip(structureId);
235             }
236 
237             _structureId = structureId;
238         }
239     }
240 
241     public String getName() {
242         return GetterUtil.getString(_name);
243     }
244 
245     public void setName(String name) {
246         if (((name == null) && (_name != null)) ||
247                 ((name != null) && (_name == null)) ||
248                 ((name != null) && (_name != null) && !name.equals(_name))) {
249             if (!XSS_ALLOW_NAME) {
250                 name = XSSUtil.strip(name);
251             }
252 
253             _name = name;
254         }
255     }
256 
257     public String getDescription() {
258         return GetterUtil.getString(_description);
259     }
260 
261     public void setDescription(String description) {
262         if (((description == null) && (_description != null)) ||
263                 ((description != null) && (_description == null)) ||
264                 ((description != null) && (_description != null) &&
265                 !description.equals(_description))) {
266             if (!XSS_ALLOW_DESCRIPTION) {
267                 description = XSSUtil.strip(description);
268             }
269 
270             _description = description;
271         }
272     }
273 
274     public String getXsl() {
275         return GetterUtil.getString(_xsl);
276     }
277 
278     public void setXsl(String xsl) {
279         if (((xsl == null) && (_xsl != null)) ||
280                 ((xsl != null) && (_xsl == null)) ||
281                 ((xsl != null) && (_xsl != null) && !xsl.equals(_xsl))) {
282             if (!XSS_ALLOW_XSL) {
283                 xsl = XSSUtil.strip(xsl);
284             }
285 
286             _xsl = xsl;
287         }
288     }
289 
290     public String getLangType() {
291         return GetterUtil.getString(_langType);
292     }
293 
294     public void setLangType(String langType) {
295         if (((langType == null) && (_langType != null)) ||
296                 ((langType != null) && (_langType == null)) ||
297                 ((langType != null) && (_langType != null) &&
298                 !langType.equals(_langType))) {
299             if (!XSS_ALLOW_LANGTYPE) {
300                 langType = XSSUtil.strip(langType);
301             }
302 
303             _langType = langType;
304         }
305     }
306 
307     public boolean getSmallImage() {
308         return _smallImage;
309     }
310 
311     public boolean isSmallImage() {
312         return _smallImage;
313     }
314 
315     public void setSmallImage(boolean smallImage) {
316         if (smallImage != _smallImage) {
317             _smallImage = smallImage;
318         }
319     }
320 
321     public long getSmallImageId() {
322         return _smallImageId;
323     }
324 
325     public void setSmallImageId(long smallImageId) {
326         if (smallImageId != _smallImageId) {
327             _smallImageId = smallImageId;
328         }
329     }
330 
331     public String getSmallImageURL() {
332         return GetterUtil.getString(_smallImageURL);
333     }
334 
335     public void setSmallImageURL(String smallImageURL) {
336         if (((smallImageURL == null) && (_smallImageURL != null)) ||
337                 ((smallImageURL != null) && (_smallImageURL == null)) ||
338                 ((smallImageURL != null) && (_smallImageURL != null) &&
339                 !smallImageURL.equals(_smallImageURL))) {
340             if (!XSS_ALLOW_SMALLIMAGEURL) {
341                 smallImageURL = XSSUtil.strip(smallImageURL);
342             }
343 
344             _smallImageURL = smallImageURL;
345         }
346     }
347 
348     public Object clone() {
349         JournalTemplateImpl clone = new JournalTemplateImpl();
350         clone.setId(getId());
351         clone.setGroupId(getGroupId());
352         clone.setCompanyId(getCompanyId());
353         clone.setUserId(getUserId());
354         clone.setUserName(getUserName());
355         clone.setCreateDate(getCreateDate());
356         clone.setModifiedDate(getModifiedDate());
357         clone.setTemplateId(getTemplateId());
358         clone.setStructureId(getStructureId());
359         clone.setName(getName());
360         clone.setDescription(getDescription());
361         clone.setXsl(getXsl());
362         clone.setLangType(getLangType());
363         clone.setSmallImage(getSmallImage());
364         clone.setSmallImageId(getSmallImageId());
365         clone.setSmallImageURL(getSmallImageURL());
366 
367         return clone;
368     }
369 
370     public int compareTo(Object obj) {
371         if (obj == null) {
372             return -1;
373         }
374 
375         JournalTemplateImpl journalTemplate = (JournalTemplateImpl)obj;
376         int value = 0;
377         value = getTemplateId().compareTo(journalTemplate.getTemplateId());
378 
379         if (value != 0) {
380             return value;
381         }
382 
383         return 0;
384     }
385 
386     public boolean equals(Object obj) {
387         if (obj == null) {
388             return false;
389         }
390 
391         JournalTemplateImpl journalTemplate = null;
392 
393         try {
394             journalTemplate = (JournalTemplateImpl)obj;
395         }
396         catch (ClassCastException cce) {
397             return false;
398         }
399 
400         long pk = journalTemplate.getPrimaryKey();
401 
402         if (getPrimaryKey() == pk) {
403             return true;
404         }
405         else {
406             return false;
407         }
408     }
409 
410     public int hashCode() {
411         return (int)getPrimaryKey();
412     }
413 
414     private long _id;
415     private long _groupId;
416     private long _companyId;
417     private long _userId;
418     private String _userName;
419     private Date _createDate;
420     private Date _modifiedDate;
421     private String _templateId;
422     private String _structureId;
423     private String _name;
424     private String _description;
425     private String _xsl;
426     private String _langType;
427     private boolean _smallImage;
428     private long _smallImageId;
429     private String _smallImageURL;
430 }