001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.softwarecatalog.model.impl;
016    
017    import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.kernel.util.DateUtil;
020    import com.liferay.portal.kernel.util.GetterUtil;
021    import com.liferay.portal.kernel.util.StringBundler;
022    import com.liferay.portal.kernel.util.StringPool;
023    import com.liferay.portal.model.impl.BaseModelImpl;
024    import com.liferay.portal.service.ServiceContext;
025    import com.liferay.portal.util.PortalUtil;
026    
027    import com.liferay.portlet.expando.model.ExpandoBridge;
028    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
029    import com.liferay.portlet.softwarecatalog.model.SCProductEntry;
030    import com.liferay.portlet.softwarecatalog.model.SCProductEntryModel;
031    import com.liferay.portlet.softwarecatalog.model.SCProductEntrySoap;
032    
033    import java.io.Serializable;
034    
035    import java.lang.reflect.Proxy;
036    
037    import java.sql.Types;
038    
039    import java.util.ArrayList;
040    import java.util.Date;
041    import java.util.List;
042    
043    /**
044     * <p>
045     * This interface is a model that represents the SCProductEntry table in the
046     * database.
047     * </p>
048     *
049     * @author    Brian Wing Shun Chan
050     * @see       SCProductEntryImpl
051     * @see       com.liferay.portlet.softwarecatalog.model.SCProductEntry
052     * @see       com.liferay.portlet.softwarecatalog.model.SCProductEntryModel
053     * @generated
054     */
055    public class SCProductEntryModelImpl extends BaseModelImpl<SCProductEntry>
056            implements SCProductEntryModel {
057            public static final String TABLE_NAME = "SCProductEntry";
058            public static final Object[][] TABLE_COLUMNS = {
059                            { "productEntryId", new Integer(Types.BIGINT) },
060                            { "groupId", new Integer(Types.BIGINT) },
061                            { "companyId", new Integer(Types.BIGINT) },
062                            { "userId", new Integer(Types.BIGINT) },
063                            { "userName", new Integer(Types.VARCHAR) },
064                            { "createDate", new Integer(Types.TIMESTAMP) },
065                            { "modifiedDate", new Integer(Types.TIMESTAMP) },
066                            { "name", new Integer(Types.VARCHAR) },
067                            { "type_", new Integer(Types.VARCHAR) },
068                            { "tags", new Integer(Types.VARCHAR) },
069                            { "shortDescription", new Integer(Types.VARCHAR) },
070                            { "longDescription", new Integer(Types.VARCHAR) },
071                            { "pageURL", new Integer(Types.VARCHAR) },
072                            { "author", new Integer(Types.VARCHAR) },
073                            { "repoGroupId", new Integer(Types.VARCHAR) },
074                            { "repoArtifactId", new Integer(Types.VARCHAR) }
075                    };
076            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)";
077            public static final String TABLE_SQL_DROP = "drop table SCProductEntry";
078            public static final String ORDER_BY_JPQL = " ORDER BY scProductEntry.modifiedDate DESC, scProductEntry.name DESC";
079            public static final String ORDER_BY_SQL = " ORDER BY SCProductEntry.modifiedDate DESC, SCProductEntry.name DESC";
080            public static final String DATA_SOURCE = "liferayDataSource";
081            public static final String SESSION_FACTORY = "liferaySessionFactory";
082            public static final String TX_MANAGER = "liferayTransactionManager";
083            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
084                                    "value.object.entity.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCProductEntry"),
085                            true);
086            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
087                                    "value.object.finder.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCProductEntry"),
088                            true);
089    
090            public static SCProductEntry toModel(SCProductEntrySoap soapModel) {
091                    SCProductEntry model = new SCProductEntryImpl();
092    
093                    model.setProductEntryId(soapModel.getProductEntryId());
094                    model.setGroupId(soapModel.getGroupId());
095                    model.setCompanyId(soapModel.getCompanyId());
096                    model.setUserId(soapModel.getUserId());
097                    model.setUserName(soapModel.getUserName());
098                    model.setCreateDate(soapModel.getCreateDate());
099                    model.setModifiedDate(soapModel.getModifiedDate());
100                    model.setName(soapModel.getName());
101                    model.setType(soapModel.getType());
102                    model.setTags(soapModel.getTags());
103                    model.setShortDescription(soapModel.getShortDescription());
104                    model.setLongDescription(soapModel.getLongDescription());
105                    model.setPageURL(soapModel.getPageURL());
106                    model.setAuthor(soapModel.getAuthor());
107                    model.setRepoGroupId(soapModel.getRepoGroupId());
108                    model.setRepoArtifactId(soapModel.getRepoArtifactId());
109    
110                    return model;
111            }
112    
113            public static List<SCProductEntry> toModels(SCProductEntrySoap[] soapModels) {
114                    List<SCProductEntry> models = new ArrayList<SCProductEntry>(soapModels.length);
115    
116                    for (SCProductEntrySoap soapModel : soapModels) {
117                            models.add(toModel(soapModel));
118                    }
119    
120                    return models;
121            }
122    
123            public static final String MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME = com.liferay.portlet.softwarecatalog.model.impl.SCLicenseModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME;
124            public static final boolean FINDER_CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES =
125                    com.liferay.portlet.softwarecatalog.model.impl.SCLicenseModelImpl.FINDER_CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES;
126            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
127                                    "lock.expiration.time.com.liferay.portlet.softwarecatalog.model.SCProductEntry"));
128    
129            public SCProductEntryModelImpl() {
130            }
131    
132            public long getPrimaryKey() {
133                    return _productEntryId;
134            }
135    
136            public void setPrimaryKey(long pk) {
137                    setProductEntryId(pk);
138            }
139    
140            public Serializable getPrimaryKeyObj() {
141                    return new Long(_productEntryId);
142            }
143    
144            public long getProductEntryId() {
145                    return _productEntryId;
146            }
147    
148            public void setProductEntryId(long productEntryId) {
149                    _productEntryId = productEntryId;
150            }
151    
152            public long getGroupId() {
153                    return _groupId;
154            }
155    
156            public void setGroupId(long groupId) {
157                    _groupId = groupId;
158            }
159    
160            public long getCompanyId() {
161                    return _companyId;
162            }
163    
164            public void setCompanyId(long companyId) {
165                    _companyId = companyId;
166            }
167    
168            public long getUserId() {
169                    return _userId;
170            }
171    
172            public void setUserId(long userId) {
173                    _userId = userId;
174            }
175    
176            public String getUserUuid() throws SystemException {
177                    return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
178            }
179    
180            public void setUserUuid(String userUuid) {
181                    _userUuid = userUuid;
182            }
183    
184            public String getUserName() {
185                    if (_userName == null) {
186                            return StringPool.BLANK;
187                    }
188                    else {
189                            return _userName;
190                    }
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                    if (_name == null) {
215                            return StringPool.BLANK;
216                    }
217                    else {
218                            return _name;
219                    }
220            }
221    
222            public void setName(String name) {
223                    _name = name;
224            }
225    
226            public String getType() {
227                    if (_type == null) {
228                            return StringPool.BLANK;
229                    }
230                    else {
231                            return _type;
232                    }
233            }
234    
235            public void setType(String type) {
236                    _type = type;
237            }
238    
239            public String getTags() {
240                    if (_tags == null) {
241                            return StringPool.BLANK;
242                    }
243                    else {
244                            return _tags;
245                    }
246            }
247    
248            public void setTags(String tags) {
249                    _tags = tags;
250            }
251    
252            public String getShortDescription() {
253                    if (_shortDescription == null) {
254                            return StringPool.BLANK;
255                    }
256                    else {
257                            return _shortDescription;
258                    }
259            }
260    
261            public void setShortDescription(String shortDescription) {
262                    _shortDescription = shortDescription;
263            }
264    
265            public String getLongDescription() {
266                    if (_longDescription == null) {
267                            return StringPool.BLANK;
268                    }
269                    else {
270                            return _longDescription;
271                    }
272            }
273    
274            public void setLongDescription(String longDescription) {
275                    _longDescription = longDescription;
276            }
277    
278            public String getPageURL() {
279                    if (_pageURL == null) {
280                            return StringPool.BLANK;
281                    }
282                    else {
283                            return _pageURL;
284                    }
285            }
286    
287            public void setPageURL(String pageURL) {
288                    _pageURL = pageURL;
289            }
290    
291            public String getAuthor() {
292                    if (_author == null) {
293                            return StringPool.BLANK;
294                    }
295                    else {
296                            return _author;
297                    }
298            }
299    
300            public void setAuthor(String author) {
301                    _author = author;
302            }
303    
304            public String getRepoGroupId() {
305                    if (_repoGroupId == null) {
306                            return StringPool.BLANK;
307                    }
308                    else {
309                            return _repoGroupId;
310                    }
311            }
312    
313            public void setRepoGroupId(String repoGroupId) {
314                    _repoGroupId = repoGroupId;
315    
316                    if (_originalRepoGroupId == null) {
317                            _originalRepoGroupId = repoGroupId;
318                    }
319            }
320    
321            public String getOriginalRepoGroupId() {
322                    return GetterUtil.getString(_originalRepoGroupId);
323            }
324    
325            public String getRepoArtifactId() {
326                    if (_repoArtifactId == null) {
327                            return StringPool.BLANK;
328                    }
329                    else {
330                            return _repoArtifactId;
331                    }
332            }
333    
334            public void setRepoArtifactId(String repoArtifactId) {
335                    _repoArtifactId = repoArtifactId;
336    
337                    if (_originalRepoArtifactId == null) {
338                            _originalRepoArtifactId = repoArtifactId;
339                    }
340            }
341    
342            public String getOriginalRepoArtifactId() {
343                    return GetterUtil.getString(_originalRepoArtifactId);
344            }
345    
346            public SCProductEntry toEscapedModel() {
347                    if (isEscapedModel()) {
348                            return (SCProductEntry)this;
349                    }
350                    else {
351                            return (SCProductEntry)Proxy.newProxyInstance(SCProductEntry.class.getClassLoader(),
352                                    new Class[] { SCProductEntry.class },
353                                    new AutoEscapeBeanHandler(this));
354                    }
355            }
356    
357            public ExpandoBridge getExpandoBridge() {
358                    if (_expandoBridge == null) {
359                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
360                                            SCProductEntry.class.getName(), getPrimaryKey());
361                    }
362    
363                    return _expandoBridge;
364            }
365    
366            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
367                    getExpandoBridge().setAttributes(serviceContext);
368            }
369    
370            public Object clone() {
371                    SCProductEntryImpl clone = new SCProductEntryImpl();
372    
373                    clone.setProductEntryId(getProductEntryId());
374                    clone.setGroupId(getGroupId());
375                    clone.setCompanyId(getCompanyId());
376                    clone.setUserId(getUserId());
377                    clone.setUserName(getUserName());
378                    clone.setCreateDate(getCreateDate());
379                    clone.setModifiedDate(getModifiedDate());
380                    clone.setName(getName());
381                    clone.setType(getType());
382                    clone.setTags(getTags());
383                    clone.setShortDescription(getShortDescription());
384                    clone.setLongDescription(getLongDescription());
385                    clone.setPageURL(getPageURL());
386                    clone.setAuthor(getAuthor());
387                    clone.setRepoGroupId(getRepoGroupId());
388                    clone.setRepoArtifactId(getRepoArtifactId());
389    
390                    return clone;
391            }
392    
393            public int compareTo(SCProductEntry scProductEntry) {
394                    int value = 0;
395    
396                    value = DateUtil.compareTo(getModifiedDate(),
397                                    scProductEntry.getModifiedDate());
398    
399                    value = value * -1;
400    
401                    if (value != 0) {
402                            return value;
403                    }
404    
405                    value = getName().compareTo(scProductEntry.getName());
406    
407                    value = value * -1;
408    
409                    if (value != 0) {
410                            return value;
411                    }
412    
413                    return 0;
414            }
415    
416            public boolean equals(Object obj) {
417                    if (obj == null) {
418                            return false;
419                    }
420    
421                    SCProductEntry scProductEntry = null;
422    
423                    try {
424                            scProductEntry = (SCProductEntry)obj;
425                    }
426                    catch (ClassCastException cce) {
427                            return false;
428                    }
429    
430                    long pk = scProductEntry.getPrimaryKey();
431    
432                    if (getPrimaryKey() == pk) {
433                            return true;
434                    }
435                    else {
436                            return false;
437                    }
438            }
439    
440            public int hashCode() {
441                    return (int)getPrimaryKey();
442            }
443    
444            public String toString() {
445                    StringBundler sb = new StringBundler(33);
446    
447                    sb.append("{productEntryId=");
448                    sb.append(getProductEntryId());
449                    sb.append(", groupId=");
450                    sb.append(getGroupId());
451                    sb.append(", companyId=");
452                    sb.append(getCompanyId());
453                    sb.append(", userId=");
454                    sb.append(getUserId());
455                    sb.append(", userName=");
456                    sb.append(getUserName());
457                    sb.append(", createDate=");
458                    sb.append(getCreateDate());
459                    sb.append(", modifiedDate=");
460                    sb.append(getModifiedDate());
461                    sb.append(", name=");
462                    sb.append(getName());
463                    sb.append(", type=");
464                    sb.append(getType());
465                    sb.append(", tags=");
466                    sb.append(getTags());
467                    sb.append(", shortDescription=");
468                    sb.append(getShortDescription());
469                    sb.append(", longDescription=");
470                    sb.append(getLongDescription());
471                    sb.append(", pageURL=");
472                    sb.append(getPageURL());
473                    sb.append(", author=");
474                    sb.append(getAuthor());
475                    sb.append(", repoGroupId=");
476                    sb.append(getRepoGroupId());
477                    sb.append(", repoArtifactId=");
478                    sb.append(getRepoArtifactId());
479                    sb.append("}");
480    
481                    return sb.toString();
482            }
483    
484            public String toXmlString() {
485                    StringBundler sb = new StringBundler(52);
486    
487                    sb.append("<model><model-name>");
488                    sb.append("com.liferay.portlet.softwarecatalog.model.SCProductEntry");
489                    sb.append("</model-name>");
490    
491                    sb.append(
492                            "<column><column-name>productEntryId</column-name><column-value><![CDATA[");
493                    sb.append(getProductEntryId());
494                    sb.append("]]></column-value></column>");
495                    sb.append(
496                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
497                    sb.append(getGroupId());
498                    sb.append("]]></column-value></column>");
499                    sb.append(
500                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
501                    sb.append(getCompanyId());
502                    sb.append("]]></column-value></column>");
503                    sb.append(
504                            "<column><column-name>userId</column-name><column-value><![CDATA[");
505                    sb.append(getUserId());
506                    sb.append("]]></column-value></column>");
507                    sb.append(
508                            "<column><column-name>userName</column-name><column-value><![CDATA[");
509                    sb.append(getUserName());
510                    sb.append("]]></column-value></column>");
511                    sb.append(
512                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
513                    sb.append(getCreateDate());
514                    sb.append("]]></column-value></column>");
515                    sb.append(
516                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
517                    sb.append(getModifiedDate());
518                    sb.append("]]></column-value></column>");
519                    sb.append(
520                            "<column><column-name>name</column-name><column-value><![CDATA[");
521                    sb.append(getName());
522                    sb.append("]]></column-value></column>");
523                    sb.append(
524                            "<column><column-name>type</column-name><column-value><![CDATA[");
525                    sb.append(getType());
526                    sb.append("]]></column-value></column>");
527                    sb.append(
528                            "<column><column-name>tags</column-name><column-value><![CDATA[");
529                    sb.append(getTags());
530                    sb.append("]]></column-value></column>");
531                    sb.append(
532                            "<column><column-name>shortDescription</column-name><column-value><![CDATA[");
533                    sb.append(getShortDescription());
534                    sb.append("]]></column-value></column>");
535                    sb.append(
536                            "<column><column-name>longDescription</column-name><column-value><![CDATA[");
537                    sb.append(getLongDescription());
538                    sb.append("]]></column-value></column>");
539                    sb.append(
540                            "<column><column-name>pageURL</column-name><column-value><![CDATA[");
541                    sb.append(getPageURL());
542                    sb.append("]]></column-value></column>");
543                    sb.append(
544                            "<column><column-name>author</column-name><column-value><![CDATA[");
545                    sb.append(getAuthor());
546                    sb.append("]]></column-value></column>");
547                    sb.append(
548                            "<column><column-name>repoGroupId</column-name><column-value><![CDATA[");
549                    sb.append(getRepoGroupId());
550                    sb.append("]]></column-value></column>");
551                    sb.append(
552                            "<column><column-name>repoArtifactId</column-name><column-value><![CDATA[");
553                    sb.append(getRepoArtifactId());
554                    sb.append("]]></column-value></column>");
555    
556                    sb.append("</model>");
557    
558                    return sb.toString();
559            }
560    
561            private long _productEntryId;
562            private long _groupId;
563            private long _companyId;
564            private long _userId;
565            private String _userUuid;
566            private String _userName;
567            private Date _createDate;
568            private Date _modifiedDate;
569            private String _name;
570            private String _type;
571            private String _tags;
572            private String _shortDescription;
573            private String _longDescription;
574            private String _pageURL;
575            private String _author;
576            private String _repoGroupId;
577            private String _originalRepoGroupId;
578            private String _repoArtifactId;
579            private String _originalRepoArtifactId;
580            private transient ExpandoBridge _expandoBridge;
581    }