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