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