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