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     * The base model implementation for the SCProductEntry service. Represents a row in the "SCProductEntry" database table, with each column mapped to a property of this class.
045     *
046     * <p>
047     * This implementation and its corresponding interface {@link com.liferay.portlet.softwarecatalog.model.SCProductEntryModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link SCProductEntryImpl}.
048     * </p>
049     *
050     * <p>
051     * Never modify or reference this class directly. All methods that expect a s c product entry model instance should use the {@link com.liferay.portlet.softwarecatalog.model.SCProductEntry} interface instead.
052     * </p>
053     *
054     * @author Brian Wing Shun Chan
055     * @see SCProductEntryImpl
056     * @see com.liferay.portlet.softwarecatalog.model.SCProductEntry
057     * @see com.liferay.portlet.softwarecatalog.model.SCProductEntryModel
058     * @generated
059     */
060    public class SCProductEntryModelImpl extends BaseModelImpl<SCProductEntry>
061            implements SCProductEntryModel {
062            public static final String TABLE_NAME = "SCProductEntry";
063            public static final Object[][] TABLE_COLUMNS = {
064                            { "productEntryId", new Integer(Types.BIGINT) },
065                            { "groupId", new Integer(Types.BIGINT) },
066                            { "companyId", new Integer(Types.BIGINT) },
067                            { "userId", new Integer(Types.BIGINT) },
068                            { "userName", new Integer(Types.VARCHAR) },
069                            { "createDate", new Integer(Types.TIMESTAMP) },
070                            { "modifiedDate", new Integer(Types.TIMESTAMP) },
071                            { "name", new Integer(Types.VARCHAR) },
072                            { "type_", new Integer(Types.VARCHAR) },
073                            { "tags", new Integer(Types.VARCHAR) },
074                            { "shortDescription", new Integer(Types.VARCHAR) },
075                            { "longDescription", new Integer(Types.VARCHAR) },
076                            { "pageURL", new Integer(Types.VARCHAR) },
077                            { "author", new Integer(Types.VARCHAR) },
078                            { "repoGroupId", new Integer(Types.VARCHAR) },
079                            { "repoArtifactId", new Integer(Types.VARCHAR) }
080                    };
081            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)";
082            public static final String TABLE_SQL_DROP = "drop table SCProductEntry";
083            public static final String ORDER_BY_JPQL = " ORDER BY scProductEntry.modifiedDate DESC, scProductEntry.name DESC";
084            public static final String ORDER_BY_SQL = " ORDER BY SCProductEntry.modifiedDate DESC, SCProductEntry.name DESC";
085            public static final String DATA_SOURCE = "liferayDataSource";
086            public static final String SESSION_FACTORY = "liferaySessionFactory";
087            public static final String TX_MANAGER = "liferayTransactionManager";
088            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
089                                    "value.object.entity.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCProductEntry"),
090                            true);
091            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
092                                    "value.object.finder.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCProductEntry"),
093                            true);
094    
095            /**
096             * Converts the soap model instance into a normal model instance.
097             *
098             * @param soapModel the soap model instance to convert
099             * @return the normal model instance
100             */
101            public static SCProductEntry toModel(SCProductEntrySoap soapModel) {
102                    SCProductEntry model = new SCProductEntryImpl();
103    
104                    model.setProductEntryId(soapModel.getProductEntryId());
105                    model.setGroupId(soapModel.getGroupId());
106                    model.setCompanyId(soapModel.getCompanyId());
107                    model.setUserId(soapModel.getUserId());
108                    model.setUserName(soapModel.getUserName());
109                    model.setCreateDate(soapModel.getCreateDate());
110                    model.setModifiedDate(soapModel.getModifiedDate());
111                    model.setName(soapModel.getName());
112                    model.setType(soapModel.getType());
113                    model.setTags(soapModel.getTags());
114                    model.setShortDescription(soapModel.getShortDescription());
115                    model.setLongDescription(soapModel.getLongDescription());
116                    model.setPageURL(soapModel.getPageURL());
117                    model.setAuthor(soapModel.getAuthor());
118                    model.setRepoGroupId(soapModel.getRepoGroupId());
119                    model.setRepoArtifactId(soapModel.getRepoArtifactId());
120    
121                    return model;
122            }
123    
124            /**
125             * Converts the soap model instances into normal model instances.
126             *
127             * @param soapModels the soap model instances to convert
128             * @return the normal model instances
129             */
130            public static List<SCProductEntry> toModels(SCProductEntrySoap[] soapModels) {
131                    List<SCProductEntry> models = new ArrayList<SCProductEntry>(soapModels.length);
132    
133                    for (SCProductEntrySoap soapModel : soapModels) {
134                            models.add(toModel(soapModel));
135                    }
136    
137                    return models;
138            }
139    
140            public static final String MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME = com.liferay.portlet.softwarecatalog.model.impl.SCLicenseModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME;
141            public static final boolean FINDER_CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES =
142                    com.liferay.portlet.softwarecatalog.model.impl.SCLicenseModelImpl.FINDER_CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES;
143            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
144                                    "lock.expiration.time.com.liferay.portlet.softwarecatalog.model.SCProductEntry"));
145    
146            public SCProductEntryModelImpl() {
147            }
148    
149            public long getPrimaryKey() {
150                    return _productEntryId;
151            }
152    
153            public void setPrimaryKey(long pk) {
154                    setProductEntryId(pk);
155            }
156    
157            public Serializable getPrimaryKeyObj() {
158                    return new Long(_productEntryId);
159            }
160    
161            public long getProductEntryId() {
162                    return _productEntryId;
163            }
164    
165            public void setProductEntryId(long productEntryId) {
166                    _productEntryId = productEntryId;
167            }
168    
169            public long getGroupId() {
170                    return _groupId;
171            }
172    
173            public void setGroupId(long groupId) {
174                    _groupId = groupId;
175            }
176    
177            public long getCompanyId() {
178                    return _companyId;
179            }
180    
181            public void setCompanyId(long companyId) {
182                    _companyId = companyId;
183            }
184    
185            public long getUserId() {
186                    return _userId;
187            }
188    
189            public void setUserId(long userId) {
190                    _userId = userId;
191            }
192    
193            public String getUserUuid() throws SystemException {
194                    return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
195            }
196    
197            public void setUserUuid(String userUuid) {
198                    _userUuid = userUuid;
199            }
200    
201            public String getUserName() {
202                    if (_userName == null) {
203                            return StringPool.BLANK;
204                    }
205                    else {
206                            return _userName;
207                    }
208            }
209    
210            public void setUserName(String userName) {
211                    _userName = userName;
212            }
213    
214            public Date getCreateDate() {
215                    return _createDate;
216            }
217    
218            public void setCreateDate(Date createDate) {
219                    _createDate = createDate;
220            }
221    
222            public Date getModifiedDate() {
223                    return _modifiedDate;
224            }
225    
226            public void setModifiedDate(Date modifiedDate) {
227                    _modifiedDate = modifiedDate;
228            }
229    
230            public String getName() {
231                    if (_name == null) {
232                            return StringPool.BLANK;
233                    }
234                    else {
235                            return _name;
236                    }
237            }
238    
239            public void setName(String name) {
240                    _name = name;
241            }
242    
243            public String getType() {
244                    if (_type == null) {
245                            return StringPool.BLANK;
246                    }
247                    else {
248                            return _type;
249                    }
250            }
251    
252            public void setType(String type) {
253                    _type = type;
254            }
255    
256            public String getTags() {
257                    if (_tags == null) {
258                            return StringPool.BLANK;
259                    }
260                    else {
261                            return _tags;
262                    }
263            }
264    
265            public void setTags(String tags) {
266                    _tags = tags;
267            }
268    
269            public String getShortDescription() {
270                    if (_shortDescription == null) {
271                            return StringPool.BLANK;
272                    }
273                    else {
274                            return _shortDescription;
275                    }
276            }
277    
278            public void setShortDescription(String shortDescription) {
279                    _shortDescription = shortDescription;
280            }
281    
282            public String getLongDescription() {
283                    if (_longDescription == null) {
284                            return StringPool.BLANK;
285                    }
286                    else {
287                            return _longDescription;
288                    }
289            }
290    
291            public void setLongDescription(String longDescription) {
292                    _longDescription = longDescription;
293            }
294    
295            public String getPageURL() {
296                    if (_pageURL == null) {
297                            return StringPool.BLANK;
298                    }
299                    else {
300                            return _pageURL;
301                    }
302            }
303    
304            public void setPageURL(String pageURL) {
305                    _pageURL = pageURL;
306            }
307    
308            public String getAuthor() {
309                    if (_author == null) {
310                            return StringPool.BLANK;
311                    }
312                    else {
313                            return _author;
314                    }
315            }
316    
317            public void setAuthor(String author) {
318                    _author = author;
319            }
320    
321            public String getRepoGroupId() {
322                    if (_repoGroupId == null) {
323                            return StringPool.BLANK;
324                    }
325                    else {
326                            return _repoGroupId;
327                    }
328            }
329    
330            public void setRepoGroupId(String repoGroupId) {
331                    _repoGroupId = repoGroupId;
332    
333                    if (_originalRepoGroupId == null) {
334                            _originalRepoGroupId = repoGroupId;
335                    }
336            }
337    
338            public String getOriginalRepoGroupId() {
339                    return GetterUtil.getString(_originalRepoGroupId);
340            }
341    
342            public String getRepoArtifactId() {
343                    if (_repoArtifactId == null) {
344                            return StringPool.BLANK;
345                    }
346                    else {
347                            return _repoArtifactId;
348                    }
349            }
350    
351            public void setRepoArtifactId(String repoArtifactId) {
352                    _repoArtifactId = repoArtifactId;
353    
354                    if (_originalRepoArtifactId == null) {
355                            _originalRepoArtifactId = repoArtifactId;
356                    }
357            }
358    
359            public String getOriginalRepoArtifactId() {
360                    return GetterUtil.getString(_originalRepoArtifactId);
361            }
362    
363            public SCProductEntry toEscapedModel() {
364                    if (isEscapedModel()) {
365                            return (SCProductEntry)this;
366                    }
367                    else {
368                            return (SCProductEntry)Proxy.newProxyInstance(SCProductEntry.class.getClassLoader(),
369                                    new Class[] { SCProductEntry.class },
370                                    new AutoEscapeBeanHandler(this));
371                    }
372            }
373    
374            public ExpandoBridge getExpandoBridge() {
375                    if (_expandoBridge == null) {
376                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
377                                            SCProductEntry.class.getName(), getPrimaryKey());
378                    }
379    
380                    return _expandoBridge;
381            }
382    
383            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
384                    getExpandoBridge().setAttributes(serviceContext);
385            }
386    
387            public Object clone() {
388                    SCProductEntryImpl clone = new SCProductEntryImpl();
389    
390                    clone.setProductEntryId(getProductEntryId());
391                    clone.setGroupId(getGroupId());
392                    clone.setCompanyId(getCompanyId());
393                    clone.setUserId(getUserId());
394                    clone.setUserName(getUserName());
395                    clone.setCreateDate(getCreateDate());
396                    clone.setModifiedDate(getModifiedDate());
397                    clone.setName(getName());
398                    clone.setType(getType());
399                    clone.setTags(getTags());
400                    clone.setShortDescription(getShortDescription());
401                    clone.setLongDescription(getLongDescription());
402                    clone.setPageURL(getPageURL());
403                    clone.setAuthor(getAuthor());
404                    clone.setRepoGroupId(getRepoGroupId());
405                    clone.setRepoArtifactId(getRepoArtifactId());
406    
407                    return clone;
408            }
409    
410            public int compareTo(SCProductEntry scProductEntry) {
411                    int value = 0;
412    
413                    value = DateUtil.compareTo(getModifiedDate(),
414                                    scProductEntry.getModifiedDate());
415    
416                    value = value * -1;
417    
418                    if (value != 0) {
419                            return value;
420                    }
421    
422                    value = getName().compareTo(scProductEntry.getName());
423    
424                    value = value * -1;
425    
426                    if (value != 0) {
427                            return value;
428                    }
429    
430                    return 0;
431            }
432    
433            public boolean equals(Object obj) {
434                    if (obj == null) {
435                            return false;
436                    }
437    
438                    SCProductEntry scProductEntry = null;
439    
440                    try {
441                            scProductEntry = (SCProductEntry)obj;
442                    }
443                    catch (ClassCastException cce) {
444                            return false;
445                    }
446    
447                    long pk = scProductEntry.getPrimaryKey();
448    
449                    if (getPrimaryKey() == pk) {
450                            return true;
451                    }
452                    else {
453                            return false;
454                    }
455            }
456    
457            public int hashCode() {
458                    return (int)getPrimaryKey();
459            }
460    
461            public String toString() {
462                    StringBundler sb = new StringBundler(33);
463    
464                    sb.append("{productEntryId=");
465                    sb.append(getProductEntryId());
466                    sb.append(", groupId=");
467                    sb.append(getGroupId());
468                    sb.append(", companyId=");
469                    sb.append(getCompanyId());
470                    sb.append(", userId=");
471                    sb.append(getUserId());
472                    sb.append(", userName=");
473                    sb.append(getUserName());
474                    sb.append(", createDate=");
475                    sb.append(getCreateDate());
476                    sb.append(", modifiedDate=");
477                    sb.append(getModifiedDate());
478                    sb.append(", name=");
479                    sb.append(getName());
480                    sb.append(", type=");
481                    sb.append(getType());
482                    sb.append(", tags=");
483                    sb.append(getTags());
484                    sb.append(", shortDescription=");
485                    sb.append(getShortDescription());
486                    sb.append(", longDescription=");
487                    sb.append(getLongDescription());
488                    sb.append(", pageURL=");
489                    sb.append(getPageURL());
490                    sb.append(", author=");
491                    sb.append(getAuthor());
492                    sb.append(", repoGroupId=");
493                    sb.append(getRepoGroupId());
494                    sb.append(", repoArtifactId=");
495                    sb.append(getRepoArtifactId());
496                    sb.append("}");
497    
498                    return sb.toString();
499            }
500    
501            public String toXmlString() {
502                    StringBundler sb = new StringBundler(52);
503    
504                    sb.append("<model><model-name>");
505                    sb.append("com.liferay.portlet.softwarecatalog.model.SCProductEntry");
506                    sb.append("</model-name>");
507    
508                    sb.append(
509                            "<column><column-name>productEntryId</column-name><column-value><![CDATA[");
510                    sb.append(getProductEntryId());
511                    sb.append("]]></column-value></column>");
512                    sb.append(
513                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
514                    sb.append(getGroupId());
515                    sb.append("]]></column-value></column>");
516                    sb.append(
517                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
518                    sb.append(getCompanyId());
519                    sb.append("]]></column-value></column>");
520                    sb.append(
521                            "<column><column-name>userId</column-name><column-value><![CDATA[");
522                    sb.append(getUserId());
523                    sb.append("]]></column-value></column>");
524                    sb.append(
525                            "<column><column-name>userName</column-name><column-value><![CDATA[");
526                    sb.append(getUserName());
527                    sb.append("]]></column-value></column>");
528                    sb.append(
529                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
530                    sb.append(getCreateDate());
531                    sb.append("]]></column-value></column>");
532                    sb.append(
533                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
534                    sb.append(getModifiedDate());
535                    sb.append("]]></column-value></column>");
536                    sb.append(
537                            "<column><column-name>name</column-name><column-value><![CDATA[");
538                    sb.append(getName());
539                    sb.append("]]></column-value></column>");
540                    sb.append(
541                            "<column><column-name>type</column-name><column-value><![CDATA[");
542                    sb.append(getType());
543                    sb.append("]]></column-value></column>");
544                    sb.append(
545                            "<column><column-name>tags</column-name><column-value><![CDATA[");
546                    sb.append(getTags());
547                    sb.append("]]></column-value></column>");
548                    sb.append(
549                            "<column><column-name>shortDescription</column-name><column-value><![CDATA[");
550                    sb.append(getShortDescription());
551                    sb.append("]]></column-value></column>");
552                    sb.append(
553                            "<column><column-name>longDescription</column-name><column-value><![CDATA[");
554                    sb.append(getLongDescription());
555                    sb.append("]]></column-value></column>");
556                    sb.append(
557                            "<column><column-name>pageURL</column-name><column-value><![CDATA[");
558                    sb.append(getPageURL());
559                    sb.append("]]></column-value></column>");
560                    sb.append(
561                            "<column><column-name>author</column-name><column-value><![CDATA[");
562                    sb.append(getAuthor());
563                    sb.append("]]></column-value></column>");
564                    sb.append(
565                            "<column><column-name>repoGroupId</column-name><column-value><![CDATA[");
566                    sb.append(getRepoGroupId());
567                    sb.append("]]></column-value></column>");
568                    sb.append(
569                            "<column><column-name>repoArtifactId</column-name><column-value><![CDATA[");
570                    sb.append(getRepoArtifactId());
571                    sb.append("]]></column-value></column>");
572    
573                    sb.append("</model>");
574    
575                    return sb.toString();
576            }
577    
578            private long _productEntryId;
579            private long _groupId;
580            private long _companyId;
581            private long _userId;
582            private String _userUuid;
583            private String _userName;
584            private Date _createDate;
585            private Date _modifiedDate;
586            private String _name;
587            private String _type;
588            private String _tags;
589            private String _shortDescription;
590            private String _longDescription;
591            private String _pageURL;
592            private String _author;
593            private String _repoGroupId;
594            private String _originalRepoGroupId;
595            private String _repoArtifactId;
596            private String _originalRepoArtifactId;
597            private transient ExpandoBridge _expandoBridge;
598    }