1
14
15 package com.liferay.portlet.softwarecatalog.model.impl;
16
17 import com.liferay.portal.SystemException;
18 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
19 import com.liferay.portal.kernel.util.DateUtil;
20 import com.liferay.portal.kernel.util.GetterUtil;
21 import com.liferay.portal.kernel.util.HtmlUtil;
22 import com.liferay.portal.kernel.util.StringBundler;
23 import com.liferay.portal.model.impl.BaseModelImpl;
24 import com.liferay.portal.util.PortalUtil;
25
26 import com.liferay.portlet.softwarecatalog.model.SCProductVersion;
27 import com.liferay.portlet.softwarecatalog.model.SCProductVersionSoap;
28
29 import java.io.Serializable;
30
31 import java.lang.reflect.Proxy;
32
33 import java.sql.Types;
34
35 import java.util.ArrayList;
36 import java.util.Date;
37 import java.util.List;
38
39
58 public class SCProductVersionModelImpl extends BaseModelImpl<SCProductVersion> {
59 public static final String TABLE_NAME = "SCProductVersion";
60 public static final Object[][] TABLE_COLUMNS = {
61 { "productVersionId", new Integer(Types.BIGINT) },
62 { "companyId", new Integer(Types.BIGINT) },
63 { "userId", new Integer(Types.BIGINT) },
64 { "userName", new Integer(Types.VARCHAR) },
65 { "createDate", new Integer(Types.TIMESTAMP) },
66 { "modifiedDate", new Integer(Types.TIMESTAMP) },
67 { "productEntryId", new Integer(Types.BIGINT) },
68 { "version", new Integer(Types.VARCHAR) },
69 { "changeLog", new Integer(Types.VARCHAR) },
70 { "downloadPageURL", new Integer(Types.VARCHAR) },
71 { "directDownloadURL", new Integer(Types.VARCHAR) },
72 { "repoStoreArtifact", new Integer(Types.BOOLEAN) }
73 };
74 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)";
75 public static final String TABLE_SQL_DROP = "drop table SCProductVersion";
76 public static final String ORDER_BY_JPQL = " ORDER BY scProductVersion.createDate DESC";
77 public static final String ORDER_BY_SQL = " ORDER BY SCProductVersion.createDate DESC";
78 public static final String DATA_SOURCE = "liferayDataSource";
79 public static final String SESSION_FACTORY = "liferaySessionFactory";
80 public static final String TX_MANAGER = "liferayTransactionManager";
81 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
82 "value.object.entity.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCProductVersion"),
83 true);
84 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
85 "value.object.finder.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCProductVersion"),
86 true);
87
88 public static SCProductVersion toModel(SCProductVersionSoap soapModel) {
89 SCProductVersion model = new SCProductVersionImpl();
90
91 model.setProductVersionId(soapModel.getProductVersionId());
92 model.setCompanyId(soapModel.getCompanyId());
93 model.setUserId(soapModel.getUserId());
94 model.setUserName(soapModel.getUserName());
95 model.setCreateDate(soapModel.getCreateDate());
96 model.setModifiedDate(soapModel.getModifiedDate());
97 model.setProductEntryId(soapModel.getProductEntryId());
98 model.setVersion(soapModel.getVersion());
99 model.setChangeLog(soapModel.getChangeLog());
100 model.setDownloadPageURL(soapModel.getDownloadPageURL());
101 model.setDirectDownloadURL(soapModel.getDirectDownloadURL());
102 model.setRepoStoreArtifact(soapModel.getRepoStoreArtifact());
103
104 return model;
105 }
106
107 public static List<SCProductVersion> toModels(
108 SCProductVersionSoap[] soapModels) {
109 List<SCProductVersion> models = new ArrayList<SCProductVersion>(soapModels.length);
110
111 for (SCProductVersionSoap soapModel : soapModels) {
112 models.add(toModel(soapModel));
113 }
114
115 return models;
116 }
117
118 public static final String MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME =
119 com.liferay.portlet.softwarecatalog.model.impl.SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME;
120 public static final boolean FINDER_CACHE_ENABLED_SCFRAMEWORKVERSI_SCPRODUCTVERS =
121 com.liferay.portlet.softwarecatalog.model.impl.SCFrameworkVersionModelImpl.FINDER_CACHE_ENABLED_SCFRAMEWORKVERSI_SCPRODUCTVERS;
122 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
123 "lock.expiration.time.com.liferay.portlet.softwarecatalog.model.SCProductVersion"));
124
125 public SCProductVersionModelImpl() {
126 }
127
128 public long getPrimaryKey() {
129 return _productVersionId;
130 }
131
132 public void setPrimaryKey(long pk) {
133 setProductVersionId(pk);
134 }
135
136 public Serializable getPrimaryKeyObj() {
137 return new Long(_productVersionId);
138 }
139
140 public long getProductVersionId() {
141 return _productVersionId;
142 }
143
144 public void setProductVersionId(long productVersionId) {
145 _productVersionId = productVersionId;
146 }
147
148 public long getCompanyId() {
149 return _companyId;
150 }
151
152 public void setCompanyId(long companyId) {
153 _companyId = companyId;
154 }
155
156 public long getUserId() {
157 return _userId;
158 }
159
160 public void setUserId(long userId) {
161 _userId = userId;
162 }
163
164 public String getUserUuid() throws SystemException {
165 return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
166 }
167
168 public void setUserUuid(String userUuid) {
169 _userUuid = userUuid;
170 }
171
172 public String getUserName() {
173 return GetterUtil.getString(_userName);
174 }
175
176 public void setUserName(String userName) {
177 _userName = userName;
178 }
179
180 public Date getCreateDate() {
181 return _createDate;
182 }
183
184 public void setCreateDate(Date createDate) {
185 _createDate = createDate;
186 }
187
188 public Date getModifiedDate() {
189 return _modifiedDate;
190 }
191
192 public void setModifiedDate(Date modifiedDate) {
193 _modifiedDate = modifiedDate;
194 }
195
196 public long getProductEntryId() {
197 return _productEntryId;
198 }
199
200 public void setProductEntryId(long productEntryId) {
201 _productEntryId = productEntryId;
202 }
203
204 public String getVersion() {
205 return GetterUtil.getString(_version);
206 }
207
208 public void setVersion(String version) {
209 _version = version;
210 }
211
212 public String getChangeLog() {
213 return GetterUtil.getString(_changeLog);
214 }
215
216 public void setChangeLog(String changeLog) {
217 _changeLog = changeLog;
218 }
219
220 public String getDownloadPageURL() {
221 return GetterUtil.getString(_downloadPageURL);
222 }
223
224 public void setDownloadPageURL(String downloadPageURL) {
225 _downloadPageURL = downloadPageURL;
226 }
227
228 public String getDirectDownloadURL() {
229 return GetterUtil.getString(_directDownloadURL);
230 }
231
232 public void setDirectDownloadURL(String directDownloadURL) {
233 _directDownloadURL = directDownloadURL;
234
235 if (_originalDirectDownloadURL == null) {
236 _originalDirectDownloadURL = directDownloadURL;
237 }
238 }
239
240 public String getOriginalDirectDownloadURL() {
241 return GetterUtil.getString(_originalDirectDownloadURL);
242 }
243
244 public boolean getRepoStoreArtifact() {
245 return _repoStoreArtifact;
246 }
247
248 public boolean isRepoStoreArtifact() {
249 return _repoStoreArtifact;
250 }
251
252 public void setRepoStoreArtifact(boolean repoStoreArtifact) {
253 _repoStoreArtifact = repoStoreArtifact;
254 }
255
256 public SCProductVersion toEscapedModel() {
257 if (isEscapedModel()) {
258 return (SCProductVersion)this;
259 }
260 else {
261 SCProductVersion model = new SCProductVersionImpl();
262
263 model.setNew(isNew());
264 model.setEscapedModel(true);
265
266 model.setProductVersionId(getProductVersionId());
267 model.setCompanyId(getCompanyId());
268 model.setUserId(getUserId());
269 model.setUserName(HtmlUtil.escape(getUserName()));
270 model.setCreateDate(getCreateDate());
271 model.setModifiedDate(getModifiedDate());
272 model.setProductEntryId(getProductEntryId());
273 model.setVersion(HtmlUtil.escape(getVersion()));
274 model.setChangeLog(HtmlUtil.escape(getChangeLog()));
275 model.setDownloadPageURL(HtmlUtil.escape(getDownloadPageURL()));
276 model.setDirectDownloadURL(HtmlUtil.escape(getDirectDownloadURL()));
277 model.setRepoStoreArtifact(getRepoStoreArtifact());
278
279 model = (SCProductVersion)Proxy.newProxyInstance(SCProductVersion.class.getClassLoader(),
280 new Class[] { SCProductVersion.class },
281 new ReadOnlyBeanHandler(model));
282
283 return model;
284 }
285 }
286
287 public Object clone() {
288 SCProductVersionImpl clone = new SCProductVersionImpl();
289
290 clone.setProductVersionId(getProductVersionId());
291 clone.setCompanyId(getCompanyId());
292 clone.setUserId(getUserId());
293 clone.setUserName(getUserName());
294 clone.setCreateDate(getCreateDate());
295 clone.setModifiedDate(getModifiedDate());
296 clone.setProductEntryId(getProductEntryId());
297 clone.setVersion(getVersion());
298 clone.setChangeLog(getChangeLog());
299 clone.setDownloadPageURL(getDownloadPageURL());
300 clone.setDirectDownloadURL(getDirectDownloadURL());
301 clone.setRepoStoreArtifact(getRepoStoreArtifact());
302
303 return clone;
304 }
305
306 public int compareTo(SCProductVersion scProductVersion) {
307 int value = 0;
308
309 value = DateUtil.compareTo(getCreateDate(),
310 scProductVersion.getCreateDate());
311
312 value = value * -1;
313
314 if (value != 0) {
315 return value;
316 }
317
318 return 0;
319 }
320
321 public boolean equals(Object obj) {
322 if (obj == null) {
323 return false;
324 }
325
326 SCProductVersion scProductVersion = null;
327
328 try {
329 scProductVersion = (SCProductVersion)obj;
330 }
331 catch (ClassCastException cce) {
332 return false;
333 }
334
335 long pk = scProductVersion.getPrimaryKey();
336
337 if (getPrimaryKey() == pk) {
338 return true;
339 }
340 else {
341 return false;
342 }
343 }
344
345 public int hashCode() {
346 return (int)getPrimaryKey();
347 }
348
349 public String toString() {
350 StringBundler sb = new StringBundler(25);
351
352 sb.append("{productVersionId=");
353 sb.append(getProductVersionId());
354 sb.append(", companyId=");
355 sb.append(getCompanyId());
356 sb.append(", userId=");
357 sb.append(getUserId());
358 sb.append(", userName=");
359 sb.append(getUserName());
360 sb.append(", createDate=");
361 sb.append(getCreateDate());
362 sb.append(", modifiedDate=");
363 sb.append(getModifiedDate());
364 sb.append(", productEntryId=");
365 sb.append(getProductEntryId());
366 sb.append(", version=");
367 sb.append(getVersion());
368 sb.append(", changeLog=");
369 sb.append(getChangeLog());
370 sb.append(", downloadPageURL=");
371 sb.append(getDownloadPageURL());
372 sb.append(", directDownloadURL=");
373 sb.append(getDirectDownloadURL());
374 sb.append(", repoStoreArtifact=");
375 sb.append(getRepoStoreArtifact());
376 sb.append("}");
377
378 return sb.toString();
379 }
380
381 public String toXmlString() {
382 StringBundler sb = new StringBundler(40);
383
384 sb.append("<model><model-name>");
385 sb.append("com.liferay.portlet.softwarecatalog.model.SCProductVersion");
386 sb.append("</model-name>");
387
388 sb.append(
389 "<column><column-name>productVersionId</column-name><column-value><![CDATA[");
390 sb.append(getProductVersionId());
391 sb.append("]]></column-value></column>");
392 sb.append(
393 "<column><column-name>companyId</column-name><column-value><![CDATA[");
394 sb.append(getCompanyId());
395 sb.append("]]></column-value></column>");
396 sb.append(
397 "<column><column-name>userId</column-name><column-value><![CDATA[");
398 sb.append(getUserId());
399 sb.append("]]></column-value></column>");
400 sb.append(
401 "<column><column-name>userName</column-name><column-value><![CDATA[");
402 sb.append(getUserName());
403 sb.append("]]></column-value></column>");
404 sb.append(
405 "<column><column-name>createDate</column-name><column-value><![CDATA[");
406 sb.append(getCreateDate());
407 sb.append("]]></column-value></column>");
408 sb.append(
409 "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
410 sb.append(getModifiedDate());
411 sb.append("]]></column-value></column>");
412 sb.append(
413 "<column><column-name>productEntryId</column-name><column-value><![CDATA[");
414 sb.append(getProductEntryId());
415 sb.append("]]></column-value></column>");
416 sb.append(
417 "<column><column-name>version</column-name><column-value><![CDATA[");
418 sb.append(getVersion());
419 sb.append("]]></column-value></column>");
420 sb.append(
421 "<column><column-name>changeLog</column-name><column-value><![CDATA[");
422 sb.append(getChangeLog());
423 sb.append("]]></column-value></column>");
424 sb.append(
425 "<column><column-name>downloadPageURL</column-name><column-value><![CDATA[");
426 sb.append(getDownloadPageURL());
427 sb.append("]]></column-value></column>");
428 sb.append(
429 "<column><column-name>directDownloadURL</column-name><column-value><![CDATA[");
430 sb.append(getDirectDownloadURL());
431 sb.append("]]></column-value></column>");
432 sb.append(
433 "<column><column-name>repoStoreArtifact</column-name><column-value><![CDATA[");
434 sb.append(getRepoStoreArtifact());
435 sb.append("]]></column-value></column>");
436
437 sb.append("</model>");
438
439 return sb.toString();
440 }
441
442 private long _productVersionId;
443 private long _companyId;
444 private long _userId;
445 private String _userUuid;
446 private String _userName;
447 private Date _createDate;
448 private Date _modifiedDate;
449 private long _productEntryId;
450 private String _version;
451 private String _changeLog;
452 private String _downloadPageURL;
453 private String _directDownloadURL;
454 private String _originalDirectDownloadURL;
455 private boolean _repoStoreArtifact;
456 }