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.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.kernel.util.HtmlUtil;
29  import com.liferay.portal.model.impl.BaseModelImpl;
30  
31  import com.liferay.portlet.expando.model.ExpandoBridge;
32  import com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl;
33  import com.liferay.portlet.softwarecatalog.model.SCProductEntry;
34  import com.liferay.portlet.softwarecatalog.model.SCProductEntrySoap;
35  
36  import java.io.Serializable;
37  
38  import java.lang.reflect.Proxy;
39  
40  import java.sql.Types;
41  
42  import java.util.ArrayList;
43  import java.util.Date;
44  import java.util.List;
45  
46  /**
47   * <a href="SCProductEntryModelImpl.java.html"><b><i>View Source</i></b></a>
48   *
49   * <p>
50   * ServiceBuilder generated this class. Modifications in this class will be
51   * overwritten the next time is generated.
52   * </p>
53   *
54   * <p>
55   * This class is a model that represents the <code>SCProductEntry</code> table
56   * in the database.
57   * </p>
58   *
59   * @author Brian Wing Shun Chan
60   *
61   * @see com.liferay.portlet.softwarecatalog.model.SCProductEntry
62   * @see com.liferay.portlet.softwarecatalog.model.SCProductEntryModel
63   * @see com.liferay.portlet.softwarecatalog.model.impl.SCProductEntryImpl
64   *
65   */
66  public class SCProductEntryModelImpl extends BaseModelImpl<SCProductEntry> {
67      public static final String TABLE_NAME = "SCProductEntry";
68      public static final Object[][] TABLE_COLUMNS = {
69              { "productEntryId", new Integer(Types.BIGINT) },
70              
71  
72              { "groupId", new Integer(Types.BIGINT) },
73              
74  
75              { "companyId", new Integer(Types.BIGINT) },
76              
77  
78              { "userId", new Integer(Types.BIGINT) },
79              
80  
81              { "userName", new Integer(Types.VARCHAR) },
82              
83  
84              { "createDate", new Integer(Types.TIMESTAMP) },
85              
86  
87              { "modifiedDate", new Integer(Types.TIMESTAMP) },
88              
89  
90              { "name", new Integer(Types.VARCHAR) },
91              
92  
93              { "type_", new Integer(Types.VARCHAR) },
94              
95  
96              { "tags", new Integer(Types.VARCHAR) },
97              
98  
99              { "shortDescription", new Integer(Types.VARCHAR) },
100             
101 
102             { "longDescription", new Integer(Types.VARCHAR) },
103             
104 
105             { "pageURL", new Integer(Types.VARCHAR) },
106             
107 
108             { "author", new Integer(Types.VARCHAR) },
109             
110 
111             { "repoGroupId", new Integer(Types.VARCHAR) },
112             
113 
114             { "repoArtifactId", new Integer(Types.VARCHAR) }
115         };
116     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(255) null,shortDescription STRING null,longDescription STRING null,pageURL STRING null,author VARCHAR(75) null,repoGroupId VARCHAR(75) null,repoArtifactId VARCHAR(75) null)";
117     public static final String TABLE_SQL_DROP = "drop table SCProductEntry";
118     public static final String DATA_SOURCE = "liferayDataSource";
119     public static final String SESSION_FACTORY = "liferaySessionFactory";
120     public static final String TX_MANAGER = "liferayTransactionManager";
121     public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
122                 "value.object.entity.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCProductEntry"),
123             true);
124     public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
125                 "value.object.finder.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCProductEntry"),
126             true);
127 
128     public static SCProductEntry toModel(SCProductEntrySoap soapModel) {
129         SCProductEntry model = new SCProductEntryImpl();
130 
131         model.setProductEntryId(soapModel.getProductEntryId());
132         model.setGroupId(soapModel.getGroupId());
133         model.setCompanyId(soapModel.getCompanyId());
134         model.setUserId(soapModel.getUserId());
135         model.setUserName(soapModel.getUserName());
136         model.setCreateDate(soapModel.getCreateDate());
137         model.setModifiedDate(soapModel.getModifiedDate());
138         model.setName(soapModel.getName());
139         model.setType(soapModel.getType());
140         model.setTags(soapModel.getTags());
141         model.setShortDescription(soapModel.getShortDescription());
142         model.setLongDescription(soapModel.getLongDescription());
143         model.setPageURL(soapModel.getPageURL());
144         model.setAuthor(soapModel.getAuthor());
145         model.setRepoGroupId(soapModel.getRepoGroupId());
146         model.setRepoArtifactId(soapModel.getRepoArtifactId());
147 
148         return model;
149     }
150 
151     public static List<SCProductEntry> toModels(SCProductEntrySoap[] soapModels) {
152         List<SCProductEntry> models = new ArrayList<SCProductEntry>(soapModels.length);
153 
154         for (SCProductEntrySoap soapModel : soapModels) {
155             models.add(toModel(soapModel));
156         }
157 
158         return models;
159     }
160 
161     public static final boolean FINDER_CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES =
162         com.liferay.portlet.softwarecatalog.model.impl.SCLicenseModelImpl.FINDER_CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES;
163     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
164                 "lock.expiration.time.com.liferay.portlet.softwarecatalog.model.SCProductEntry"));
165 
166     public SCProductEntryModelImpl() {
167     }
168 
169     public long getPrimaryKey() {
170         return _productEntryId;
171     }
172 
173     public void setPrimaryKey(long pk) {
174         setProductEntryId(pk);
175     }
176 
177     public Serializable getPrimaryKeyObj() {
178         return new Long(_productEntryId);
179     }
180 
181     public long getProductEntryId() {
182         return _productEntryId;
183     }
184 
185     public void setProductEntryId(long productEntryId) {
186         _productEntryId = productEntryId;
187     }
188 
189     public long getGroupId() {
190         return _groupId;
191     }
192 
193     public void setGroupId(long groupId) {
194         _groupId = groupId;
195     }
196 
197     public long getCompanyId() {
198         return _companyId;
199     }
200 
201     public void setCompanyId(long companyId) {
202         _companyId = companyId;
203     }
204 
205     public long getUserId() {
206         return _userId;
207     }
208 
209     public void setUserId(long userId) {
210         _userId = userId;
211     }
212 
213     public String getUserName() {
214         return GetterUtil.getString(_userName);
215     }
216 
217     public void setUserName(String userName) {
218         _userName = userName;
219     }
220 
221     public Date getCreateDate() {
222         return _createDate;
223     }
224 
225     public void setCreateDate(Date createDate) {
226         _createDate = createDate;
227     }
228 
229     public Date getModifiedDate() {
230         return _modifiedDate;
231     }
232 
233     public void setModifiedDate(Date modifiedDate) {
234         _modifiedDate = modifiedDate;
235     }
236 
237     public String getName() {
238         return GetterUtil.getString(_name);
239     }
240 
241     public void setName(String name) {
242         _name = name;
243     }
244 
245     public String getType() {
246         return GetterUtil.getString(_type);
247     }
248 
249     public void setType(String type) {
250         _type = type;
251     }
252 
253     public String getTags() {
254         return GetterUtil.getString(_tags);
255     }
256 
257     public void setTags(String tags) {
258         _tags = tags;
259     }
260 
261     public String getShortDescription() {
262         return GetterUtil.getString(_shortDescription);
263     }
264 
265     public void setShortDescription(String shortDescription) {
266         _shortDescription = shortDescription;
267     }
268 
269     public String getLongDescription() {
270         return GetterUtil.getString(_longDescription);
271     }
272 
273     public void setLongDescription(String longDescription) {
274         _longDescription = longDescription;
275     }
276 
277     public String getPageURL() {
278         return GetterUtil.getString(_pageURL);
279     }
280 
281     public void setPageURL(String pageURL) {
282         _pageURL = pageURL;
283     }
284 
285     public String getAuthor() {
286         return GetterUtil.getString(_author);
287     }
288 
289     public void setAuthor(String author) {
290         _author = author;
291     }
292 
293     public String getRepoGroupId() {
294         return GetterUtil.getString(_repoGroupId);
295     }
296 
297     public void setRepoGroupId(String repoGroupId) {
298         _repoGroupId = repoGroupId;
299 
300         if (_originalRepoGroupId == null) {
301             _originalRepoGroupId = repoGroupId;
302         }
303     }
304 
305     public String getOriginalRepoGroupId() {
306         return GetterUtil.getString(_originalRepoGroupId);
307     }
308 
309     public String getRepoArtifactId() {
310         return GetterUtil.getString(_repoArtifactId);
311     }
312 
313     public void setRepoArtifactId(String repoArtifactId) {
314         _repoArtifactId = repoArtifactId;
315 
316         if (_originalRepoArtifactId == null) {
317             _originalRepoArtifactId = repoArtifactId;
318         }
319     }
320 
321     public String getOriginalRepoArtifactId() {
322         return GetterUtil.getString(_originalRepoArtifactId);
323     }
324 
325     public SCProductEntry toEscapedModel() {
326         if (isEscapedModel()) {
327             return (SCProductEntry)this;
328         }
329         else {
330             SCProductEntry model = new SCProductEntryImpl();
331 
332             model.setNew(isNew());
333             model.setEscapedModel(true);
334 
335             model.setProductEntryId(getProductEntryId());
336             model.setGroupId(getGroupId());
337             model.setCompanyId(getCompanyId());
338             model.setUserId(getUserId());
339             model.setUserName(HtmlUtil.escape(getUserName()));
340             model.setCreateDate(getCreateDate());
341             model.setModifiedDate(getModifiedDate());
342             model.setName(HtmlUtil.escape(getName()));
343             model.setType(HtmlUtil.escape(getType()));
344             model.setTags(HtmlUtil.escape(getTags()));
345             model.setShortDescription(HtmlUtil.escape(getShortDescription()));
346             model.setLongDescription(HtmlUtil.escape(getLongDescription()));
347             model.setPageURL(HtmlUtil.escape(getPageURL()));
348             model.setAuthor(HtmlUtil.escape(getAuthor()));
349             model.setRepoGroupId(HtmlUtil.escape(getRepoGroupId()));
350             model.setRepoArtifactId(HtmlUtil.escape(getRepoArtifactId()));
351 
352             model = (SCProductEntry)Proxy.newProxyInstance(SCProductEntry.class.getClassLoader(),
353                     new Class[] { SCProductEntry.class },
354                     new ReadOnlyBeanHandler(model));
355 
356             return model;
357         }
358     }
359 
360     public ExpandoBridge getExpandoBridge() {
361         if (_expandoBridge == null) {
362             _expandoBridge = new ExpandoBridgeImpl(SCProductEntry.class.getName(),
363                     getPrimaryKey());
364         }
365 
366         return _expandoBridge;
367     }
368 
369     public Object clone() {
370         SCProductEntryImpl clone = new SCProductEntryImpl();
371 
372         clone.setProductEntryId(getProductEntryId());
373         clone.setGroupId(getGroupId());
374         clone.setCompanyId(getCompanyId());
375         clone.setUserId(getUserId());
376         clone.setUserName(getUserName());
377         clone.setCreateDate(getCreateDate());
378         clone.setModifiedDate(getModifiedDate());
379         clone.setName(getName());
380         clone.setType(getType());
381         clone.setTags(getTags());
382         clone.setShortDescription(getShortDescription());
383         clone.setLongDescription(getLongDescription());
384         clone.setPageURL(getPageURL());
385         clone.setAuthor(getAuthor());
386         clone.setRepoGroupId(getRepoGroupId());
387         clone.setRepoArtifactId(getRepoArtifactId());
388 
389         return clone;
390     }
391 
392     public int compareTo(SCProductEntry scProductEntry) {
393         int value = 0;
394 
395         value = DateUtil.compareTo(getModifiedDate(),
396                 scProductEntry.getModifiedDate());
397 
398         value = value * -1;
399 
400         if (value != 0) {
401             return value;
402         }
403 
404         value = getName().compareTo(scProductEntry.getName());
405 
406         value = value * -1;
407 
408         if (value != 0) {
409             return value;
410         }
411 
412         return 0;
413     }
414 
415     public boolean equals(Object obj) {
416         if (obj == null) {
417             return false;
418         }
419 
420         SCProductEntry scProductEntry = null;
421 
422         try {
423             scProductEntry = (SCProductEntry)obj;
424         }
425         catch (ClassCastException cce) {
426             return false;
427         }
428 
429         long pk = scProductEntry.getPrimaryKey();
430 
431         if (getPrimaryKey() == pk) {
432             return true;
433         }
434         else {
435             return false;
436         }
437     }
438 
439     public int hashCode() {
440         return (int)getPrimaryKey();
441     }
442 
443     public String toString() {
444         StringBuilder sb = new StringBuilder();
445 
446         sb.append("{productEntryId=");
447         sb.append(getProductEntryId());
448         sb.append(", groupId=");
449         sb.append(getGroupId());
450         sb.append(", companyId=");
451         sb.append(getCompanyId());
452         sb.append(", userId=");
453         sb.append(getUserId());
454         sb.append(", userName=");
455         sb.append(getUserName());
456         sb.append(", createDate=");
457         sb.append(getCreateDate());
458         sb.append(", modifiedDate=");
459         sb.append(getModifiedDate());
460         sb.append(", name=");
461         sb.append(getName());
462         sb.append(", type=");
463         sb.append(getType());
464         sb.append(", tags=");
465         sb.append(getTags());
466         sb.append(", shortDescription=");
467         sb.append(getShortDescription());
468         sb.append(", longDescription=");
469         sb.append(getLongDescription());
470         sb.append(", pageURL=");
471         sb.append(getPageURL());
472         sb.append(", author=");
473         sb.append(getAuthor());
474         sb.append(", repoGroupId=");
475         sb.append(getRepoGroupId());
476         sb.append(", repoArtifactId=");
477         sb.append(getRepoArtifactId());
478         sb.append("}");
479 
480         return sb.toString();
481     }
482 
483     public String toXmlString() {
484         StringBuilder sb = new StringBuilder();
485 
486         sb.append("<model><model-name>");
487         sb.append("com.liferay.portlet.softwarecatalog.model.SCProductEntry");
488         sb.append("</model-name>");
489 
490         sb.append(
491             "<column><column-name>productEntryId</column-name><column-value><![CDATA[");
492         sb.append(getProductEntryId());
493         sb.append("]]></column-value></column>");
494         sb.append(
495             "<column><column-name>groupId</column-name><column-value><![CDATA[");
496         sb.append(getGroupId());
497         sb.append("]]></column-value></column>");
498         sb.append(
499             "<column><column-name>companyId</column-name><column-value><![CDATA[");
500         sb.append(getCompanyId());
501         sb.append("]]></column-value></column>");
502         sb.append(
503             "<column><column-name>userId</column-name><column-value><![CDATA[");
504         sb.append(getUserId());
505         sb.append("]]></column-value></column>");
506         sb.append(
507             "<column><column-name>userName</column-name><column-value><![CDATA[");
508         sb.append(getUserName());
509         sb.append("]]></column-value></column>");
510         sb.append(
511             "<column><column-name>createDate</column-name><column-value><![CDATA[");
512         sb.append(getCreateDate());
513         sb.append("]]></column-value></column>");
514         sb.append(
515             "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
516         sb.append(getModifiedDate());
517         sb.append("]]></column-value></column>");
518         sb.append(
519             "<column><column-name>name</column-name><column-value><![CDATA[");
520         sb.append(getName());
521         sb.append("]]></column-value></column>");
522         sb.append(
523             "<column><column-name>type</column-name><column-value><![CDATA[");
524         sb.append(getType());
525         sb.append("]]></column-value></column>");
526         sb.append(
527             "<column><column-name>tags</column-name><column-value><![CDATA[");
528         sb.append(getTags());
529         sb.append("]]></column-value></column>");
530         sb.append(
531             "<column><column-name>shortDescription</column-name><column-value><![CDATA[");
532         sb.append(getShortDescription());
533         sb.append("]]></column-value></column>");
534         sb.append(
535             "<column><column-name>longDescription</column-name><column-value><![CDATA[");
536         sb.append(getLongDescription());
537         sb.append("]]></column-value></column>");
538         sb.append(
539             "<column><column-name>pageURL</column-name><column-value><![CDATA[");
540         sb.append(getPageURL());
541         sb.append("]]></column-value></column>");
542         sb.append(
543             "<column><column-name>author</column-name><column-value><![CDATA[");
544         sb.append(getAuthor());
545         sb.append("]]></column-value></column>");
546         sb.append(
547             "<column><column-name>repoGroupId</column-name><column-value><![CDATA[");
548         sb.append(getRepoGroupId());
549         sb.append("]]></column-value></column>");
550         sb.append(
551             "<column><column-name>repoArtifactId</column-name><column-value><![CDATA[");
552         sb.append(getRepoArtifactId());
553         sb.append("]]></column-value></column>");
554 
555         sb.append("</model>");
556 
557         return sb.toString();
558     }
559 
560     private long _productEntryId;
561     private long _groupId;
562     private long _companyId;
563     private long _userId;
564     private String _userName;
565     private Date _createDate;
566     private Date _modifiedDate;
567     private String _name;
568     private String _type;
569     private String _tags;
570     private String _shortDescription;
571     private String _longDescription;
572     private String _pageURL;
573     private String _author;
574     private String _repoGroupId;
575     private String _originalRepoGroupId;
576     private String _repoArtifactId;
577     private String _originalRepoArtifactId;
578     private transient ExpandoBridge _expandoBridge;
579 }