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.SCProductEntry;
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="SCProductEntryModelImpl.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>SCProductEntry</code> table
53   * in the database.
54   * </p>
55   *
56   * @author Brian Wing Shun Chan
57   *
58   * @see com.liferay.portlet.softwarecatalog.service.model.SCProductEntry
59   * @see com.liferay.portlet.softwarecatalog.service.model.SCProductEntryModel
60   * @see com.liferay.portlet.softwarecatalog.service.model.impl.SCProductEntryImpl
61   *
62   */
63  public class SCProductEntryModelImpl extends BaseModelImpl {
64      public static final String TABLE_NAME = "SCProductEntry";
65      public static final Object[][] TABLE_COLUMNS = {
66              { "productEntryId", new Integer(Types.BIGINT) },
67              
68  
69              { "groupId", new Integer(Types.BIGINT) },
70              
71  
72              { "companyId", new Integer(Types.BIGINT) },
73              
74  
75              { "userId", new Integer(Types.BIGINT) },
76              
77  
78              { "userName", new Integer(Types.VARCHAR) },
79              
80  
81              { "createDate", new Integer(Types.TIMESTAMP) },
82              
83  
84              { "modifiedDate", new Integer(Types.TIMESTAMP) },
85              
86  
87              { "name", new Integer(Types.VARCHAR) },
88              
89  
90              { "type_", new Integer(Types.VARCHAR) },
91              
92  
93              { "tags", new Integer(Types.VARCHAR) },
94              
95  
96              { "shortDescription", new Integer(Types.VARCHAR) },
97              
98  
99              { "longDescription", new Integer(Types.VARCHAR) },
100             
101 
102             { "pageURL", new Integer(Types.VARCHAR) },
103             
104 
105             { "author", new Integer(Types.VARCHAR) },
106             
107 
108             { "repoGroupId", new Integer(Types.VARCHAR) },
109             
110 
111             { "repoArtifactId", new Integer(Types.VARCHAR) }
112         };
113     public static final String TABLE_SQL_CREATE = "create table SCProductEntry (productEntryId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,name VARCHAR(75) null,type_ VARCHAR(75) null,tags VARCHAR(300) null,shortDescription STRING null,longDescription STRING null,pageURL STRING null,author VARCHAR(75) null,repoGroupId VARCHAR(75) null,repoArtifactId VARCHAR(75) null)";
114     public static final String TABLE_SQL_DROP = "drop table SCProductEntry";
115     public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
116                 "value.object.finder.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCProductEntry"),
117             true);
118     public static final boolean CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES = com.liferay.portlet.softwarecatalog.model.impl.SCLicenseModelImpl.CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES;
119     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
120                 "lock.expiration.time.com.liferay.portlet.softwarecatalog.model.SCProductEntry"));
121 
122     public SCProductEntryModelImpl() {
123     }
124 
125     public long getPrimaryKey() {
126         return _productEntryId;
127     }
128 
129     public void setPrimaryKey(long pk) {
130         setProductEntryId(pk);
131     }
132 
133     public Serializable getPrimaryKeyObj() {
134         return new Long(_productEntryId);
135     }
136 
137     public long getProductEntryId() {
138         return _productEntryId;
139     }
140 
141     public void setProductEntryId(long productEntryId) {
142         if (productEntryId != _productEntryId) {
143             _productEntryId = productEntryId;
144         }
145     }
146 
147     public long getGroupId() {
148         return _groupId;
149     }
150 
151     public void setGroupId(long groupId) {
152         if (groupId != _groupId) {
153             _groupId = groupId;
154         }
155     }
156 
157     public long getCompanyId() {
158         return _companyId;
159     }
160 
161     public void setCompanyId(long companyId) {
162         if (companyId != _companyId) {
163             _companyId = companyId;
164         }
165     }
166 
167     public long getUserId() {
168         return _userId;
169     }
170 
171     public void setUserId(long userId) {
172         if (userId != _userId) {
173             _userId = userId;
174         }
175     }
176 
177     public String getUserName() {
178         return GetterUtil.getString(_userName);
179     }
180 
181     public void setUserName(String userName) {
182         if (((userName == null) && (_userName != null)) ||
183                 ((userName != null) && (_userName == null)) ||
184                 ((userName != null) && (_userName != null) &&
185                 !userName.equals(_userName))) {
186             _userName = userName;
187         }
188     }
189 
190     public Date getCreateDate() {
191         return _createDate;
192     }
193 
194     public void setCreateDate(Date createDate) {
195         if (((createDate == null) && (_createDate != null)) ||
196                 ((createDate != null) && (_createDate == null)) ||
197                 ((createDate != null) && (_createDate != null) &&
198                 !createDate.equals(_createDate))) {
199             _createDate = createDate;
200         }
201     }
202 
203     public Date getModifiedDate() {
204         return _modifiedDate;
205     }
206 
207     public void setModifiedDate(Date modifiedDate) {
208         if (((modifiedDate == null) && (_modifiedDate != null)) ||
209                 ((modifiedDate != null) && (_modifiedDate == null)) ||
210                 ((modifiedDate != null) && (_modifiedDate != null) &&
211                 !modifiedDate.equals(_modifiedDate))) {
212             _modifiedDate = modifiedDate;
213         }
214     }
215 
216     public String getName() {
217         return GetterUtil.getString(_name);
218     }
219 
220     public void setName(String name) {
221         if (((name == null) && (_name != null)) ||
222                 ((name != null) && (_name == null)) ||
223                 ((name != null) && (_name != null) && !name.equals(_name))) {
224             _name = name;
225         }
226     }
227 
228     public String getType() {
229         return GetterUtil.getString(_type);
230     }
231 
232     public void setType(String type) {
233         if (((type == null) && (_type != null)) ||
234                 ((type != null) && (_type == null)) ||
235                 ((type != null) && (_type != null) && !type.equals(_type))) {
236             _type = type;
237         }
238     }
239 
240     public String getTags() {
241         return GetterUtil.getString(_tags);
242     }
243 
244     public void setTags(String tags) {
245         if (((tags == null) && (_tags != null)) ||
246                 ((tags != null) && (_tags == null)) ||
247                 ((tags != null) && (_tags != null) && !tags.equals(_tags))) {
248             _tags = tags;
249         }
250     }
251 
252     public String getShortDescription() {
253         return GetterUtil.getString(_shortDescription);
254     }
255 
256     public void setShortDescription(String shortDescription) {
257         if (((shortDescription == null) && (_shortDescription != null)) ||
258                 ((shortDescription != null) && (_shortDescription == null)) ||
259                 ((shortDescription != null) && (_shortDescription != null) &&
260                 !shortDescription.equals(_shortDescription))) {
261             _shortDescription = shortDescription;
262         }
263     }
264 
265     public String getLongDescription() {
266         return GetterUtil.getString(_longDescription);
267     }
268 
269     public void setLongDescription(String longDescription) {
270         if (((longDescription == null) && (_longDescription != null)) ||
271                 ((longDescription != null) && (_longDescription == null)) ||
272                 ((longDescription != null) && (_longDescription != null) &&
273                 !longDescription.equals(_longDescription))) {
274             _longDescription = longDescription;
275         }
276     }
277 
278     public String getPageURL() {
279         return GetterUtil.getString(_pageURL);
280     }
281 
282     public void setPageURL(String pageURL) {
283         if (((pageURL == null) && (_pageURL != null)) ||
284                 ((pageURL != null) && (_pageURL == null)) ||
285                 ((pageURL != null) && (_pageURL != null) &&
286                 !pageURL.equals(_pageURL))) {
287             _pageURL = pageURL;
288         }
289     }
290 
291     public String getAuthor() {
292         return GetterUtil.getString(_author);
293     }
294 
295     public void setAuthor(String author) {
296         if (((author == null) && (_author != null)) ||
297                 ((author != null) && (_author == null)) ||
298                 ((author != null) && (_author != null) &&
299                 !author.equals(_author))) {
300             _author = author;
301         }
302     }
303 
304     public String getRepoGroupId() {
305         return GetterUtil.getString(_repoGroupId);
306     }
307 
308     public void setRepoGroupId(String repoGroupId) {
309         if (((repoGroupId == null) && (_repoGroupId != null)) ||
310                 ((repoGroupId != null) && (_repoGroupId == null)) ||
311                 ((repoGroupId != null) && (_repoGroupId != null) &&
312                 !repoGroupId.equals(_repoGroupId))) {
313             _repoGroupId = repoGroupId;
314         }
315     }
316 
317     public String getRepoArtifactId() {
318         return GetterUtil.getString(_repoArtifactId);
319     }
320 
321     public void setRepoArtifactId(String repoArtifactId) {
322         if (((repoArtifactId == null) && (_repoArtifactId != null)) ||
323                 ((repoArtifactId != null) && (_repoArtifactId == null)) ||
324                 ((repoArtifactId != null) && (_repoArtifactId != null) &&
325                 !repoArtifactId.equals(_repoArtifactId))) {
326             _repoArtifactId = repoArtifactId;
327         }
328     }
329 
330     public SCProductEntry toEscapedModel() {
331         if (isEscapedModel()) {
332             return (SCProductEntry)this;
333         }
334         else {
335             SCProductEntry model = new SCProductEntryImpl();
336 
337             model.setEscapedModel(true);
338 
339             model.setProductEntryId(getProductEntryId());
340             model.setGroupId(getGroupId());
341             model.setCompanyId(getCompanyId());
342             model.setUserId(getUserId());
343             model.setUserName(Html.escape(getUserName()));
344             model.setCreateDate(getCreateDate());
345             model.setModifiedDate(getModifiedDate());
346             model.setName(Html.escape(getName()));
347             model.setType(Html.escape(getType()));
348             model.setTags(Html.escape(getTags()));
349             model.setShortDescription(Html.escape(getShortDescription()));
350             model.setLongDescription(Html.escape(getLongDescription()));
351             model.setPageURL(Html.escape(getPageURL()));
352             model.setAuthor(Html.escape(getAuthor()));
353             model.setRepoGroupId(Html.escape(getRepoGroupId()));
354             model.setRepoArtifactId(Html.escape(getRepoArtifactId()));
355 
356             model = (SCProductEntry)Proxy.newProxyInstance(SCProductEntry.class.getClassLoader(),
357                     new Class[] { SCProductEntry.class },
358                     new ReadOnlyBeanHandler(model));
359 
360             return model;
361         }
362     }
363 
364     public Object clone() {
365         SCProductEntryImpl clone = new SCProductEntryImpl();
366 
367         clone.setProductEntryId(getProductEntryId());
368         clone.setGroupId(getGroupId());
369         clone.setCompanyId(getCompanyId());
370         clone.setUserId(getUserId());
371         clone.setUserName(getUserName());
372         clone.setCreateDate(getCreateDate());
373         clone.setModifiedDate(getModifiedDate());
374         clone.setName(getName());
375         clone.setType(getType());
376         clone.setTags(getTags());
377         clone.setShortDescription(getShortDescription());
378         clone.setLongDescription(getLongDescription());
379         clone.setPageURL(getPageURL());
380         clone.setAuthor(getAuthor());
381         clone.setRepoGroupId(getRepoGroupId());
382         clone.setRepoArtifactId(getRepoArtifactId());
383 
384         return clone;
385     }
386 
387     public int compareTo(Object obj) {
388         if (obj == null) {
389             return -1;
390         }
391 
392         SCProductEntryImpl scProductEntry = (SCProductEntryImpl)obj;
393 
394         int value = 0;
395 
396         value = DateUtil.compareTo(getModifiedDate(),
397                 scProductEntry.getModifiedDate());
398 
399         value = value * -1;
400 
401         if (value != 0) {
402             return value;
403         }
404 
405         value = getName().compareTo(scProductEntry.getName());
406 
407         value = value * -1;
408 
409         if (value != 0) {
410             return value;
411         }
412 
413         return 0;
414     }
415 
416     public boolean equals(Object obj) {
417         if (obj == null) {
418             return false;
419         }
420 
421         SCProductEntryImpl scProductEntry = null;
422 
423         try {
424             scProductEntry = (SCProductEntryImpl)obj;
425         }
426         catch (ClassCastException cce) {
427             return false;
428         }
429 
430         long pk = scProductEntry.getPrimaryKey();
431 
432         if (getPrimaryKey() == pk) {
433             return true;
434         }
435         else {
436             return false;
437         }
438     }
439 
440     public int hashCode() {
441         return (int)getPrimaryKey();
442     }
443 
444     private long _productEntryId;
445     private long _groupId;
446     private long _companyId;
447     private long _userId;
448     private String _userName;
449     private Date _createDate;
450     private Date _modifiedDate;
451     private String _name;
452     private String _type;
453     private String _tags;
454     private String _shortDescription;
455     private String _longDescription;
456     private String _pageURL;
457     private String _author;
458     private String _repoGroupId;
459     private String _repoArtifactId;
460 }