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.portlet.softwarecatalog.model.impl;
24  
25  import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26  import com.liferay.portal.kernel.util.DateUtil;
27  import com.liferay.portal.kernel.util.GetterUtil;
28  import com.liferay.portal.model.impl.BaseModelImpl;
29  import com.liferay.portal.util.PropsUtil;
30  
31  import com.liferay.portlet.softwarecatalog.model.SCProductVersion;
32  
33  import com.liferay.util.Html;
34  
35  import java.io.Serializable;
36  
37  import java.lang.reflect.Proxy;
38  
39  import java.sql.Types;
40  
41  import java.util.Date;
42  
43  /**
44   * <a href="SCProductVersionModelImpl.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>SCProductVersion</code> table
53   * in the database.
54   * </p>
55   *
56   * @author Brian Wing Shun Chan
57   *
58   * @see com.liferay.portlet.softwarecatalog.service.model.SCProductVersion
59   * @see com.liferay.portlet.softwarecatalog.service.model.SCProductVersionModel
60   * @see com.liferay.portlet.softwarecatalog.service.model.impl.SCProductVersionImpl
61   *
62   */
63  public class SCProductVersionModelImpl extends BaseModelImpl {
64      public static final String TABLE_NAME = "SCProductVersion";
65      public static final Object[][] TABLE_COLUMNS = {
66              { "productVersionId", new Integer(Types.BIGINT) },
67              
68  
69              { "companyId", new Integer(Types.BIGINT) },
70              
71  
72              { "userId", new Integer(Types.BIGINT) },
73              
74  
75              { "userName", new Integer(Types.VARCHAR) },
76              
77  
78              { "createDate", new Integer(Types.TIMESTAMP) },
79              
80  
81              { "modifiedDate", new Integer(Types.TIMESTAMP) },
82              
83  
84              { "productEntryId", new Integer(Types.BIGINT) },
85              
86  
87              { "version", new Integer(Types.VARCHAR) },
88              
89  
90              { "changeLog", new Integer(Types.VARCHAR) },
91              
92  
93              { "downloadPageURL", new Integer(Types.VARCHAR) },
94              
95  
96              { "directDownloadURL", new Integer(Types.VARCHAR) },
97              
98  
99              { "repoStoreArtifact", new Integer(Types.BOOLEAN) }
100         };
101     public static final String TABLE_SQL_CREATE = "create table SCProductVersion (productVersionId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,productEntryId LONG,version VARCHAR(75) null,changeLog STRING null,downloadPageURL STRING null,directDownloadURL VARCHAR(2000) null,repoStoreArtifact BOOLEAN)";
102     public static final String TABLE_SQL_DROP = "drop table SCProductVersion";
103     public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
104                 "value.object.finder.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCProductVersion"),
105             true);
106     public static final boolean CACHE_ENABLED_SCFRAMEWORKVERSI_SCPRODUCTVERS = com.liferay.portlet.softwarecatalog.model.impl.SCFrameworkVersionModelImpl.CACHE_ENABLED_SCFRAMEWORKVERSI_SCPRODUCTVERS;
107     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
108                 "lock.expiration.time.com.liferay.portlet.softwarecatalog.model.SCProductVersion"));
109 
110     public SCProductVersionModelImpl() {
111     }
112 
113     public long getPrimaryKey() {
114         return _productVersionId;
115     }
116 
117     public void setPrimaryKey(long pk) {
118         setProductVersionId(pk);
119     }
120 
121     public Serializable getPrimaryKeyObj() {
122         return new Long(_productVersionId);
123     }
124 
125     public long getProductVersionId() {
126         return _productVersionId;
127     }
128 
129     public void setProductVersionId(long productVersionId) {
130         if (productVersionId != _productVersionId) {
131             _productVersionId = productVersionId;
132         }
133     }
134 
135     public long getCompanyId() {
136         return _companyId;
137     }
138 
139     public void setCompanyId(long companyId) {
140         if (companyId != _companyId) {
141             _companyId = companyId;
142         }
143     }
144 
145     public long getUserId() {
146         return _userId;
147     }
148 
149     public void setUserId(long userId) {
150         if (userId != _userId) {
151             _userId = userId;
152         }
153     }
154 
155     public String getUserName() {
156         return GetterUtil.getString(_userName);
157     }
158 
159     public void setUserName(String userName) {
160         if (((userName == null) && (_userName != null)) ||
161                 ((userName != null) && (_userName == null)) ||
162                 ((userName != null) && (_userName != null) &&
163                 !userName.equals(_userName))) {
164             _userName = userName;
165         }
166     }
167 
168     public Date getCreateDate() {
169         return _createDate;
170     }
171 
172     public void setCreateDate(Date createDate) {
173         if (((createDate == null) && (_createDate != null)) ||
174                 ((createDate != null) && (_createDate == null)) ||
175                 ((createDate != null) && (_createDate != null) &&
176                 !createDate.equals(_createDate))) {
177             _createDate = createDate;
178         }
179     }
180 
181     public Date getModifiedDate() {
182         return _modifiedDate;
183     }
184 
185     public void setModifiedDate(Date modifiedDate) {
186         if (((modifiedDate == null) && (_modifiedDate != null)) ||
187                 ((modifiedDate != null) && (_modifiedDate == null)) ||
188                 ((modifiedDate != null) && (_modifiedDate != null) &&
189                 !modifiedDate.equals(_modifiedDate))) {
190             _modifiedDate = modifiedDate;
191         }
192     }
193 
194     public long getProductEntryId() {
195         return _productEntryId;
196     }
197 
198     public void setProductEntryId(long productEntryId) {
199         if (productEntryId != _productEntryId) {
200             _productEntryId = productEntryId;
201         }
202     }
203 
204     public String getVersion() {
205         return GetterUtil.getString(_version);
206     }
207 
208     public void setVersion(String version) {
209         if (((version == null) && (_version != null)) ||
210                 ((version != null) && (_version == null)) ||
211                 ((version != null) && (_version != null) &&
212                 !version.equals(_version))) {
213             _version = version;
214         }
215     }
216 
217     public String getChangeLog() {
218         return GetterUtil.getString(_changeLog);
219     }
220 
221     public void setChangeLog(String changeLog) {
222         if (((changeLog == null) && (_changeLog != null)) ||
223                 ((changeLog != null) && (_changeLog == null)) ||
224                 ((changeLog != null) && (_changeLog != null) &&
225                 !changeLog.equals(_changeLog))) {
226             _changeLog = changeLog;
227         }
228     }
229 
230     public String getDownloadPageURL() {
231         return GetterUtil.getString(_downloadPageURL);
232     }
233 
234     public void setDownloadPageURL(String downloadPageURL) {
235         if (((downloadPageURL == null) && (_downloadPageURL != null)) ||
236                 ((downloadPageURL != null) && (_downloadPageURL == null)) ||
237                 ((downloadPageURL != null) && (_downloadPageURL != null) &&
238                 !downloadPageURL.equals(_downloadPageURL))) {
239             _downloadPageURL = downloadPageURL;
240         }
241     }
242 
243     public String getDirectDownloadURL() {
244         return GetterUtil.getString(_directDownloadURL);
245     }
246 
247     public void setDirectDownloadURL(String directDownloadURL) {
248         if (((directDownloadURL == null) && (_directDownloadURL != null)) ||
249                 ((directDownloadURL != null) && (_directDownloadURL == null)) ||
250                 ((directDownloadURL != null) && (_directDownloadURL != null) &&
251                 !directDownloadURL.equals(_directDownloadURL))) {
252             _directDownloadURL = directDownloadURL;
253         }
254     }
255 
256     public boolean getRepoStoreArtifact() {
257         return _repoStoreArtifact;
258     }
259 
260     public boolean isRepoStoreArtifact() {
261         return _repoStoreArtifact;
262     }
263 
264     public void setRepoStoreArtifact(boolean repoStoreArtifact) {
265         if (repoStoreArtifact != _repoStoreArtifact) {
266             _repoStoreArtifact = repoStoreArtifact;
267         }
268     }
269 
270     public SCProductVersion toEscapedModel() {
271         if (isEscapedModel()) {
272             return (SCProductVersion)this;
273         }
274         else {
275             SCProductVersion model = new SCProductVersionImpl();
276 
277             model.setEscapedModel(true);
278 
279             model.setProductVersionId(getProductVersionId());
280             model.setCompanyId(getCompanyId());
281             model.setUserId(getUserId());
282             model.setUserName(Html.escape(getUserName()));
283             model.setCreateDate(getCreateDate());
284             model.setModifiedDate(getModifiedDate());
285             model.setProductEntryId(getProductEntryId());
286             model.setVersion(Html.escape(getVersion()));
287             model.setChangeLog(Html.escape(getChangeLog()));
288             model.setDownloadPageURL(Html.escape(getDownloadPageURL()));
289             model.setDirectDownloadURL(Html.escape(getDirectDownloadURL()));
290             model.setRepoStoreArtifact(getRepoStoreArtifact());
291 
292             model = (SCProductVersion)Proxy.newProxyInstance(SCProductVersion.class.getClassLoader(),
293                     new Class[] { SCProductVersion.class },
294                     new ReadOnlyBeanHandler(model));
295 
296             return model;
297         }
298     }
299 
300     public Object clone() {
301         SCProductVersionImpl clone = new SCProductVersionImpl();
302 
303         clone.setProductVersionId(getProductVersionId());
304         clone.setCompanyId(getCompanyId());
305         clone.setUserId(getUserId());
306         clone.setUserName(getUserName());
307         clone.setCreateDate(getCreateDate());
308         clone.setModifiedDate(getModifiedDate());
309         clone.setProductEntryId(getProductEntryId());
310         clone.setVersion(getVersion());
311         clone.setChangeLog(getChangeLog());
312         clone.setDownloadPageURL(getDownloadPageURL());
313         clone.setDirectDownloadURL(getDirectDownloadURL());
314         clone.setRepoStoreArtifact(getRepoStoreArtifact());
315 
316         return clone;
317     }
318 
319     public int compareTo(Object obj) {
320         if (obj == null) {
321             return -1;
322         }
323 
324         SCProductVersionImpl scProductVersion = (SCProductVersionImpl)obj;
325 
326         int value = 0;
327 
328         value = DateUtil.compareTo(getCreateDate(),
329                 scProductVersion.getCreateDate());
330 
331         value = value * -1;
332 
333         if (value != 0) {
334             return value;
335         }
336 
337         return 0;
338     }
339 
340     public boolean equals(Object obj) {
341         if (obj == null) {
342             return false;
343         }
344 
345         SCProductVersionImpl scProductVersion = null;
346 
347         try {
348             scProductVersion = (SCProductVersionImpl)obj;
349         }
350         catch (ClassCastException cce) {
351             return false;
352         }
353 
354         long pk = scProductVersion.getPrimaryKey();
355 
356         if (getPrimaryKey() == pk) {
357             return true;
358         }
359         else {
360             return false;
361         }
362     }
363 
364     public int hashCode() {
365         return (int)getPrimaryKey();
366     }
367 
368     private long _productVersionId;
369     private long _companyId;
370     private long _userId;
371     private String _userName;
372     private Date _createDate;
373     private Date _modifiedDate;
374     private long _productEntryId;
375     private String _version;
376     private String _changeLog;
377     private String _downloadPageURL;
378     private String _directDownloadURL;
379     private boolean _repoStoreArtifact;
380 }