1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portlet.softwarecatalog.model.impl;
16  
17  import com.liferay.portal.SystemException;
18  import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
19  import com.liferay.portal.kernel.util.DateUtil;
20  import com.liferay.portal.kernel.util.GetterUtil;
21  import com.liferay.portal.kernel.util.StringBundler;
22  import com.liferay.portal.kernel.util.StringPool;
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         if (_userName == null) {
191             return StringPool.BLANK;
192         }
193         else {
194             return _userName;
195         }
196     }
197 
198     public void setUserName(String userName) {
199         _userName = userName;
200     }
201 
202     public Date getCreateDate() {
203         return _createDate;
204     }
205 
206     public void setCreateDate(Date createDate) {
207         _createDate = createDate;
208     }
209 
210     public Date getModifiedDate() {
211         return _modifiedDate;
212     }
213 
214     public void setModifiedDate(Date modifiedDate) {
215         _modifiedDate = modifiedDate;
216     }
217 
218     public String getName() {
219         if (_name == null) {
220             return StringPool.BLANK;
221         }
222         else {
223             return _name;
224         }
225     }
226 
227     public void setName(String name) {
228         _name = name;
229     }
230 
231     public String getType() {
232         if (_type == null) {
233             return StringPool.BLANK;
234         }
235         else {
236             return _type;
237         }
238     }
239 
240     public void setType(String type) {
241         _type = type;
242     }
243 
244     public String getTags() {
245         if (_tags == null) {
246             return StringPool.BLANK;
247         }
248         else {
249             return _tags;
250         }
251     }
252 
253     public void setTags(String tags) {
254         _tags = tags;
255     }
256 
257     public String getShortDescription() {
258         if (_shortDescription == null) {
259             return StringPool.BLANK;
260         }
261         else {
262             return _shortDescription;
263         }
264     }
265 
266     public void setShortDescription(String shortDescription) {
267         _shortDescription = shortDescription;
268     }
269 
270     public String getLongDescription() {
271         if (_longDescription == null) {
272             return StringPool.BLANK;
273         }
274         else {
275             return _longDescription;
276         }
277     }
278 
279     public void setLongDescription(String longDescription) {
280         _longDescription = longDescription;
281     }
282 
283     public String getPageURL() {
284         if (_pageURL == null) {
285             return StringPool.BLANK;
286         }
287         else {
288             return _pageURL;
289         }
290     }
291 
292     public void setPageURL(String pageURL) {
293         _pageURL = pageURL;
294     }
295 
296     public String getAuthor() {
297         if (_author == null) {
298             return StringPool.BLANK;
299         }
300         else {
301             return _author;
302         }
303     }
304 
305     public void setAuthor(String author) {
306         _author = author;
307     }
308 
309     public String getRepoGroupId() {
310         if (_repoGroupId == null) {
311             return StringPool.BLANK;
312         }
313         else {
314             return _repoGroupId;
315         }
316     }
317 
318     public void setRepoGroupId(String repoGroupId) {
319         _repoGroupId = repoGroupId;
320 
321         if (_originalRepoGroupId == null) {
322             _originalRepoGroupId = repoGroupId;
323         }
324     }
325 
326     public String getOriginalRepoGroupId() {
327         return GetterUtil.getString(_originalRepoGroupId);
328     }
329 
330     public String getRepoArtifactId() {
331         if (_repoArtifactId == null) {
332             return StringPool.BLANK;
333         }
334         else {
335             return _repoArtifactId;
336         }
337     }
338 
339     public void setRepoArtifactId(String repoArtifactId) {
340         _repoArtifactId = repoArtifactId;
341 
342         if (_originalRepoArtifactId == null) {
343             _originalRepoArtifactId = repoArtifactId;
344         }
345     }
346 
347     public String getOriginalRepoArtifactId() {
348         return GetterUtil.getString(_originalRepoArtifactId);
349     }
350 
351     public SCProductEntry toEscapedModel() {
352         if (isEscapedModel()) {
353             return (SCProductEntry)this;
354         }
355         else {
356             return (SCProductEntry)Proxy.newProxyInstance(SCProductEntry.class.getClassLoader(),
357                 new Class[] { SCProductEntry.class },
358                 new AutoEscapeBeanHandler(this));
359         }
360     }
361 
362     public ExpandoBridge getExpandoBridge() {
363         if (_expandoBridge == null) {
364             _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(SCProductEntry.class.getName(),
365                     getPrimaryKey());
366         }
367 
368         return _expandoBridge;
369     }
370 
371     public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
372         getExpandoBridge().setAttributes(serviceContext);
373     }
374 
375     public Object clone() {
376         SCProductEntryImpl clone = new SCProductEntryImpl();
377 
378         clone.setProductEntryId(getProductEntryId());
379         clone.setGroupId(getGroupId());
380         clone.setCompanyId(getCompanyId());
381         clone.setUserId(getUserId());
382         clone.setUserName(getUserName());
383         clone.setCreateDate(getCreateDate());
384         clone.setModifiedDate(getModifiedDate());
385         clone.setName(getName());
386         clone.setType(getType());
387         clone.setTags(getTags());
388         clone.setShortDescription(getShortDescription());
389         clone.setLongDescription(getLongDescription());
390         clone.setPageURL(getPageURL());
391         clone.setAuthor(getAuthor());
392         clone.setRepoGroupId(getRepoGroupId());
393         clone.setRepoArtifactId(getRepoArtifactId());
394 
395         return clone;
396     }
397 
398     public int compareTo(SCProductEntry scProductEntry) {
399         int value = 0;
400 
401         value = DateUtil.compareTo(getModifiedDate(),
402                 scProductEntry.getModifiedDate());
403 
404         value = value * -1;
405 
406         if (value != 0) {
407             return value;
408         }
409 
410         value = getName().compareTo(scProductEntry.getName());
411 
412         value = value * -1;
413 
414         if (value != 0) {
415             return value;
416         }
417 
418         return 0;
419     }
420 
421     public boolean equals(Object obj) {
422         if (obj == null) {
423             return false;
424         }
425 
426         SCProductEntry scProductEntry = null;
427 
428         try {
429             scProductEntry = (SCProductEntry)obj;
430         }
431         catch (ClassCastException cce) {
432             return false;
433         }
434 
435         long pk = scProductEntry.getPrimaryKey();
436 
437         if (getPrimaryKey() == pk) {
438             return true;
439         }
440         else {
441             return false;
442         }
443     }
444 
445     public int hashCode() {
446         return (int)getPrimaryKey();
447     }
448 
449     public String toString() {
450         StringBundler sb = new StringBundler(33);
451 
452         sb.append("{productEntryId=");
453         sb.append(getProductEntryId());
454         sb.append(", groupId=");
455         sb.append(getGroupId());
456         sb.append(", companyId=");
457         sb.append(getCompanyId());
458         sb.append(", userId=");
459         sb.append(getUserId());
460         sb.append(", userName=");
461         sb.append(getUserName());
462         sb.append(", createDate=");
463         sb.append(getCreateDate());
464         sb.append(", modifiedDate=");
465         sb.append(getModifiedDate());
466         sb.append(", name=");
467         sb.append(getName());
468         sb.append(", type=");
469         sb.append(getType());
470         sb.append(", tags=");
471         sb.append(getTags());
472         sb.append(", shortDescription=");
473         sb.append(getShortDescription());
474         sb.append(", longDescription=");
475         sb.append(getLongDescription());
476         sb.append(", pageURL=");
477         sb.append(getPageURL());
478         sb.append(", author=");
479         sb.append(getAuthor());
480         sb.append(", repoGroupId=");
481         sb.append(getRepoGroupId());
482         sb.append(", repoArtifactId=");
483         sb.append(getRepoArtifactId());
484         sb.append("}");
485 
486         return sb.toString();
487     }
488 
489     public String toXmlString() {
490         StringBundler sb = new StringBundler(52);
491 
492         sb.append("<model><model-name>");
493         sb.append("com.liferay.portlet.softwarecatalog.model.SCProductEntry");
494         sb.append("</model-name>");
495 
496         sb.append(
497             "<column><column-name>productEntryId</column-name><column-value><![CDATA[");
498         sb.append(getProductEntryId());
499         sb.append("]]></column-value></column>");
500         sb.append(
501             "<column><column-name>groupId</column-name><column-value><![CDATA[");
502         sb.append(getGroupId());
503         sb.append("]]></column-value></column>");
504         sb.append(
505             "<column><column-name>companyId</column-name><column-value><![CDATA[");
506         sb.append(getCompanyId());
507         sb.append("]]></column-value></column>");
508         sb.append(
509             "<column><column-name>userId</column-name><column-value><![CDATA[");
510         sb.append(getUserId());
511         sb.append("]]></column-value></column>");
512         sb.append(
513             "<column><column-name>userName</column-name><column-value><![CDATA[");
514         sb.append(getUserName());
515         sb.append("]]></column-value></column>");
516         sb.append(
517             "<column><column-name>createDate</column-name><column-value><![CDATA[");
518         sb.append(getCreateDate());
519         sb.append("]]></column-value></column>");
520         sb.append(
521             "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
522         sb.append(getModifiedDate());
523         sb.append("]]></column-value></column>");
524         sb.append(
525             "<column><column-name>name</column-name><column-value><![CDATA[");
526         sb.append(getName());
527         sb.append("]]></column-value></column>");
528         sb.append(
529             "<column><column-name>type</column-name><column-value><![CDATA[");
530         sb.append(getType());
531         sb.append("]]></column-value></column>");
532         sb.append(
533             "<column><column-name>tags</column-name><column-value><![CDATA[");
534         sb.append(getTags());
535         sb.append("]]></column-value></column>");
536         sb.append(
537             "<column><column-name>shortDescription</column-name><column-value><![CDATA[");
538         sb.append(getShortDescription());
539         sb.append("]]></column-value></column>");
540         sb.append(
541             "<column><column-name>longDescription</column-name><column-value><![CDATA[");
542         sb.append(getLongDescription());
543         sb.append("]]></column-value></column>");
544         sb.append(
545             "<column><column-name>pageURL</column-name><column-value><![CDATA[");
546         sb.append(getPageURL());
547         sb.append("]]></column-value></column>");
548         sb.append(
549             "<column><column-name>author</column-name><column-value><![CDATA[");
550         sb.append(getAuthor());
551         sb.append("]]></column-value></column>");
552         sb.append(
553             "<column><column-name>repoGroupId</column-name><column-value><![CDATA[");
554         sb.append(getRepoGroupId());
555         sb.append("]]></column-value></column>");
556         sb.append(
557             "<column><column-name>repoArtifactId</column-name><column-value><![CDATA[");
558         sb.append(getRepoArtifactId());
559         sb.append("]]></column-value></column>");
560 
561         sb.append("</model>");
562 
563         return sb.toString();
564     }
565 
566     private long _productEntryId;
567     private long _groupId;
568     private long _companyId;
569     private long _userId;
570     private String _userUuid;
571     private String _userName;
572     private Date _createDate;
573     private Date _modifiedDate;
574     private String _name;
575     private String _type;
576     private String _tags;
577     private String _shortDescription;
578     private String _longDescription;
579     private String _pageURL;
580     private String _author;
581     private String _repoGroupId;
582     private String _originalRepoGroupId;
583     private String _repoArtifactId;
584     private String _originalRepoArtifactId;
585     private transient ExpandoBridge _expandoBridge;
586 }