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.JournalStructure;
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="JournalStructureModelImpl.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>JournalStructure</code> table
52   * in the database.
53   * </p>
54   *
55   * @author Brian Wing Shun Chan
56   *
57   * @see com.liferay.portlet.journal.service.model.JournalStructure
58   * @see com.liferay.portlet.journal.service.model.JournalStructureModel
59   * @see com.liferay.portlet.journal.service.model.impl.JournalStructureImpl
60   *
61   */
62  public class JournalStructureModelImpl extends BaseModelImpl {
63      public static final String TABLE_NAME = "JournalStructure";
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              { "structureId", new Integer(Types.VARCHAR) },
90              
91  
92              { "name", new Integer(Types.VARCHAR) },
93              
94  
95              { "description", new Integer(Types.VARCHAR) },
96              
97  
98              { "xsd", new Integer(Types.CLOB) }
99          };
100     public static final String TABLE_SQL_CREATE = "create table JournalStructure (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,structureId VARCHAR(75) null,name VARCHAR(75) null,description STRING null,xsd TEXT null)";
101     public static final String TABLE_SQL_DROP = "drop table JournalStructure";
102     public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
103                 "value.object.finder.cache.enabled.com.liferay.portlet.journal.model.JournalStructure"),
104             true);
105     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
106                 "lock.expiration.time.com.liferay.portlet.journal.model.JournalStructure"));
107 
108     public JournalStructureModelImpl() {
109     }
110 
111     public long getPrimaryKey() {
112         return _id;
113     }
114 
115     public void setPrimaryKey(long pk) {
116         setId(pk);
117     }
118 
119     public Serializable getPrimaryKeyObj() {
120         return new Long(_id);
121     }
122 
123     public String getUuid() {
124         return GetterUtil.getString(_uuid);
125     }
126 
127     public void setUuid(String uuid) {
128         if ((uuid != null) && (uuid != _uuid)) {
129             _uuid = uuid;
130         }
131     }
132 
133     public long getId() {
134         return _id;
135     }
136 
137     public void setId(long id) {
138         if (id != _id) {
139             _id = id;
140         }
141     }
142 
143     public long getGroupId() {
144         return _groupId;
145     }
146 
147     public void setGroupId(long groupId) {
148         if (groupId != _groupId) {
149             _groupId = groupId;
150         }
151     }
152 
153     public long getCompanyId() {
154         return _companyId;
155     }
156 
157     public void setCompanyId(long companyId) {
158         if (companyId != _companyId) {
159             _companyId = companyId;
160         }
161     }
162 
163     public long getUserId() {
164         return _userId;
165     }
166 
167     public void setUserId(long userId) {
168         if (userId != _userId) {
169             _userId = userId;
170         }
171     }
172 
173     public String getUserName() {
174         return GetterUtil.getString(_userName);
175     }
176 
177     public void setUserName(String userName) {
178         if (((userName == null) && (_userName != null)) ||
179                 ((userName != null) && (_userName == null)) ||
180                 ((userName != null) && (_userName != null) &&
181                 !userName.equals(_userName))) {
182             _userName = userName;
183         }
184     }
185 
186     public Date getCreateDate() {
187         return _createDate;
188     }
189 
190     public void setCreateDate(Date createDate) {
191         if (((createDate == null) && (_createDate != null)) ||
192                 ((createDate != null) && (_createDate == null)) ||
193                 ((createDate != null) && (_createDate != null) &&
194                 !createDate.equals(_createDate))) {
195             _createDate = createDate;
196         }
197     }
198 
199     public Date getModifiedDate() {
200         return _modifiedDate;
201     }
202 
203     public void setModifiedDate(Date modifiedDate) {
204         if (((modifiedDate == null) && (_modifiedDate != null)) ||
205                 ((modifiedDate != null) && (_modifiedDate == null)) ||
206                 ((modifiedDate != null) && (_modifiedDate != null) &&
207                 !modifiedDate.equals(_modifiedDate))) {
208             _modifiedDate = modifiedDate;
209         }
210     }
211 
212     public String getStructureId() {
213         return GetterUtil.getString(_structureId);
214     }
215 
216     public void setStructureId(String structureId) {
217         if (((structureId == null) && (_structureId != null)) ||
218                 ((structureId != null) && (_structureId == null)) ||
219                 ((structureId != null) && (_structureId != null) &&
220                 !structureId.equals(_structureId))) {
221             _structureId = structureId;
222         }
223     }
224 
225     public String getName() {
226         return GetterUtil.getString(_name);
227     }
228 
229     public void setName(String name) {
230         if (((name == null) && (_name != null)) ||
231                 ((name != null) && (_name == null)) ||
232                 ((name != null) && (_name != null) && !name.equals(_name))) {
233             _name = name;
234         }
235     }
236 
237     public String getDescription() {
238         return GetterUtil.getString(_description);
239     }
240 
241     public void setDescription(String description) {
242         if (((description == null) && (_description != null)) ||
243                 ((description != null) && (_description == null)) ||
244                 ((description != null) && (_description != null) &&
245                 !description.equals(_description))) {
246             _description = description;
247         }
248     }
249 
250     public String getXsd() {
251         return GetterUtil.getString(_xsd);
252     }
253 
254     public void setXsd(String xsd) {
255         if (((xsd == null) && (_xsd != null)) ||
256                 ((xsd != null) && (_xsd == null)) ||
257                 ((xsd != null) && (_xsd != null) && !xsd.equals(_xsd))) {
258             _xsd = xsd;
259         }
260     }
261 
262     public JournalStructure toEscapedModel() {
263         if (isEscapedModel()) {
264             return (JournalStructure)this;
265         }
266         else {
267             JournalStructure model = new JournalStructureImpl();
268 
269             model.setEscapedModel(true);
270 
271             model.setUuid(Html.escape(getUuid()));
272             model.setId(getId());
273             model.setGroupId(getGroupId());
274             model.setCompanyId(getCompanyId());
275             model.setUserId(getUserId());
276             model.setUserName(Html.escape(getUserName()));
277             model.setCreateDate(getCreateDate());
278             model.setModifiedDate(getModifiedDate());
279             model.setStructureId(getStructureId());
280             model.setName(Html.escape(getName()));
281             model.setDescription(Html.escape(getDescription()));
282             model.setXsd(Html.escape(getXsd()));
283 
284             model = (JournalStructure)Proxy.newProxyInstance(JournalStructure.class.getClassLoader(),
285                     new Class[] { JournalStructure.class },
286                     new ReadOnlyBeanHandler(model));
287 
288             return model;
289         }
290     }
291 
292     public Object clone() {
293         JournalStructureImpl clone = new JournalStructureImpl();
294 
295         clone.setUuid(getUuid());
296         clone.setId(getId());
297         clone.setGroupId(getGroupId());
298         clone.setCompanyId(getCompanyId());
299         clone.setUserId(getUserId());
300         clone.setUserName(getUserName());
301         clone.setCreateDate(getCreateDate());
302         clone.setModifiedDate(getModifiedDate());
303         clone.setStructureId(getStructureId());
304         clone.setName(getName());
305         clone.setDescription(getDescription());
306         clone.setXsd(getXsd());
307 
308         return clone;
309     }
310 
311     public int compareTo(Object obj) {
312         if (obj == null) {
313             return -1;
314         }
315 
316         JournalStructureImpl journalStructure = (JournalStructureImpl)obj;
317 
318         int value = 0;
319 
320         value = getStructureId().compareTo(journalStructure.getStructureId());
321 
322         if (value != 0) {
323             return value;
324         }
325 
326         return 0;
327     }
328 
329     public boolean equals(Object obj) {
330         if (obj == null) {
331             return false;
332         }
333 
334         JournalStructureImpl journalStructure = null;
335 
336         try {
337             journalStructure = (JournalStructureImpl)obj;
338         }
339         catch (ClassCastException cce) {
340             return false;
341         }
342 
343         long pk = journalStructure.getPrimaryKey();
344 
345         if (getPrimaryKey() == pk) {
346             return true;
347         }
348         else {
349             return false;
350         }
351     }
352 
353     public int hashCode() {
354         return (int)getPrimaryKey();
355     }
356 
357     private String _uuid;
358     private long _id;
359     private long _groupId;
360     private long _companyId;
361     private long _userId;
362     private String _userName;
363     private Date _createDate;
364     private Date _modifiedDate;
365     private String _structureId;
366     private String _name;
367     private String _description;
368     private String _xsd;
369 }