001    /**
002     * Copyright (c) 2000-2011 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.SCProductVersion;
030    import com.liferay.portlet.softwarecatalog.model.SCProductVersionModel;
031    import com.liferay.portlet.softwarecatalog.model.SCProductVersionSoap;
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 SCProductVersion service. Represents a row in the "SCProductVersion" 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.SCProductVersionModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link SCProductVersionImpl}.
048     * </p>
049     *
050     * <p>
051     * Never modify or reference this class directly. All methods that expect a s c product version model instance should use the {@link com.liferay.portlet.softwarecatalog.model.SCProductVersion} interface instead.
052     * </p>
053     *
054     * @author Brian Wing Shun Chan
055     * @see SCProductVersionImpl
056     * @see com.liferay.portlet.softwarecatalog.model.SCProductVersion
057     * @see com.liferay.portlet.softwarecatalog.model.SCProductVersionModel
058     * @generated
059     */
060    public class SCProductVersionModelImpl extends BaseModelImpl<SCProductVersion>
061            implements SCProductVersionModel {
062            public static final String TABLE_NAME = "SCProductVersion";
063            public static final Object[][] TABLE_COLUMNS = {
064                            { "productVersionId", new Integer(Types.BIGINT) },
065                            { "companyId", new Integer(Types.BIGINT) },
066                            { "userId", new Integer(Types.BIGINT) },
067                            { "userName", new Integer(Types.VARCHAR) },
068                            { "createDate", new Integer(Types.TIMESTAMP) },
069                            { "modifiedDate", new Integer(Types.TIMESTAMP) },
070                            { "productEntryId", new Integer(Types.BIGINT) },
071                            { "version", new Integer(Types.VARCHAR) },
072                            { "changeLog", new Integer(Types.VARCHAR) },
073                            { "downloadPageURL", new Integer(Types.VARCHAR) },
074                            { "directDownloadURL", new Integer(Types.VARCHAR) },
075                            { "repoStoreArtifact", new Integer(Types.BOOLEAN) }
076                    };
077            public static final String TABLE_SQL_CREATE = "create table SCProductVersion (productVersionId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,productEntryId LONG,version VARCHAR(75) null,changeLog STRING null,downloadPageURL STRING null,directDownloadURL VARCHAR(2000) null,repoStoreArtifact BOOLEAN)";
078            public static final String TABLE_SQL_DROP = "drop table SCProductVersion";
079            public static final String ORDER_BY_JPQL = " ORDER BY scProductVersion.createDate DESC";
080            public static final String ORDER_BY_SQL = " ORDER BY SCProductVersion.createDate DESC";
081            public static final String DATA_SOURCE = "liferayDataSource";
082            public static final String SESSION_FACTORY = "liferaySessionFactory";
083            public static final String TX_MANAGER = "liferayTransactionManager";
084            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
085                                    "value.object.entity.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCProductVersion"),
086                            true);
087            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
088                                    "value.object.finder.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCProductVersion"),
089                            true);
090    
091            /**
092             * Converts the soap model instance into a normal model instance.
093             *
094             * @param soapModel the soap model instance to convert
095             * @return the normal model instance
096             */
097            public static SCProductVersion toModel(SCProductVersionSoap soapModel) {
098                    SCProductVersion model = new SCProductVersionImpl();
099    
100                    model.setProductVersionId(soapModel.getProductVersionId());
101                    model.setCompanyId(soapModel.getCompanyId());
102                    model.setUserId(soapModel.getUserId());
103                    model.setUserName(soapModel.getUserName());
104                    model.setCreateDate(soapModel.getCreateDate());
105                    model.setModifiedDate(soapModel.getModifiedDate());
106                    model.setProductEntryId(soapModel.getProductEntryId());
107                    model.setVersion(soapModel.getVersion());
108                    model.setChangeLog(soapModel.getChangeLog());
109                    model.setDownloadPageURL(soapModel.getDownloadPageURL());
110                    model.setDirectDownloadURL(soapModel.getDirectDownloadURL());
111                    model.setRepoStoreArtifact(soapModel.getRepoStoreArtifact());
112    
113                    return model;
114            }
115    
116            /**
117             * Converts the soap model instances into normal model instances.
118             *
119             * @param soapModels the soap model instances to convert
120             * @return the normal model instances
121             */
122            public static List<SCProductVersion> toModels(
123                    SCProductVersionSoap[] soapModels) {
124                    List<SCProductVersion> models = new ArrayList<SCProductVersion>(soapModels.length);
125    
126                    for (SCProductVersionSoap soapModel : soapModels) {
127                            models.add(toModel(soapModel));
128                    }
129    
130                    return models;
131            }
132    
133            public static final String MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME =
134                    com.liferay.portlet.softwarecatalog.model.impl.SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME;
135            public static final boolean FINDER_CACHE_ENABLED_SCFRAMEWORKVERSI_SCPRODUCTVERS =
136                    com.liferay.portlet.softwarecatalog.model.impl.SCFrameworkVersionModelImpl.FINDER_CACHE_ENABLED_SCFRAMEWORKVERSI_SCPRODUCTVERS;
137            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
138                                    "lock.expiration.time.com.liferay.portlet.softwarecatalog.model.SCProductVersion"));
139    
140            public SCProductVersionModelImpl() {
141            }
142    
143            public long getPrimaryKey() {
144                    return _productVersionId;
145            }
146    
147            public void setPrimaryKey(long pk) {
148                    setProductVersionId(pk);
149            }
150    
151            public Serializable getPrimaryKeyObj() {
152                    return new Long(_productVersionId);
153            }
154    
155            public long getProductVersionId() {
156                    return _productVersionId;
157            }
158    
159            public void setProductVersionId(long productVersionId) {
160                    _productVersionId = productVersionId;
161            }
162    
163            public long getCompanyId() {
164                    return _companyId;
165            }
166    
167            public void setCompanyId(long companyId) {
168                    _companyId = companyId;
169            }
170    
171            public long getUserId() {
172                    return _userId;
173            }
174    
175            public void setUserId(long userId) {
176                    _userId = userId;
177            }
178    
179            public String getUserUuid() throws SystemException {
180                    return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
181            }
182    
183            public void setUserUuid(String userUuid) {
184                    _userUuid = userUuid;
185            }
186    
187            public String getUserName() {
188                    if (_userName == null) {
189                            return StringPool.BLANK;
190                    }
191                    else {
192                            return _userName;
193                    }
194            }
195    
196            public void setUserName(String userName) {
197                    _userName = userName;
198            }
199    
200            public Date getCreateDate() {
201                    return _createDate;
202            }
203    
204            public void setCreateDate(Date createDate) {
205                    _createDate = createDate;
206            }
207    
208            public Date getModifiedDate() {
209                    return _modifiedDate;
210            }
211    
212            public void setModifiedDate(Date modifiedDate) {
213                    _modifiedDate = modifiedDate;
214            }
215    
216            public long getProductEntryId() {
217                    return _productEntryId;
218            }
219    
220            public void setProductEntryId(long productEntryId) {
221                    _productEntryId = productEntryId;
222            }
223    
224            public String getVersion() {
225                    if (_version == null) {
226                            return StringPool.BLANK;
227                    }
228                    else {
229                            return _version;
230                    }
231            }
232    
233            public void setVersion(String version) {
234                    _version = version;
235            }
236    
237            public String getChangeLog() {
238                    if (_changeLog == null) {
239                            return StringPool.BLANK;
240                    }
241                    else {
242                            return _changeLog;
243                    }
244            }
245    
246            public void setChangeLog(String changeLog) {
247                    _changeLog = changeLog;
248            }
249    
250            public String getDownloadPageURL() {
251                    if (_downloadPageURL == null) {
252                            return StringPool.BLANK;
253                    }
254                    else {
255                            return _downloadPageURL;
256                    }
257            }
258    
259            public void setDownloadPageURL(String downloadPageURL) {
260                    _downloadPageURL = downloadPageURL;
261            }
262    
263            public String getDirectDownloadURL() {
264                    if (_directDownloadURL == null) {
265                            return StringPool.BLANK;
266                    }
267                    else {
268                            return _directDownloadURL;
269                    }
270            }
271    
272            public void setDirectDownloadURL(String directDownloadURL) {
273                    if (_originalDirectDownloadURL == null) {
274                            _originalDirectDownloadURL = _directDownloadURL;
275                    }
276    
277                    _directDownloadURL = directDownloadURL;
278            }
279    
280            public String getOriginalDirectDownloadURL() {
281                    return GetterUtil.getString(_originalDirectDownloadURL);
282            }
283    
284            public boolean getRepoStoreArtifact() {
285                    return _repoStoreArtifact;
286            }
287    
288            public boolean isRepoStoreArtifact() {
289                    return _repoStoreArtifact;
290            }
291    
292            public void setRepoStoreArtifact(boolean repoStoreArtifact) {
293                    _repoStoreArtifact = repoStoreArtifact;
294            }
295    
296            public SCProductVersion toEscapedModel() {
297                    if (isEscapedModel()) {
298                            return (SCProductVersion)this;
299                    }
300                    else {
301                            return (SCProductVersion)Proxy.newProxyInstance(SCProductVersion.class.getClassLoader(),
302                                    new Class[] { SCProductVersion.class },
303                                    new AutoEscapeBeanHandler(this));
304                    }
305            }
306    
307            public ExpandoBridge getExpandoBridge() {
308                    if (_expandoBridge == null) {
309                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
310                                            SCProductVersion.class.getName(), getPrimaryKey());
311                    }
312    
313                    return _expandoBridge;
314            }
315    
316            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
317                    getExpandoBridge().setAttributes(serviceContext);
318            }
319    
320            public Object clone() {
321                    SCProductVersionImpl scProductVersionImpl = new SCProductVersionImpl();
322    
323                    scProductVersionImpl.setProductVersionId(getProductVersionId());
324    
325                    scProductVersionImpl.setCompanyId(getCompanyId());
326    
327                    scProductVersionImpl.setUserId(getUserId());
328    
329                    scProductVersionImpl.setUserName(getUserName());
330    
331                    scProductVersionImpl.setCreateDate(getCreateDate());
332    
333                    scProductVersionImpl.setModifiedDate(getModifiedDate());
334    
335                    scProductVersionImpl.setProductEntryId(getProductEntryId());
336    
337                    scProductVersionImpl.setVersion(getVersion());
338    
339                    scProductVersionImpl.setChangeLog(getChangeLog());
340    
341                    scProductVersionImpl.setDownloadPageURL(getDownloadPageURL());
342    
343                    scProductVersionImpl.setDirectDownloadURL(getDirectDownloadURL());
344    
345                    SCProductVersionModelImpl scProductVersionModelImpl = scProductVersionImpl;
346    
347                    scProductVersionModelImpl._originalDirectDownloadURL = scProductVersionModelImpl._directDownloadURL;
348    
349                    scProductVersionImpl.setRepoStoreArtifact(getRepoStoreArtifact());
350    
351                    return scProductVersionImpl;
352            }
353    
354            public int compareTo(SCProductVersion scProductVersion) {
355                    int value = 0;
356    
357                    value = DateUtil.compareTo(getCreateDate(),
358                                    scProductVersion.getCreateDate());
359    
360                    value = value * -1;
361    
362                    if (value != 0) {
363                            return value;
364                    }
365    
366                    return 0;
367            }
368    
369            public boolean equals(Object obj) {
370                    if (obj == null) {
371                            return false;
372                    }
373    
374                    SCProductVersion scProductVersion = null;
375    
376                    try {
377                            scProductVersion = (SCProductVersion)obj;
378                    }
379                    catch (ClassCastException cce) {
380                            return false;
381                    }
382    
383                    long pk = scProductVersion.getPrimaryKey();
384    
385                    if (getPrimaryKey() == pk) {
386                            return true;
387                    }
388                    else {
389                            return false;
390                    }
391            }
392    
393            public int hashCode() {
394                    return (int)getPrimaryKey();
395            }
396    
397            public String toString() {
398                    StringBundler sb = new StringBundler(25);
399    
400                    sb.append("{productVersionId=");
401                    sb.append(getProductVersionId());
402                    sb.append(", companyId=");
403                    sb.append(getCompanyId());
404                    sb.append(", userId=");
405                    sb.append(getUserId());
406                    sb.append(", userName=");
407                    sb.append(getUserName());
408                    sb.append(", createDate=");
409                    sb.append(getCreateDate());
410                    sb.append(", modifiedDate=");
411                    sb.append(getModifiedDate());
412                    sb.append(", productEntryId=");
413                    sb.append(getProductEntryId());
414                    sb.append(", version=");
415                    sb.append(getVersion());
416                    sb.append(", changeLog=");
417                    sb.append(getChangeLog());
418                    sb.append(", downloadPageURL=");
419                    sb.append(getDownloadPageURL());
420                    sb.append(", directDownloadURL=");
421                    sb.append(getDirectDownloadURL());
422                    sb.append(", repoStoreArtifact=");
423                    sb.append(getRepoStoreArtifact());
424                    sb.append("}");
425    
426                    return sb.toString();
427            }
428    
429            public String toXmlString() {
430                    StringBundler sb = new StringBundler(40);
431    
432                    sb.append("<model><model-name>");
433                    sb.append("com.liferay.portlet.softwarecatalog.model.SCProductVersion");
434                    sb.append("</model-name>");
435    
436                    sb.append(
437                            "<column><column-name>productVersionId</column-name><column-value><![CDATA[");
438                    sb.append(getProductVersionId());
439                    sb.append("]]></column-value></column>");
440                    sb.append(
441                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
442                    sb.append(getCompanyId());
443                    sb.append("]]></column-value></column>");
444                    sb.append(
445                            "<column><column-name>userId</column-name><column-value><![CDATA[");
446                    sb.append(getUserId());
447                    sb.append("]]></column-value></column>");
448                    sb.append(
449                            "<column><column-name>userName</column-name><column-value><![CDATA[");
450                    sb.append(getUserName());
451                    sb.append("]]></column-value></column>");
452                    sb.append(
453                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
454                    sb.append(getCreateDate());
455                    sb.append("]]></column-value></column>");
456                    sb.append(
457                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
458                    sb.append(getModifiedDate());
459                    sb.append("]]></column-value></column>");
460                    sb.append(
461                            "<column><column-name>productEntryId</column-name><column-value><![CDATA[");
462                    sb.append(getProductEntryId());
463                    sb.append("]]></column-value></column>");
464                    sb.append(
465                            "<column><column-name>version</column-name><column-value><![CDATA[");
466                    sb.append(getVersion());
467                    sb.append("]]></column-value></column>");
468                    sb.append(
469                            "<column><column-name>changeLog</column-name><column-value><![CDATA[");
470                    sb.append(getChangeLog());
471                    sb.append("]]></column-value></column>");
472                    sb.append(
473                            "<column><column-name>downloadPageURL</column-name><column-value><![CDATA[");
474                    sb.append(getDownloadPageURL());
475                    sb.append("]]></column-value></column>");
476                    sb.append(
477                            "<column><column-name>directDownloadURL</column-name><column-value><![CDATA[");
478                    sb.append(getDirectDownloadURL());
479                    sb.append("]]></column-value></column>");
480                    sb.append(
481                            "<column><column-name>repoStoreArtifact</column-name><column-value><![CDATA[");
482                    sb.append(getRepoStoreArtifact());
483                    sb.append("]]></column-value></column>");
484    
485                    sb.append("</model>");
486    
487                    return sb.toString();
488            }
489    
490            private long _productVersionId;
491            private long _companyId;
492            private long _userId;
493            private String _userUuid;
494            private String _userName;
495            private Date _createDate;
496            private Date _modifiedDate;
497            private long _productEntryId;
498            private String _version;
499            private String _changeLog;
500            private String _downloadPageURL;
501            private String _directDownloadURL;
502            private String _originalDirectDownloadURL;
503            private boolean _repoStoreArtifact;
504            private transient ExpandoBridge _expandoBridge;
505    }