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.portal.model.impl;
21  
22  import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
23  import com.liferay.portal.kernel.util.GetterUtil;
24  import com.liferay.portal.model.Release;
25  import com.liferay.portal.model.ReleaseSoap;
26  
27  import java.io.Serializable;
28  
29  import java.lang.reflect.Proxy;
30  
31  import java.sql.Types;
32  
33  import java.util.ArrayList;
34  import java.util.Date;
35  import java.util.List;
36  
37  /**
38   * <a href="ReleaseModelImpl.java.html"><b><i>View Source</i></b></a>
39   *
40   * <p>
41   * ServiceBuilder generated this class. Modifications in this class will be
42   * overwritten the next time is generated.
43   * </p>
44   *
45   * <p>
46   * This class is a model that represents the <code>Release</code> table
47   * in the database.
48   * </p>
49   *
50   * @author Brian Wing Shun Chan
51   *
52   * @see com.liferay.portal.model.Release
53   * @see com.liferay.portal.model.ReleaseModel
54   * @see com.liferay.portal.model.impl.ReleaseImpl
55   *
56   */
57  public class ReleaseModelImpl extends BaseModelImpl {
58      public static final String TABLE_NAME = "Release_";
59      public static final Object[][] TABLE_COLUMNS = {
60              { "releaseId", new Integer(Types.BIGINT) },
61              
62  
63              { "createDate", new Integer(Types.TIMESTAMP) },
64              
65  
66              { "modifiedDate", new Integer(Types.TIMESTAMP) },
67              
68  
69              { "buildNumber", new Integer(Types.INTEGER) },
70              
71  
72              { "buildDate", new Integer(Types.TIMESTAMP) },
73              
74  
75              { "verified", new Integer(Types.BOOLEAN) }
76          };
77      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)";
78      public static final String TABLE_SQL_DROP = "drop table Release_";
79      public static final String DATA_SOURCE = "liferayDataSource";
80      public static final String SESSION_FACTORY = "liferaySessionFactory";
81      public static final String TX_MANAGER = "liferayTransactionManager";
82      public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
83                  "value.object.finder.cache.enabled.com.liferay.portal.model.Release"),
84              true);
85  
86      public static Release toModel(ReleaseSoap soapModel) {
87          Release model = new ReleaseImpl();
88  
89          model.setReleaseId(soapModel.getReleaseId());
90          model.setCreateDate(soapModel.getCreateDate());
91          model.setModifiedDate(soapModel.getModifiedDate());
92          model.setBuildNumber(soapModel.getBuildNumber());
93          model.setBuildDate(soapModel.getBuildDate());
94          model.setVerified(soapModel.getVerified());
95  
96          return model;
97      }
98  
99      public static List<Release> toModels(ReleaseSoap[] soapModels) {
100         List<Release> models = new ArrayList<Release>(soapModels.length);
101 
102         for (ReleaseSoap soapModel : soapModels) {
103             models.add(toModel(soapModel));
104         }
105 
106         return models;
107     }
108 
109     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
110                 "lock.expiration.time.com.liferay.portal.model.Release"));
111 
112     public ReleaseModelImpl() {
113     }
114 
115     public long getPrimaryKey() {
116         return _releaseId;
117     }
118 
119     public void setPrimaryKey(long pk) {
120         setReleaseId(pk);
121     }
122 
123     public Serializable getPrimaryKeyObj() {
124         return new Long(_releaseId);
125     }
126 
127     public long getReleaseId() {
128         return _releaseId;
129     }
130 
131     public void setReleaseId(long releaseId) {
132         if (releaseId != _releaseId) {
133             _releaseId = releaseId;
134         }
135     }
136 
137     public Date getCreateDate() {
138         return _createDate;
139     }
140 
141     public void setCreateDate(Date createDate) {
142         if (((createDate == null) && (_createDate != null)) ||
143                 ((createDate != null) && (_createDate == null)) ||
144                 ((createDate != null) && (_createDate != null) &&
145                 !createDate.equals(_createDate))) {
146             _createDate = createDate;
147         }
148     }
149 
150     public Date getModifiedDate() {
151         return _modifiedDate;
152     }
153 
154     public void setModifiedDate(Date modifiedDate) {
155         if (((modifiedDate == null) && (_modifiedDate != null)) ||
156                 ((modifiedDate != null) && (_modifiedDate == null)) ||
157                 ((modifiedDate != null) && (_modifiedDate != null) &&
158                 !modifiedDate.equals(_modifiedDate))) {
159             _modifiedDate = modifiedDate;
160         }
161     }
162 
163     public int getBuildNumber() {
164         return _buildNumber;
165     }
166 
167     public void setBuildNumber(int buildNumber) {
168         if (buildNumber != _buildNumber) {
169             _buildNumber = buildNumber;
170         }
171     }
172 
173     public Date getBuildDate() {
174         return _buildDate;
175     }
176 
177     public void setBuildDate(Date buildDate) {
178         if (((buildDate == null) && (_buildDate != null)) ||
179                 ((buildDate != null) && (_buildDate == null)) ||
180                 ((buildDate != null) && (_buildDate != null) &&
181                 !buildDate.equals(_buildDate))) {
182             _buildDate = buildDate;
183         }
184     }
185 
186     public boolean getVerified() {
187         return _verified;
188     }
189 
190     public boolean isVerified() {
191         return _verified;
192     }
193 
194     public void setVerified(boolean verified) {
195         if (verified != _verified) {
196             _verified = verified;
197         }
198     }
199 
200     public Release toEscapedModel() {
201         if (isEscapedModel()) {
202             return (Release)this;
203         }
204         else {
205             Release model = new ReleaseImpl();
206 
207             model.setNew(isNew());
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 }