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