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