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.portal.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.Release;
28  import com.liferay.portal.model.ReleaseSoap;
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="ReleaseModelImpl.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>Release</code> table
50   * in the database.
51   * </p>
52   *
53   * @author Brian Wing Shun Chan
54   *
55   * @see com.liferay.portal.service.model.Release
56   * @see com.liferay.portal.service.model.ReleaseModel
57   * @see com.liferay.portal.service.model.impl.ReleaseImpl
58   *
59   */
60  public class ReleaseModelImpl extends BaseModelImpl {
61      public static final String TABLE_NAME = "Release_";
62      public static final Object[][] TABLE_COLUMNS = {
63              { "releaseId", new Integer(Types.BIGINT) },
64              
65  
66              { "createDate", new Integer(Types.TIMESTAMP) },
67              
68  
69              { "modifiedDate", new Integer(Types.TIMESTAMP) },
70              
71  
72              { "buildNumber", new Integer(Types.INTEGER) },
73              
74  
75              { "buildDate", new Integer(Types.TIMESTAMP) },
76              
77  
78              { "verified", new Integer(Types.BOOLEAN) }
79          };
80      public static final String TABLE_SQL_CREATE = "create table Release_ (releaseId LONG not null primary key,createDate DATE null,modifiedDate DATE null,buildNumber INTEGER,buildDate DATE null,verified BOOLEAN)";
81      public static final String TABLE_SQL_DROP = "drop table Release_";
82      public static final String DATA_SOURCE = "liferayDataSource";
83      public static final String SESSION_FACTORY = "liferaySessionFactory";
84      public static final String TX_MANAGER = "liferayTransactionManager";
85      public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
86                  "value.object.finder.cache.enabled.com.liferay.portal.model.Release"),
87              true);
88  
89      public static Release toModel(ReleaseSoap soapModel) {
90          Release model = new ReleaseImpl();
91  
92          model.setReleaseId(soapModel.getReleaseId());
93          model.setCreateDate(soapModel.getCreateDate());
94          model.setModifiedDate(soapModel.getModifiedDate());
95          model.setBuildNumber(soapModel.getBuildNumber());
96          model.setBuildDate(soapModel.getBuildDate());
97          model.setVerified(soapModel.getVerified());
98  
99          return model;
100     }
101 
102     public static List<Release> toModels(ReleaseSoap[] soapModels) {
103         List<Release> models = new ArrayList<Release>(soapModels.length);
104 
105         for (ReleaseSoap soapModel : soapModels) {
106             models.add(toModel(soapModel));
107         }
108 
109         return models;
110     }
111 
112     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
113                 "lock.expiration.time.com.liferay.portal.model.Release"));
114 
115     public ReleaseModelImpl() {
116     }
117 
118     public long getPrimaryKey() {
119         return _releaseId;
120     }
121 
122     public void setPrimaryKey(long pk) {
123         setReleaseId(pk);
124     }
125 
126     public Serializable getPrimaryKeyObj() {
127         return new Long(_releaseId);
128     }
129 
130     public long getReleaseId() {
131         return _releaseId;
132     }
133 
134     public void setReleaseId(long releaseId) {
135         if (releaseId != _releaseId) {
136             _releaseId = releaseId;
137         }
138     }
139 
140     public Date getCreateDate() {
141         return _createDate;
142     }
143 
144     public void setCreateDate(Date createDate) {
145         if (((createDate == null) && (_createDate != null)) ||
146                 ((createDate != null) && (_createDate == null)) ||
147                 ((createDate != null) && (_createDate != null) &&
148                 !createDate.equals(_createDate))) {
149             _createDate = createDate;
150         }
151     }
152 
153     public Date getModifiedDate() {
154         return _modifiedDate;
155     }
156 
157     public void setModifiedDate(Date modifiedDate) {
158         if (((modifiedDate == null) && (_modifiedDate != null)) ||
159                 ((modifiedDate != null) && (_modifiedDate == null)) ||
160                 ((modifiedDate != null) && (_modifiedDate != null) &&
161                 !modifiedDate.equals(_modifiedDate))) {
162             _modifiedDate = modifiedDate;
163         }
164     }
165 
166     public int getBuildNumber() {
167         return _buildNumber;
168     }
169 
170     public void setBuildNumber(int buildNumber) {
171         if (buildNumber != _buildNumber) {
172             _buildNumber = buildNumber;
173         }
174     }
175 
176     public Date getBuildDate() {
177         return _buildDate;
178     }
179 
180     public void setBuildDate(Date buildDate) {
181         if (((buildDate == null) && (_buildDate != null)) ||
182                 ((buildDate != null) && (_buildDate == null)) ||
183                 ((buildDate != null) && (_buildDate != null) &&
184                 !buildDate.equals(_buildDate))) {
185             _buildDate = buildDate;
186         }
187     }
188 
189     public boolean getVerified() {
190         return _verified;
191     }
192 
193     public boolean isVerified() {
194         return _verified;
195     }
196 
197     public void setVerified(boolean verified) {
198         if (verified != _verified) {
199             _verified = verified;
200         }
201     }
202 
203     public Release toEscapedModel() {
204         if (isEscapedModel()) {
205             return (Release)this;
206         }
207         else {
208             Release model = new ReleaseImpl();
209 
210             model.setEscapedModel(true);
211 
212             model.setReleaseId(getReleaseId());
213             model.setCreateDate(getCreateDate());
214             model.setModifiedDate(getModifiedDate());
215             model.setBuildNumber(getBuildNumber());
216             model.setBuildDate(getBuildDate());
217             model.setVerified(getVerified());
218 
219             model = (Release)Proxy.newProxyInstance(Release.class.getClassLoader(),
220                     new Class[] { Release.class },
221                     new ReadOnlyBeanHandler(model));
222 
223             return model;
224         }
225     }
226 
227     public Object clone() {
228         ReleaseImpl clone = new ReleaseImpl();
229 
230         clone.setReleaseId(getReleaseId());
231         clone.setCreateDate(getCreateDate());
232         clone.setModifiedDate(getModifiedDate());
233         clone.setBuildNumber(getBuildNumber());
234         clone.setBuildDate(getBuildDate());
235         clone.setVerified(getVerified());
236 
237         return clone;
238     }
239 
240     public int compareTo(Object obj) {
241         if (obj == null) {
242             return -1;
243         }
244 
245         ReleaseImpl release = (ReleaseImpl)obj;
246 
247         long pk = release.getPrimaryKey();
248 
249         if (getPrimaryKey() < pk) {
250             return -1;
251         }
252         else if (getPrimaryKey() > pk) {
253             return 1;
254         }
255         else {
256             return 0;
257         }
258     }
259 
260     public boolean equals(Object obj) {
261         if (obj == null) {
262             return false;
263         }
264 
265         ReleaseImpl release = null;
266 
267         try {
268             release = (ReleaseImpl)obj;
269         }
270         catch (ClassCastException cce) {
271             return false;
272         }
273 
274         long pk = release.getPrimaryKey();
275 
276         if (getPrimaryKey() == pk) {
277             return true;
278         }
279         else {
280             return false;
281         }
282     }
283 
284     public int hashCode() {
285         return (int)getPrimaryKey();
286     }
287 
288     private long _releaseId;
289     private Date _createDate;
290     private Date _modifiedDate;
291     private int _buildNumber;
292     private Date _buildDate;
293     private boolean _verified;
294 }