1
22
23 package com.liferay.portlet.softwarecatalog.model.impl;
24
25 import com.liferay.portal.SystemException;
26 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
27 import com.liferay.portal.kernel.util.DateUtil;
28 import com.liferay.portal.kernel.util.GetterUtil;
29 import com.liferay.portal.kernel.util.HtmlUtil;
30 import com.liferay.portal.model.impl.BaseModelImpl;
31 import com.liferay.portal.util.PortalUtil;
32
33 import com.liferay.portlet.softwarecatalog.model.SCProductEntry;
34 import com.liferay.portlet.softwarecatalog.model.SCProductEntrySoap;
35
36 import java.io.Serializable;
37
38 import java.lang.reflect.Proxy;
39
40 import java.sql.Types;
41
42 import java.util.ArrayList;
43 import java.util.Date;
44 import java.util.List;
45
46
65 public class SCProductEntryModelImpl extends BaseModelImpl<SCProductEntry> {
66 public static final String TABLE_NAME = "SCProductEntry";
67 public static final Object[][] TABLE_COLUMNS = {
68 { "productEntryId", new Integer(Types.BIGINT) },
69 { "groupId", new Integer(Types.BIGINT) },
70 { "companyId", new Integer(Types.BIGINT) },
71 { "userId", new Integer(Types.BIGINT) },
72 { "userName", new Integer(Types.VARCHAR) },
73 { "createDate", new Integer(Types.TIMESTAMP) },
74 { "modifiedDate", new Integer(Types.TIMESTAMP) },
75 { "name", new Integer(Types.VARCHAR) },
76 { "type_", new Integer(Types.VARCHAR) },
77 { "tags", new Integer(Types.VARCHAR) },
78 { "shortDescription", new Integer(Types.VARCHAR) },
79 { "longDescription", new Integer(Types.VARCHAR) },
80 { "pageURL", new Integer(Types.VARCHAR) },
81 { "author", new Integer(Types.VARCHAR) },
82 { "repoGroupId", new Integer(Types.VARCHAR) },
83 { "repoArtifactId", new Integer(Types.VARCHAR) }
84 };
85 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)";
86 public static final String TABLE_SQL_DROP = "drop table SCProductEntry";
87 public static final String DATA_SOURCE = "liferayDataSource";
88 public static final String SESSION_FACTORY = "liferaySessionFactory";
89 public static final String TX_MANAGER = "liferayTransactionManager";
90 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
91 "value.object.entity.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCProductEntry"),
92 true);
93 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
94 "value.object.finder.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCProductEntry"),
95 true);
96
97 public static SCProductEntry toModel(SCProductEntrySoap soapModel) {
98 SCProductEntry model = new SCProductEntryImpl();
99
100 model.setProductEntryId(soapModel.getProductEntryId());
101 model.setGroupId(soapModel.getGroupId());
102 model.setCompanyId(soapModel.getCompanyId());
103 model.setUserId(soapModel.getUserId());
104 model.setUserName(soapModel.getUserName());
105 model.setCreateDate(soapModel.getCreateDate());
106 model.setModifiedDate(soapModel.getModifiedDate());
107 model.setName(soapModel.getName());
108 model.setType(soapModel.getType());
109 model.setTags(soapModel.getTags());
110 model.setShortDescription(soapModel.getShortDescription());
111 model.setLongDescription(soapModel.getLongDescription());
112 model.setPageURL(soapModel.getPageURL());
113 model.setAuthor(soapModel.getAuthor());
114 model.setRepoGroupId(soapModel.getRepoGroupId());
115 model.setRepoArtifactId(soapModel.getRepoArtifactId());
116
117 return model;
118 }
119
120 public static List<SCProductEntry> toModels(SCProductEntrySoap[] soapModels) {
121 List<SCProductEntry> models = new ArrayList<SCProductEntry>(soapModels.length);
122
123 for (SCProductEntrySoap soapModel : soapModels) {
124 models.add(toModel(soapModel));
125 }
126
127 return models;
128 }
129
130 public static final boolean FINDER_CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES =
131 com.liferay.portlet.softwarecatalog.model.impl.SCLicenseModelImpl.FINDER_CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES;
132 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
133 "lock.expiration.time.com.liferay.portlet.softwarecatalog.model.SCProductEntry"));
134
135 public SCProductEntryModelImpl() {
136 }
137
138 public long getPrimaryKey() {
139 return _productEntryId;
140 }
141
142 public void setPrimaryKey(long pk) {
143 setProductEntryId(pk);
144 }
145
146 public Serializable getPrimaryKeyObj() {
147 return new Long(_productEntryId);
148 }
149
150 public long getProductEntryId() {
151 return _productEntryId;
152 }
153
154 public void setProductEntryId(long productEntryId) {
155 _productEntryId = productEntryId;
156 }
157
158 public long getGroupId() {
159 return _groupId;
160 }
161
162 public void setGroupId(long groupId) {
163 _groupId = groupId;
164 }
165
166 public long getCompanyId() {
167 return _companyId;
168 }
169
170 public void setCompanyId(long companyId) {
171 _companyId = companyId;
172 }
173
174 public long getUserId() {
175 return _userId;
176 }
177
178 public void setUserId(long userId) {
179 _userId = userId;
180 }
181
182 public String getUserUuid() throws SystemException {
183 return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
184 }
185
186 public void setUserUuid(String userUuid) {
187 _userUuid = userUuid;
188 }
189
190 public String getUserName() {
191 return GetterUtil.getString(_userName);
192 }
193
194 public void setUserName(String userName) {
195 _userName = userName;
196 }
197
198 public Date getCreateDate() {
199 return _createDate;
200 }
201
202 public void setCreateDate(Date createDate) {
203 _createDate = createDate;
204 }
205
206 public Date getModifiedDate() {
207 return _modifiedDate;
208 }
209
210 public void setModifiedDate(Date modifiedDate) {
211 _modifiedDate = modifiedDate;
212 }
213
214 public String getName() {
215 return GetterUtil.getString(_name);
216 }
217
218 public void setName(String name) {
219 _name = name;
220 }
221
222 public String getType() {
223 return GetterUtil.getString(_type);
224 }
225
226 public void setType(String type) {
227 _type = type;
228 }
229
230 public String getTags() {
231 return GetterUtil.getString(_tags);
232 }
233
234 public void setTags(String tags) {
235 _tags = tags;
236 }
237
238 public String getShortDescription() {
239 return GetterUtil.getString(_shortDescription);
240 }
241
242 public void setShortDescription(String shortDescription) {
243 _shortDescription = shortDescription;
244 }
245
246 public String getLongDescription() {
247 return GetterUtil.getString(_longDescription);
248 }
249
250 public void setLongDescription(String longDescription) {
251 _longDescription = longDescription;
252 }
253
254 public String getPageURL() {
255 return GetterUtil.getString(_pageURL);
256 }
257
258 public void setPageURL(String pageURL) {
259 _pageURL = pageURL;
260 }
261
262 public String getAuthor() {
263 return GetterUtil.getString(_author);
264 }
265
266 public void setAuthor(String author) {
267 _author = author;
268 }
269
270 public String getRepoGroupId() {
271 return GetterUtil.getString(_repoGroupId);
272 }
273
274 public void setRepoGroupId(String repoGroupId) {
275 _repoGroupId = repoGroupId;
276
277 if (_originalRepoGroupId == null) {
278 _originalRepoGroupId = repoGroupId;
279 }
280 }
281
282 public String getOriginalRepoGroupId() {
283 return GetterUtil.getString(_originalRepoGroupId);
284 }
285
286 public String getRepoArtifactId() {
287 return GetterUtil.getString(_repoArtifactId);
288 }
289
290 public void setRepoArtifactId(String repoArtifactId) {
291 _repoArtifactId = repoArtifactId;
292
293 if (_originalRepoArtifactId == null) {
294 _originalRepoArtifactId = repoArtifactId;
295 }
296 }
297
298 public String getOriginalRepoArtifactId() {
299 return GetterUtil.getString(_originalRepoArtifactId);
300 }
301
302 public SCProductEntry toEscapedModel() {
303 if (isEscapedModel()) {
304 return (SCProductEntry)this;
305 }
306 else {
307 SCProductEntry model = new SCProductEntryImpl();
308
309 model.setNew(isNew());
310 model.setEscapedModel(true);
311
312 model.setProductEntryId(getProductEntryId());
313 model.setGroupId(getGroupId());
314 model.setCompanyId(getCompanyId());
315 model.setUserId(getUserId());
316 model.setUserName(HtmlUtil.escape(getUserName()));
317 model.setCreateDate(getCreateDate());
318 model.setModifiedDate(getModifiedDate());
319 model.setName(HtmlUtil.escape(getName()));
320 model.setType(HtmlUtil.escape(getType()));
321 model.setTags(HtmlUtil.escape(getTags()));
322 model.setShortDescription(HtmlUtil.escape(getShortDescription()));
323 model.setLongDescription(HtmlUtil.escape(getLongDescription()));
324 model.setPageURL(HtmlUtil.escape(getPageURL()));
325 model.setAuthor(HtmlUtil.escape(getAuthor()));
326 model.setRepoGroupId(HtmlUtil.escape(getRepoGroupId()));
327 model.setRepoArtifactId(HtmlUtil.escape(getRepoArtifactId()));
328
329 model = (SCProductEntry)Proxy.newProxyInstance(SCProductEntry.class.getClassLoader(),
330 new Class[] { SCProductEntry.class },
331 new ReadOnlyBeanHandler(model));
332
333 return model;
334 }
335 }
336
337 public Object clone() {
338 SCProductEntryImpl clone = new SCProductEntryImpl();
339
340 clone.setProductEntryId(getProductEntryId());
341 clone.setGroupId(getGroupId());
342 clone.setCompanyId(getCompanyId());
343 clone.setUserId(getUserId());
344 clone.setUserName(getUserName());
345 clone.setCreateDate(getCreateDate());
346 clone.setModifiedDate(getModifiedDate());
347 clone.setName(getName());
348 clone.setType(getType());
349 clone.setTags(getTags());
350 clone.setShortDescription(getShortDescription());
351 clone.setLongDescription(getLongDescription());
352 clone.setPageURL(getPageURL());
353 clone.setAuthor(getAuthor());
354 clone.setRepoGroupId(getRepoGroupId());
355 clone.setRepoArtifactId(getRepoArtifactId());
356
357 return clone;
358 }
359
360 public int compareTo(SCProductEntry scProductEntry) {
361 int value = 0;
362
363 value = DateUtil.compareTo(getModifiedDate(),
364 scProductEntry.getModifiedDate());
365
366 value = value * -1;
367
368 if (value != 0) {
369 return value;
370 }
371
372 value = getName().compareTo(scProductEntry.getName());
373
374 value = value * -1;
375
376 if (value != 0) {
377 return value;
378 }
379
380 return 0;
381 }
382
383 public boolean equals(Object obj) {
384 if (obj == null) {
385 return false;
386 }
387
388 SCProductEntry scProductEntry = null;
389
390 try {
391 scProductEntry = (SCProductEntry)obj;
392 }
393 catch (ClassCastException cce) {
394 return false;
395 }
396
397 long pk = scProductEntry.getPrimaryKey();
398
399 if (getPrimaryKey() == pk) {
400 return true;
401 }
402 else {
403 return false;
404 }
405 }
406
407 public int hashCode() {
408 return (int)getPrimaryKey();
409 }
410
411 public String toString() {
412 StringBuilder sb = new StringBuilder();
413
414 sb.append("{productEntryId=");
415 sb.append(getProductEntryId());
416 sb.append(", groupId=");
417 sb.append(getGroupId());
418 sb.append(", companyId=");
419 sb.append(getCompanyId());
420 sb.append(", userId=");
421 sb.append(getUserId());
422 sb.append(", userName=");
423 sb.append(getUserName());
424 sb.append(", createDate=");
425 sb.append(getCreateDate());
426 sb.append(", modifiedDate=");
427 sb.append(getModifiedDate());
428 sb.append(", name=");
429 sb.append(getName());
430 sb.append(", type=");
431 sb.append(getType());
432 sb.append(", tags=");
433 sb.append(getTags());
434 sb.append(", shortDescription=");
435 sb.append(getShortDescription());
436 sb.append(", longDescription=");
437 sb.append(getLongDescription());
438 sb.append(", pageURL=");
439 sb.append(getPageURL());
440 sb.append(", author=");
441 sb.append(getAuthor());
442 sb.append(", repoGroupId=");
443 sb.append(getRepoGroupId());
444 sb.append(", repoArtifactId=");
445 sb.append(getRepoArtifactId());
446 sb.append("}");
447
448 return sb.toString();
449 }
450
451 public String toXmlString() {
452 StringBuilder sb = new StringBuilder();
453
454 sb.append("<model><model-name>");
455 sb.append("com.liferay.portlet.softwarecatalog.model.SCProductEntry");
456 sb.append("</model-name>");
457
458 sb.append(
459 "<column><column-name>productEntryId</column-name><column-value><![CDATA[");
460 sb.append(getProductEntryId());
461 sb.append("]]></column-value></column>");
462 sb.append(
463 "<column><column-name>groupId</column-name><column-value><![CDATA[");
464 sb.append(getGroupId());
465 sb.append("]]></column-value></column>");
466 sb.append(
467 "<column><column-name>companyId</column-name><column-value><![CDATA[");
468 sb.append(getCompanyId());
469 sb.append("]]></column-value></column>");
470 sb.append(
471 "<column><column-name>userId</column-name><column-value><![CDATA[");
472 sb.append(getUserId());
473 sb.append("]]></column-value></column>");
474 sb.append(
475 "<column><column-name>userName</column-name><column-value><![CDATA[");
476 sb.append(getUserName());
477 sb.append("]]></column-value></column>");
478 sb.append(
479 "<column><column-name>createDate</column-name><column-value><![CDATA[");
480 sb.append(getCreateDate());
481 sb.append("]]></column-value></column>");
482 sb.append(
483 "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
484 sb.append(getModifiedDate());
485 sb.append("]]></column-value></column>");
486 sb.append(
487 "<column><column-name>name</column-name><column-value><![CDATA[");
488 sb.append(getName());
489 sb.append("]]></column-value></column>");
490 sb.append(
491 "<column><column-name>type</column-name><column-value><![CDATA[");
492 sb.append(getType());
493 sb.append("]]></column-value></column>");
494 sb.append(
495 "<column><column-name>tags</column-name><column-value><![CDATA[");
496 sb.append(getTags());
497 sb.append("]]></column-value></column>");
498 sb.append(
499 "<column><column-name>shortDescription</column-name><column-value><![CDATA[");
500 sb.append(getShortDescription());
501 sb.append("]]></column-value></column>");
502 sb.append(
503 "<column><column-name>longDescription</column-name><column-value><![CDATA[");
504 sb.append(getLongDescription());
505 sb.append("]]></column-value></column>");
506 sb.append(
507 "<column><column-name>pageURL</column-name><column-value><![CDATA[");
508 sb.append(getPageURL());
509 sb.append("]]></column-value></column>");
510 sb.append(
511 "<column><column-name>author</column-name><column-value><![CDATA[");
512 sb.append(getAuthor());
513 sb.append("]]></column-value></column>");
514 sb.append(
515 "<column><column-name>repoGroupId</column-name><column-value><![CDATA[");
516 sb.append(getRepoGroupId());
517 sb.append("]]></column-value></column>");
518 sb.append(
519 "<column><column-name>repoArtifactId</column-name><column-value><![CDATA[");
520 sb.append(getRepoArtifactId());
521 sb.append("]]></column-value></column>");
522
523 sb.append("</model>");
524
525 return sb.toString();
526 }
527
528 private long _productEntryId;
529 private long _groupId;
530 private long _companyId;
531 private long _userId;
532 private String _userUuid;
533 private String _userName;
534 private Date _createDate;
535 private Date _modifiedDate;
536 private String _name;
537 private String _type;
538 private String _tags;
539 private String _shortDescription;
540 private String _longDescription;
541 private String _pageURL;
542 private String _author;
543 private String _repoGroupId;
544 private String _originalRepoGroupId;
545 private String _repoArtifactId;
546 private String _originalRepoArtifactId;
547 }