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