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