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