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