001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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                    _directDownloadURL = directDownloadURL;
274    
275                    if (_originalDirectDownloadURL == null) {
276                            _originalDirectDownloadURL = directDownloadURL;
277                    }
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 clone = new SCProductVersionImpl();
322    
323                    clone.setProductVersionId(getProductVersionId());
324                    clone.setCompanyId(getCompanyId());
325                    clone.setUserId(getUserId());
326                    clone.setUserName(getUserName());
327                    clone.setCreateDate(getCreateDate());
328                    clone.setModifiedDate(getModifiedDate());
329                    clone.setProductEntryId(getProductEntryId());
330                    clone.setVersion(getVersion());
331                    clone.setChangeLog(getChangeLog());
332                    clone.setDownloadPageURL(getDownloadPageURL());
333                    clone.setDirectDownloadURL(getDirectDownloadURL());
334                    clone.setRepoStoreArtifact(getRepoStoreArtifact());
335    
336                    return clone;
337            }
338    
339            public int compareTo(SCProductVersion scProductVersion) {
340                    int value = 0;
341    
342                    value = DateUtil.compareTo(getCreateDate(),
343                                    scProductVersion.getCreateDate());
344    
345                    value = value * -1;
346    
347                    if (value != 0) {
348                            return value;
349                    }
350    
351                    return 0;
352            }
353    
354            public boolean equals(Object obj) {
355                    if (obj == null) {
356                            return false;
357                    }
358    
359                    SCProductVersion scProductVersion = null;
360    
361                    try {
362                            scProductVersion = (SCProductVersion)obj;
363                    }
364                    catch (ClassCastException cce) {
365                            return false;
366                    }
367    
368                    long pk = scProductVersion.getPrimaryKey();
369    
370                    if (getPrimaryKey() == pk) {
371                            return true;
372                    }
373                    else {
374                            return false;
375                    }
376            }
377    
378            public int hashCode() {
379                    return (int)getPrimaryKey();
380            }
381    
382            public String toString() {
383                    StringBundler sb = new StringBundler(25);
384    
385                    sb.append("{productVersionId=");
386                    sb.append(getProductVersionId());
387                    sb.append(", companyId=");
388                    sb.append(getCompanyId());
389                    sb.append(", userId=");
390                    sb.append(getUserId());
391                    sb.append(", userName=");
392                    sb.append(getUserName());
393                    sb.append(", createDate=");
394                    sb.append(getCreateDate());
395                    sb.append(", modifiedDate=");
396                    sb.append(getModifiedDate());
397                    sb.append(", productEntryId=");
398                    sb.append(getProductEntryId());
399                    sb.append(", version=");
400                    sb.append(getVersion());
401                    sb.append(", changeLog=");
402                    sb.append(getChangeLog());
403                    sb.append(", downloadPageURL=");
404                    sb.append(getDownloadPageURL());
405                    sb.append(", directDownloadURL=");
406                    sb.append(getDirectDownloadURL());
407                    sb.append(", repoStoreArtifact=");
408                    sb.append(getRepoStoreArtifact());
409                    sb.append("}");
410    
411                    return sb.toString();
412            }
413    
414            public String toXmlString() {
415                    StringBundler sb = new StringBundler(40);
416    
417                    sb.append("<model><model-name>");
418                    sb.append("com.liferay.portlet.softwarecatalog.model.SCProductVersion");
419                    sb.append("</model-name>");
420    
421                    sb.append(
422                            "<column><column-name>productVersionId</column-name><column-value><![CDATA[");
423                    sb.append(getProductVersionId());
424                    sb.append("]]></column-value></column>");
425                    sb.append(
426                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
427                    sb.append(getCompanyId());
428                    sb.append("]]></column-value></column>");
429                    sb.append(
430                            "<column><column-name>userId</column-name><column-value><![CDATA[");
431                    sb.append(getUserId());
432                    sb.append("]]></column-value></column>");
433                    sb.append(
434                            "<column><column-name>userName</column-name><column-value><![CDATA[");
435                    sb.append(getUserName());
436                    sb.append("]]></column-value></column>");
437                    sb.append(
438                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
439                    sb.append(getCreateDate());
440                    sb.append("]]></column-value></column>");
441                    sb.append(
442                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
443                    sb.append(getModifiedDate());
444                    sb.append("]]></column-value></column>");
445                    sb.append(
446                            "<column><column-name>productEntryId</column-name><column-value><![CDATA[");
447                    sb.append(getProductEntryId());
448                    sb.append("]]></column-value></column>");
449                    sb.append(
450                            "<column><column-name>version</column-name><column-value><![CDATA[");
451                    sb.append(getVersion());
452                    sb.append("]]></column-value></column>");
453                    sb.append(
454                            "<column><column-name>changeLog</column-name><column-value><![CDATA[");
455                    sb.append(getChangeLog());
456                    sb.append("]]></column-value></column>");
457                    sb.append(
458                            "<column><column-name>downloadPageURL</column-name><column-value><![CDATA[");
459                    sb.append(getDownloadPageURL());
460                    sb.append("]]></column-value></column>");
461                    sb.append(
462                            "<column><column-name>directDownloadURL</column-name><column-value><![CDATA[");
463                    sb.append(getDirectDownloadURL());
464                    sb.append("]]></column-value></column>");
465                    sb.append(
466                            "<column><column-name>repoStoreArtifact</column-name><column-value><![CDATA[");
467                    sb.append(getRepoStoreArtifact());
468                    sb.append("]]></column-value></column>");
469    
470                    sb.append("</model>");
471    
472                    return sb.toString();
473            }
474    
475            private long _productVersionId;
476            private long _companyId;
477            private long _userId;
478            private String _userUuid;
479            private String _userName;
480            private Date _createDate;
481            private Date _modifiedDate;
482            private long _productEntryId;
483            private String _version;
484            private String _changeLog;
485            private String _downloadPageURL;
486            private String _directDownloadURL;
487            private String _originalDirectDownloadURL;
488            private boolean _repoStoreArtifact;
489            private transient ExpandoBridge _expandoBridge;
490    }