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