001
014
015 package com.liferay.portlet.softwarecatalog.model.impl;
016
017 import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.kernel.util.DateUtil;
020 import com.liferay.portal.kernel.util.GetterUtil;
021 import com.liferay.portal.kernel.util.StringBundler;
022 import com.liferay.portal.kernel.util.StringPool;
023 import com.liferay.portal.model.impl.BaseModelImpl;
024 import com.liferay.portal.service.ServiceContext;
025 import com.liferay.portal.util.PortalUtil;
026
027 import com.liferay.portlet.expando.model.ExpandoBridge;
028 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
029 import com.liferay.portlet.softwarecatalog.model.SCProductEntry;
030 import com.liferay.portlet.softwarecatalog.model.SCProductEntryModel;
031 import com.liferay.portlet.softwarecatalog.model.SCProductEntrySoap;
032
033 import java.io.Serializable;
034
035 import java.lang.reflect.Proxy;
036
037 import java.sql.Types;
038
039 import java.util.ArrayList;
040 import java.util.Date;
041 import java.util.List;
042
043
060 public class SCProductEntryModelImpl extends BaseModelImpl<SCProductEntry>
061 implements SCProductEntryModel {
062 public static final String TABLE_NAME = "SCProductEntry";
063 public static final Object[][] TABLE_COLUMNS = {
064 { "productEntryId", new Integer(Types.BIGINT) },
065 { "groupId", new Integer(Types.BIGINT) },
066 { "companyId", new Integer(Types.BIGINT) },
067 { "userId", new Integer(Types.BIGINT) },
068 { "userName", new Integer(Types.VARCHAR) },
069 { "createDate", new Integer(Types.TIMESTAMP) },
070 { "modifiedDate", new Integer(Types.TIMESTAMP) },
071 { "name", new Integer(Types.VARCHAR) },
072 { "type_", new Integer(Types.VARCHAR) },
073 { "tags", new Integer(Types.VARCHAR) },
074 { "shortDescription", new Integer(Types.VARCHAR) },
075 { "longDescription", new Integer(Types.VARCHAR) },
076 { "pageURL", new Integer(Types.VARCHAR) },
077 { "author", new Integer(Types.VARCHAR) },
078 { "repoGroupId", new Integer(Types.VARCHAR) },
079 { "repoArtifactId", new Integer(Types.VARCHAR) }
080 };
081 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)";
082 public static final String TABLE_SQL_DROP = "drop table SCProductEntry";
083 public static final String ORDER_BY_JPQL = " ORDER BY scProductEntry.modifiedDate DESC, scProductEntry.name DESC";
084 public static final String ORDER_BY_SQL = " ORDER BY SCProductEntry.modifiedDate DESC, SCProductEntry.name DESC";
085 public static final String DATA_SOURCE = "liferayDataSource";
086 public static final String SESSION_FACTORY = "liferaySessionFactory";
087 public static final String TX_MANAGER = "liferayTransactionManager";
088 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
089 "value.object.entity.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCProductEntry"),
090 true);
091 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
092 "value.object.finder.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCProductEntry"),
093 true);
094
095
101 public static SCProductEntry toModel(SCProductEntrySoap soapModel) {
102 SCProductEntry model = new SCProductEntryImpl();
103
104 model.setProductEntryId(soapModel.getProductEntryId());
105 model.setGroupId(soapModel.getGroupId());
106 model.setCompanyId(soapModel.getCompanyId());
107 model.setUserId(soapModel.getUserId());
108 model.setUserName(soapModel.getUserName());
109 model.setCreateDate(soapModel.getCreateDate());
110 model.setModifiedDate(soapModel.getModifiedDate());
111 model.setName(soapModel.getName());
112 model.setType(soapModel.getType());
113 model.setTags(soapModel.getTags());
114 model.setShortDescription(soapModel.getShortDescription());
115 model.setLongDescription(soapModel.getLongDescription());
116 model.setPageURL(soapModel.getPageURL());
117 model.setAuthor(soapModel.getAuthor());
118 model.setRepoGroupId(soapModel.getRepoGroupId());
119 model.setRepoArtifactId(soapModel.getRepoArtifactId());
120
121 return model;
122 }
123
124
130 public static List<SCProductEntry> toModels(SCProductEntrySoap[] soapModels) {
131 List<SCProductEntry> models = new ArrayList<SCProductEntry>(soapModels.length);
132
133 for (SCProductEntrySoap soapModel : soapModels) {
134 models.add(toModel(soapModel));
135 }
136
137 return models;
138 }
139
140 public static final String MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME = com.liferay.portlet.softwarecatalog.model.impl.SCLicenseModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME;
141 public static final boolean FINDER_CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES =
142 com.liferay.portlet.softwarecatalog.model.impl.SCLicenseModelImpl.FINDER_CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES;
143 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
144 "lock.expiration.time.com.liferay.portlet.softwarecatalog.model.SCProductEntry"));
145
146 public SCProductEntryModelImpl() {
147 }
148
149 public long getPrimaryKey() {
150 return _productEntryId;
151 }
152
153 public void setPrimaryKey(long pk) {
154 setProductEntryId(pk);
155 }
156
157 public Serializable getPrimaryKeyObj() {
158 return new Long(_productEntryId);
159 }
160
161 public long getProductEntryId() {
162 return _productEntryId;
163 }
164
165 public void setProductEntryId(long productEntryId) {
166 _productEntryId = productEntryId;
167 }
168
169 public long getGroupId() {
170 return _groupId;
171 }
172
173 public void setGroupId(long groupId) {
174 _groupId = groupId;
175 }
176
177 public long getCompanyId() {
178 return _companyId;
179 }
180
181 public void setCompanyId(long companyId) {
182 _companyId = companyId;
183 }
184
185 public long getUserId() {
186 return _userId;
187 }
188
189 public void setUserId(long userId) {
190 _userId = userId;
191 }
192
193 public String getUserUuid() throws SystemException {
194 return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
195 }
196
197 public void setUserUuid(String userUuid) {
198 _userUuid = userUuid;
199 }
200
201 public String getUserName() {
202 if (_userName == null) {
203 return StringPool.BLANK;
204 }
205 else {
206 return _userName;
207 }
208 }
209
210 public void setUserName(String userName) {
211 _userName = userName;
212 }
213
214 public Date getCreateDate() {
215 return _createDate;
216 }
217
218 public void setCreateDate(Date createDate) {
219 _createDate = createDate;
220 }
221
222 public Date getModifiedDate() {
223 return _modifiedDate;
224 }
225
226 public void setModifiedDate(Date modifiedDate) {
227 _modifiedDate = modifiedDate;
228 }
229
230 public String getName() {
231 if (_name == null) {
232 return StringPool.BLANK;
233 }
234 else {
235 return _name;
236 }
237 }
238
239 public void setName(String name) {
240 _name = name;
241 }
242
243 public String getType() {
244 if (_type == null) {
245 return StringPool.BLANK;
246 }
247 else {
248 return _type;
249 }
250 }
251
252 public void setType(String type) {
253 _type = type;
254 }
255
256 public String getTags() {
257 if (_tags == null) {
258 return StringPool.BLANK;
259 }
260 else {
261 return _tags;
262 }
263 }
264
265 public void setTags(String tags) {
266 _tags = tags;
267 }
268
269 public String getShortDescription() {
270 if (_shortDescription == null) {
271 return StringPool.BLANK;
272 }
273 else {
274 return _shortDescription;
275 }
276 }
277
278 public void setShortDescription(String shortDescription) {
279 _shortDescription = shortDescription;
280 }
281
282 public String getLongDescription() {
283 if (_longDescription == null) {
284 return StringPool.BLANK;
285 }
286 else {
287 return _longDescription;
288 }
289 }
290
291 public void setLongDescription(String longDescription) {
292 _longDescription = longDescription;
293 }
294
295 public String getPageURL() {
296 if (_pageURL == null) {
297 return StringPool.BLANK;
298 }
299 else {
300 return _pageURL;
301 }
302 }
303
304 public void setPageURL(String pageURL) {
305 _pageURL = pageURL;
306 }
307
308 public String getAuthor() {
309 if (_author == null) {
310 return StringPool.BLANK;
311 }
312 else {
313 return _author;
314 }
315 }
316
317 public void setAuthor(String author) {
318 _author = author;
319 }
320
321 public String getRepoGroupId() {
322 if (_repoGroupId == null) {
323 return StringPool.BLANK;
324 }
325 else {
326 return _repoGroupId;
327 }
328 }
329
330 public void setRepoGroupId(String repoGroupId) {
331 if (_originalRepoGroupId == null) {
332 _originalRepoGroupId = _repoGroupId;
333 }
334
335 _repoGroupId = repoGroupId;
336 }
337
338 public String getOriginalRepoGroupId() {
339 return GetterUtil.getString(_originalRepoGroupId);
340 }
341
342 public String getRepoArtifactId() {
343 if (_repoArtifactId == null) {
344 return StringPool.BLANK;
345 }
346 else {
347 return _repoArtifactId;
348 }
349 }
350
351 public void setRepoArtifactId(String repoArtifactId) {
352 if (_originalRepoArtifactId == null) {
353 _originalRepoArtifactId = _repoArtifactId;
354 }
355
356 _repoArtifactId = repoArtifactId;
357 }
358
359 public String getOriginalRepoArtifactId() {
360 return GetterUtil.getString(_originalRepoArtifactId);
361 }
362
363 public SCProductEntry toEscapedModel() {
364 if (isEscapedModel()) {
365 return (SCProductEntry)this;
366 }
367 else {
368 return (SCProductEntry)Proxy.newProxyInstance(SCProductEntry.class.getClassLoader(),
369 new Class[] { SCProductEntry.class },
370 new AutoEscapeBeanHandler(this));
371 }
372 }
373
374 public ExpandoBridge getExpandoBridge() {
375 if (_expandoBridge == null) {
376 _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
377 SCProductEntry.class.getName(), getPrimaryKey());
378 }
379
380 return _expandoBridge;
381 }
382
383 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
384 getExpandoBridge().setAttributes(serviceContext);
385 }
386
387 public Object clone() {
388 SCProductEntryImpl scProductEntryImpl = new SCProductEntryImpl();
389
390 scProductEntryImpl.setProductEntryId(getProductEntryId());
391
392 scProductEntryImpl.setGroupId(getGroupId());
393
394 scProductEntryImpl.setCompanyId(getCompanyId());
395
396 scProductEntryImpl.setUserId(getUserId());
397
398 scProductEntryImpl.setUserName(getUserName());
399
400 scProductEntryImpl.setCreateDate(getCreateDate());
401
402 scProductEntryImpl.setModifiedDate(getModifiedDate());
403
404 scProductEntryImpl.setName(getName());
405
406 scProductEntryImpl.setType(getType());
407
408 scProductEntryImpl.setTags(getTags());
409
410 scProductEntryImpl.setShortDescription(getShortDescription());
411
412 scProductEntryImpl.setLongDescription(getLongDescription());
413
414 scProductEntryImpl.setPageURL(getPageURL());
415
416 scProductEntryImpl.setAuthor(getAuthor());
417
418 scProductEntryImpl.setRepoGroupId(getRepoGroupId());
419
420 SCProductEntryModelImpl scProductEntryModelImpl = scProductEntryImpl;
421
422 scProductEntryModelImpl._originalRepoGroupId = scProductEntryModelImpl._repoGroupId;
423
424 scProductEntryImpl.setRepoArtifactId(getRepoArtifactId());
425
426 scProductEntryModelImpl._originalRepoArtifactId = scProductEntryModelImpl._repoArtifactId;
427
428 return scProductEntryImpl;
429 }
430
431 public int compareTo(SCProductEntry scProductEntry) {
432 int value = 0;
433
434 value = DateUtil.compareTo(getModifiedDate(),
435 scProductEntry.getModifiedDate());
436
437 value = value * -1;
438
439 if (value != 0) {
440 return value;
441 }
442
443 value = getName().compareTo(scProductEntry.getName());
444
445 value = value * -1;
446
447 if (value != 0) {
448 return value;
449 }
450
451 return 0;
452 }
453
454 public boolean equals(Object obj) {
455 if (obj == null) {
456 return false;
457 }
458
459 SCProductEntry scProductEntry = null;
460
461 try {
462 scProductEntry = (SCProductEntry)obj;
463 }
464 catch (ClassCastException cce) {
465 return false;
466 }
467
468 long pk = scProductEntry.getPrimaryKey();
469
470 if (getPrimaryKey() == pk) {
471 return true;
472 }
473 else {
474 return false;
475 }
476 }
477
478 public int hashCode() {
479 return (int)getPrimaryKey();
480 }
481
482 public String toString() {
483 StringBundler sb = new StringBundler(33);
484
485 sb.append("{productEntryId=");
486 sb.append(getProductEntryId());
487 sb.append(", groupId=");
488 sb.append(getGroupId());
489 sb.append(", companyId=");
490 sb.append(getCompanyId());
491 sb.append(", userId=");
492 sb.append(getUserId());
493 sb.append(", userName=");
494 sb.append(getUserName());
495 sb.append(", createDate=");
496 sb.append(getCreateDate());
497 sb.append(", modifiedDate=");
498 sb.append(getModifiedDate());
499 sb.append(", name=");
500 sb.append(getName());
501 sb.append(", type=");
502 sb.append(getType());
503 sb.append(", tags=");
504 sb.append(getTags());
505 sb.append(", shortDescription=");
506 sb.append(getShortDescription());
507 sb.append(", longDescription=");
508 sb.append(getLongDescription());
509 sb.append(", pageURL=");
510 sb.append(getPageURL());
511 sb.append(", author=");
512 sb.append(getAuthor());
513 sb.append(", repoGroupId=");
514 sb.append(getRepoGroupId());
515 sb.append(", repoArtifactId=");
516 sb.append(getRepoArtifactId());
517 sb.append("}");
518
519 return sb.toString();
520 }
521
522 public String toXmlString() {
523 StringBundler sb = new StringBundler(52);
524
525 sb.append("<model><model-name>");
526 sb.append("com.liferay.portlet.softwarecatalog.model.SCProductEntry");
527 sb.append("</model-name>");
528
529 sb.append(
530 "<column><column-name>productEntryId</column-name><column-value><![CDATA[");
531 sb.append(getProductEntryId());
532 sb.append("]]></column-value></column>");
533 sb.append(
534 "<column><column-name>groupId</column-name><column-value><![CDATA[");
535 sb.append(getGroupId());
536 sb.append("]]></column-value></column>");
537 sb.append(
538 "<column><column-name>companyId</column-name><column-value><![CDATA[");
539 sb.append(getCompanyId());
540 sb.append("]]></column-value></column>");
541 sb.append(
542 "<column><column-name>userId</column-name><column-value><![CDATA[");
543 sb.append(getUserId());
544 sb.append("]]></column-value></column>");
545 sb.append(
546 "<column><column-name>userName</column-name><column-value><![CDATA[");
547 sb.append(getUserName());
548 sb.append("]]></column-value></column>");
549 sb.append(
550 "<column><column-name>createDate</column-name><column-value><![CDATA[");
551 sb.append(getCreateDate());
552 sb.append("]]></column-value></column>");
553 sb.append(
554 "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
555 sb.append(getModifiedDate());
556 sb.append("]]></column-value></column>");
557 sb.append(
558 "<column><column-name>name</column-name><column-value><![CDATA[");
559 sb.append(getName());
560 sb.append("]]></column-value></column>");
561 sb.append(
562 "<column><column-name>type</column-name><column-value><![CDATA[");
563 sb.append(getType());
564 sb.append("]]></column-value></column>");
565 sb.append(
566 "<column><column-name>tags</column-name><column-value><![CDATA[");
567 sb.append(getTags());
568 sb.append("]]></column-value></column>");
569 sb.append(
570 "<column><column-name>shortDescription</column-name><column-value><![CDATA[");
571 sb.append(getShortDescription());
572 sb.append("]]></column-value></column>");
573 sb.append(
574 "<column><column-name>longDescription</column-name><column-value><![CDATA[");
575 sb.append(getLongDescription());
576 sb.append("]]></column-value></column>");
577 sb.append(
578 "<column><column-name>pageURL</column-name><column-value><![CDATA[");
579 sb.append(getPageURL());
580 sb.append("]]></column-value></column>");
581 sb.append(
582 "<column><column-name>author</column-name><column-value><![CDATA[");
583 sb.append(getAuthor());
584 sb.append("]]></column-value></column>");
585 sb.append(
586 "<column><column-name>repoGroupId</column-name><column-value><![CDATA[");
587 sb.append(getRepoGroupId());
588 sb.append("]]></column-value></column>");
589 sb.append(
590 "<column><column-name>repoArtifactId</column-name><column-value><![CDATA[");
591 sb.append(getRepoArtifactId());
592 sb.append("]]></column-value></column>");
593
594 sb.append("</model>");
595
596 return sb.toString();
597 }
598
599 private long _productEntryId;
600 private long _groupId;
601 private long _companyId;
602 private long _userId;
603 private String _userUuid;
604 private String _userName;
605 private Date _createDate;
606 private Date _modifiedDate;
607 private String _name;
608 private String _type;
609 private String _tags;
610 private String _shortDescription;
611 private String _longDescription;
612 private String _pageURL;
613 private String _author;
614 private String _repoGroupId;
615 private String _originalRepoGroupId;
616 private String _repoArtifactId;
617 private String _originalRepoArtifactId;
618 private transient ExpandoBridge _expandoBridge;
619 }