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