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