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="JournalStructureModelImpl.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>JournalStructure</code> table
47   * in the database.
48   * </p>
49   *
50   * @author Brian Wing Shun Chan
51   *
52   * @see com.liferay.portlet.journal.service.model.JournalStructure
53   * @see com.liferay.portlet.journal.service.model.JournalStructureModel
54   * @see com.liferay.portlet.journal.service.model.impl.JournalStructureImpl
55   *
56   */
57  public class JournalStructureModelImpl extends BaseModelImpl {
58      public static String TABLE_NAME = "JournalStructure";
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              { "structureId", new Integer(Types.VARCHAR) },
68              { "name", new Integer(Types.VARCHAR) },
69              { "description", new Integer(Types.VARCHAR) },
70              { "xsd", new Integer(Types.CLOB) }
71          };
72      public static String TABLE_SQL_CREATE = "create table JournalStructure (id_ LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,structureId VARCHAR(75) null,name VARCHAR(75) null,description STRING null,xsd TEXT null)";
73      public static String TABLE_SQL_DROP = "drop table JournalStructure";
74      public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
75                  "xss.allow.com.liferay.portlet.journal.model.JournalStructure"),
76              XSS_ALLOW);
77      public static boolean XSS_ALLOW_USERNAME = GetterUtil.getBoolean(PropsUtil.get(
78                  "xss.allow.com.liferay.portlet.journal.model.JournalStructure.userName"),
79              XSS_ALLOW_BY_MODEL);
80      public static boolean XSS_ALLOW_STRUCTUREID = GetterUtil.getBoolean(PropsUtil.get(
81                  "xss.allow.com.liferay.portlet.journal.model.JournalStructure.structureId"),
82              XSS_ALLOW_BY_MODEL);
83      public static boolean XSS_ALLOW_NAME = GetterUtil.getBoolean(PropsUtil.get(
84                  "xss.allow.com.liferay.portlet.journal.model.JournalStructure.name"),
85              XSS_ALLOW_BY_MODEL);
86      public static boolean XSS_ALLOW_DESCRIPTION = GetterUtil.getBoolean(PropsUtil.get(
87                  "xss.allow.com.liferay.portlet.journal.model.JournalStructure.description"),
88              XSS_ALLOW_BY_MODEL);
89      public static boolean XSS_ALLOW_XSD = GetterUtil.getBoolean(PropsUtil.get(
90                  "xss.allow.com.liferay.portlet.journal.model.JournalStructure.xsd"),
91              XSS_ALLOW_BY_MODEL);
92      public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
93                  "lock.expiration.time.com.liferay.portlet.journal.model.JournalStructureModel"));
94  
95      public JournalStructureModelImpl() {
96      }
97  
98      public long getPrimaryKey() {
99          return _id;
100     }
101 
102     public void setPrimaryKey(long pk) {
103         setId(pk);
104     }
105 
106     public Serializable getPrimaryKeyObj() {
107         return new Long(_id);
108     }
109 
110     public long getId() {
111         return _id;
112     }
113 
114     public void setId(long id) {
115         if (id != _id) {
116             _id = id;
117         }
118     }
119 
120     public long getGroupId() {
121         return _groupId;
122     }
123 
124     public void setGroupId(long groupId) {
125         if (groupId != _groupId) {
126             _groupId = groupId;
127         }
128     }
129 
130     public long getCompanyId() {
131         return _companyId;
132     }
133 
134     public void setCompanyId(long companyId) {
135         if (companyId != _companyId) {
136             _companyId = companyId;
137         }
138     }
139 
140     public long getUserId() {
141         return _userId;
142     }
143 
144     public void setUserId(long userId) {
145         if (userId != _userId) {
146             _userId = userId;
147         }
148     }
149 
150     public String getUserName() {
151         return GetterUtil.getString(_userName);
152     }
153 
154     public void setUserName(String userName) {
155         if (((userName == null) && (_userName != null)) ||
156                 ((userName != null) && (_userName == null)) ||
157                 ((userName != null) && (_userName != null) &&
158                 !userName.equals(_userName))) {
159             if (!XSS_ALLOW_USERNAME) {
160                 userName = XSSUtil.strip(userName);
161             }
162 
163             _userName = userName;
164         }
165     }
166 
167     public Date getCreateDate() {
168         return _createDate;
169     }
170 
171     public void setCreateDate(Date createDate) {
172         if (((createDate == null) && (_createDate != null)) ||
173                 ((createDate != null) && (_createDate == null)) ||
174                 ((createDate != null) && (_createDate != null) &&
175                 !createDate.equals(_createDate))) {
176             _createDate = createDate;
177         }
178     }
179 
180     public Date getModifiedDate() {
181         return _modifiedDate;
182     }
183 
184     public void setModifiedDate(Date modifiedDate) {
185         if (((modifiedDate == null) && (_modifiedDate != null)) ||
186                 ((modifiedDate != null) && (_modifiedDate == null)) ||
187                 ((modifiedDate != null) && (_modifiedDate != null) &&
188                 !modifiedDate.equals(_modifiedDate))) {
189             _modifiedDate = modifiedDate;
190         }
191     }
192 
193     public String getStructureId() {
194         return GetterUtil.getString(_structureId);
195     }
196 
197     public void setStructureId(String structureId) {
198         if (((structureId == null) && (_structureId != null)) ||
199                 ((structureId != null) && (_structureId == null)) ||
200                 ((structureId != null) && (_structureId != null) &&
201                 !structureId.equals(_structureId))) {
202             if (!XSS_ALLOW_STRUCTUREID) {
203                 structureId = XSSUtil.strip(structureId);
204             }
205 
206             _structureId = structureId;
207         }
208     }
209 
210     public String getName() {
211         return GetterUtil.getString(_name);
212     }
213 
214     public void setName(String name) {
215         if (((name == null) && (_name != null)) ||
216                 ((name != null) && (_name == null)) ||
217                 ((name != null) && (_name != null) && !name.equals(_name))) {
218             if (!XSS_ALLOW_NAME) {
219                 name = XSSUtil.strip(name);
220             }
221 
222             _name = name;
223         }
224     }
225 
226     public String getDescription() {
227         return GetterUtil.getString(_description);
228     }
229 
230     public void setDescription(String description) {
231         if (((description == null) && (_description != null)) ||
232                 ((description != null) && (_description == null)) ||
233                 ((description != null) && (_description != null) &&
234                 !description.equals(_description))) {
235             if (!XSS_ALLOW_DESCRIPTION) {
236                 description = XSSUtil.strip(description);
237             }
238 
239             _description = description;
240         }
241     }
242 
243     public String getXsd() {
244         return GetterUtil.getString(_xsd);
245     }
246 
247     public void setXsd(String xsd) {
248         if (((xsd == null) && (_xsd != null)) ||
249                 ((xsd != null) && (_xsd == null)) ||
250                 ((xsd != null) && (_xsd != null) && !xsd.equals(_xsd))) {
251             if (!XSS_ALLOW_XSD) {
252                 xsd = XSSUtil.strip(xsd);
253             }
254 
255             _xsd = xsd;
256         }
257     }
258 
259     public Object clone() {
260         JournalStructureImpl clone = new JournalStructureImpl();
261         clone.setId(getId());
262         clone.setGroupId(getGroupId());
263         clone.setCompanyId(getCompanyId());
264         clone.setUserId(getUserId());
265         clone.setUserName(getUserName());
266         clone.setCreateDate(getCreateDate());
267         clone.setModifiedDate(getModifiedDate());
268         clone.setStructureId(getStructureId());
269         clone.setName(getName());
270         clone.setDescription(getDescription());
271         clone.setXsd(getXsd());
272 
273         return clone;
274     }
275 
276     public int compareTo(Object obj) {
277         if (obj == null) {
278             return -1;
279         }
280 
281         JournalStructureImpl journalStructure = (JournalStructureImpl)obj;
282         int value = 0;
283         value = getStructureId().compareTo(journalStructure.getStructureId());
284 
285         if (value != 0) {
286             return value;
287         }
288 
289         return 0;
290     }
291 
292     public boolean equals(Object obj) {
293         if (obj == null) {
294             return false;
295         }
296 
297         JournalStructureImpl journalStructure = null;
298 
299         try {
300             journalStructure = (JournalStructureImpl)obj;
301         }
302         catch (ClassCastException cce) {
303             return false;
304         }
305 
306         long pk = journalStructure.getPrimaryKey();
307 
308         if (getPrimaryKey() == pk) {
309             return true;
310         }
311         else {
312             return false;
313         }
314     }
315 
316     public int hashCode() {
317         return (int)getPrimaryKey();
318     }
319 
320     private long _id;
321     private long _groupId;
322     private long _companyId;
323     private long _userId;
324     private String _userName;
325     private Date _createDate;
326     private Date _modifiedDate;
327     private String _structureId;
328     private String _name;
329     private String _description;
330     private String _xsd;
331 }