001
014
015 package com.liferay.portlet.softwarecatalog.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.kernel.bean.BeanReference;
019 import com.liferay.portal.kernel.cache.CacheRegistryUtil;
020 import com.liferay.portal.kernel.dao.jdbc.MappingSqlQuery;
021 import com.liferay.portal.kernel.dao.jdbc.MappingSqlQueryFactoryUtil;
022 import com.liferay.portal.kernel.dao.jdbc.RowMapper;
023 import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
024 import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
025 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
026 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
027 import com.liferay.portal.kernel.dao.orm.FinderPath;
028 import com.liferay.portal.kernel.dao.orm.Query;
029 import com.liferay.portal.kernel.dao.orm.QueryPos;
030 import com.liferay.portal.kernel.dao.orm.QueryUtil;
031 import com.liferay.portal.kernel.dao.orm.SQLQuery;
032 import com.liferay.portal.kernel.dao.orm.Session;
033 import com.liferay.portal.kernel.exception.SystemException;
034 import com.liferay.portal.kernel.log.Log;
035 import com.liferay.portal.kernel.log.LogFactoryUtil;
036 import com.liferay.portal.kernel.util.GetterUtil;
037 import com.liferay.portal.kernel.util.InstanceFactory;
038 import com.liferay.portal.kernel.util.OrderByComparator;
039 import com.liferay.portal.kernel.util.SetUtil;
040 import com.liferay.portal.kernel.util.StringBundler;
041 import com.liferay.portal.kernel.util.StringPool;
042 import com.liferay.portal.kernel.util.StringUtil;
043 import com.liferay.portal.kernel.util.Validator;
044 import com.liferay.portal.model.CacheModel;
045 import com.liferay.portal.model.ModelListener;
046 import com.liferay.portal.security.permission.InlineSQLHelperUtil;
047 import com.liferay.portal.service.persistence.BatchSessionUtil;
048 import com.liferay.portal.service.persistence.GroupPersistence;
049 import com.liferay.portal.service.persistence.ImagePersistence;
050 import com.liferay.portal.service.persistence.ResourcePersistence;
051 import com.liferay.portal.service.persistence.SubscriptionPersistence;
052 import com.liferay.portal.service.persistence.UserPersistence;
053 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
054
055 import com.liferay.portlet.messageboards.service.persistence.MBMessagePersistence;
056 import com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence;
057 import com.liferay.portlet.softwarecatalog.NoSuchProductEntryException;
058 import com.liferay.portlet.softwarecatalog.model.SCProductEntry;
059 import com.liferay.portlet.softwarecatalog.model.impl.SCProductEntryImpl;
060 import com.liferay.portlet.softwarecatalog.model.impl.SCProductEntryModelImpl;
061
062 import java.io.Serializable;
063
064 import java.util.ArrayList;
065 import java.util.Collections;
066 import java.util.List;
067 import java.util.Set;
068
069
081 public class SCProductEntryPersistenceImpl extends BasePersistenceImpl<SCProductEntry>
082 implements SCProductEntryPersistence {
083
088 public static final String FINDER_CLASS_NAME_ENTITY = SCProductEntryImpl.class.getName();
089 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
090 ".List1";
091 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
092 ".List2";
093 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
094 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
095 SCProductEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
096 "findByGroupId",
097 new String[] {
098 Long.class.getName(),
099
100 "java.lang.Integer", "java.lang.Integer",
101 "com.liferay.portal.kernel.util.OrderByComparator"
102 });
103 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID =
104 new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
105 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
106 SCProductEntryImpl.class,
107 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByGroupId",
108 new String[] { Long.class.getName() },
109 SCProductEntryModelImpl.GROUPID_COLUMN_BITMASK);
110 public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
111 SCProductEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
112 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByGroupId",
113 new String[] { Long.class.getName() });
114 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID =
115 new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
116 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
117 SCProductEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
118 "findByCompanyId",
119 new String[] {
120 Long.class.getName(),
121
122 "java.lang.Integer", "java.lang.Integer",
123 "com.liferay.portal.kernel.util.OrderByComparator"
124 });
125 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID =
126 new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
127 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
128 SCProductEntryImpl.class,
129 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByCompanyId",
130 new String[] { Long.class.getName() },
131 SCProductEntryModelImpl.COMPANYID_COLUMN_BITMASK);
132 public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
133 SCProductEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
134 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByCompanyId",
135 new String[] { Long.class.getName() });
136 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_U = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
137 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
138 SCProductEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
139 "findByG_U",
140 new String[] {
141 Long.class.getName(), Long.class.getName(),
142
143 "java.lang.Integer", "java.lang.Integer",
144 "com.liferay.portal.kernel.util.OrderByComparator"
145 });
146 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
147 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
148 SCProductEntryImpl.class,
149 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_U",
150 new String[] { Long.class.getName(), Long.class.getName() },
151 SCProductEntryModelImpl.GROUPID_COLUMN_BITMASK |
152 SCProductEntryModelImpl.USERID_COLUMN_BITMASK);
153 public static final FinderPath FINDER_PATH_COUNT_BY_G_U = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
154 SCProductEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
155 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_U",
156 new String[] { Long.class.getName(), Long.class.getName() });
157 public static final FinderPath FINDER_PATH_FETCH_BY_RG_RA = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
158 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
159 SCProductEntryImpl.class, FINDER_CLASS_NAME_ENTITY, "fetchByRG_RA",
160 new String[] { String.class.getName(), String.class.getName() },
161 SCProductEntryModelImpl.REPOGROUPID_COLUMN_BITMASK |
162 SCProductEntryModelImpl.REPOARTIFACTID_COLUMN_BITMASK);
163 public static final FinderPath FINDER_PATH_COUNT_BY_RG_RA = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
164 SCProductEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
165 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByRG_RA",
166 new String[] { String.class.getName(), String.class.getName() });
167 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
168 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
169 SCProductEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
170 "findAll", new String[0]);
171 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
172 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
173 SCProductEntryImpl.class,
174 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
175 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
176 SCProductEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
177 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
178
179
184 public void cacheResult(SCProductEntry scProductEntry) {
185 EntityCacheUtil.putResult(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
186 SCProductEntryImpl.class, scProductEntry.getPrimaryKey(),
187 scProductEntry);
188
189 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_RG_RA,
190 new Object[] {
191 scProductEntry.getRepoGroupId(),
192
193 scProductEntry.getRepoArtifactId()
194 }, scProductEntry);
195
196 scProductEntry.resetOriginalValues();
197 }
198
199
204 public void cacheResult(List<SCProductEntry> scProductEntries) {
205 for (SCProductEntry scProductEntry : scProductEntries) {
206 if (EntityCacheUtil.getResult(
207 SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
208 SCProductEntryImpl.class, scProductEntry.getPrimaryKey()) == null) {
209 cacheResult(scProductEntry);
210 }
211 else {
212 scProductEntry.resetOriginalValues();
213 }
214 }
215 }
216
217
224 @Override
225 public void clearCache() {
226 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
227 CacheRegistryUtil.clear(SCProductEntryImpl.class.getName());
228 }
229
230 EntityCacheUtil.clearCache(SCProductEntryImpl.class.getName());
231
232 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
233 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
234 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
235 }
236
237
244 @Override
245 public void clearCache(SCProductEntry scProductEntry) {
246 EntityCacheUtil.removeResult(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
247 SCProductEntryImpl.class, scProductEntry.getPrimaryKey());
248
249 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
250 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
251
252 clearUniqueFindersCache(scProductEntry);
253 }
254
255 @Override
256 public void clearCache(List<SCProductEntry> scProductEntries) {
257 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
258 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
259
260 for (SCProductEntry scProductEntry : scProductEntries) {
261 EntityCacheUtil.removeResult(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
262 SCProductEntryImpl.class, scProductEntry.getPrimaryKey());
263
264 clearUniqueFindersCache(scProductEntry);
265 }
266 }
267
268 protected void cacheUniqueFindersCache(SCProductEntry scProductEntry) {
269 if (scProductEntry.isNew()) {
270 Object[] args = new Object[] {
271 scProductEntry.getRepoGroupId(),
272
273 scProductEntry.getRepoArtifactId()
274 };
275
276 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_RG_RA, args,
277 Long.valueOf(1));
278 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_RG_RA, args,
279 scProductEntry);
280 }
281 else {
282 SCProductEntryModelImpl scProductEntryModelImpl = (SCProductEntryModelImpl)scProductEntry;
283
284 if ((scProductEntryModelImpl.getColumnBitmask() &
285 FINDER_PATH_FETCH_BY_RG_RA.getColumnBitmask()) != 0) {
286 Object[] args = new Object[] {
287 scProductEntry.getRepoGroupId(),
288
289 scProductEntry.getRepoArtifactId()
290 };
291
292 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_RG_RA, args,
293 Long.valueOf(1));
294 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_RG_RA, args,
295 scProductEntry);
296 }
297 }
298 }
299
300 protected void clearUniqueFindersCache(SCProductEntry scProductEntry) {
301 SCProductEntryModelImpl scProductEntryModelImpl = (SCProductEntryModelImpl)scProductEntry;
302
303 Object[] args = new Object[] {
304 scProductEntry.getRepoGroupId(),
305
306 scProductEntry.getRepoArtifactId()
307 };
308
309 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_RG_RA, args);
310 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_RG_RA, args);
311
312 if ((scProductEntryModelImpl.getColumnBitmask() &
313 FINDER_PATH_FETCH_BY_RG_RA.getColumnBitmask()) != 0) {
314 args = new Object[] {
315 scProductEntryModelImpl.getOriginalRepoGroupId(),
316
317 scProductEntryModelImpl.getOriginalRepoArtifactId()
318 };
319
320 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_RG_RA, args);
321 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_RG_RA, args);
322 }
323 }
324
325
331 public SCProductEntry create(long productEntryId) {
332 SCProductEntry scProductEntry = new SCProductEntryImpl();
333
334 scProductEntry.setNew(true);
335 scProductEntry.setPrimaryKey(productEntryId);
336
337 return scProductEntry;
338 }
339
340
348 public SCProductEntry remove(long productEntryId)
349 throws NoSuchProductEntryException, SystemException {
350 return remove(Long.valueOf(productEntryId));
351 }
352
353
361 @Override
362 public SCProductEntry remove(Serializable primaryKey)
363 throws NoSuchProductEntryException, SystemException {
364 Session session = null;
365
366 try {
367 session = openSession();
368
369 SCProductEntry scProductEntry = (SCProductEntry)session.get(SCProductEntryImpl.class,
370 primaryKey);
371
372 if (scProductEntry == null) {
373 if (_log.isWarnEnabled()) {
374 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
375 }
376
377 throw new NoSuchProductEntryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
378 primaryKey);
379 }
380
381 return remove(scProductEntry);
382 }
383 catch (NoSuchProductEntryException nsee) {
384 throw nsee;
385 }
386 catch (Exception e) {
387 throw processException(e);
388 }
389 finally {
390 closeSession(session);
391 }
392 }
393
394 @Override
395 protected SCProductEntry removeImpl(SCProductEntry scProductEntry)
396 throws SystemException {
397 scProductEntry = toUnwrappedModel(scProductEntry);
398
399 try {
400 clearSCLicenses.clear(scProductEntry.getPrimaryKey());
401 }
402 catch (Exception e) {
403 throw processException(e);
404 }
405 finally {
406 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
407 }
408
409 Session session = null;
410
411 try {
412 session = openSession();
413
414 BatchSessionUtil.delete(session, scProductEntry);
415 }
416 catch (Exception e) {
417 throw processException(e);
418 }
419 finally {
420 closeSession(session);
421 }
422
423 clearCache(scProductEntry);
424
425 return scProductEntry;
426 }
427
428 @Override
429 public SCProductEntry updateImpl(
430 com.liferay.portlet.softwarecatalog.model.SCProductEntry scProductEntry,
431 boolean merge) throws SystemException {
432 scProductEntry = toUnwrappedModel(scProductEntry);
433
434 boolean isNew = scProductEntry.isNew();
435
436 SCProductEntryModelImpl scProductEntryModelImpl = (SCProductEntryModelImpl)scProductEntry;
437
438 Session session = null;
439
440 try {
441 session = openSession();
442
443 BatchSessionUtil.update(session, scProductEntry, merge);
444
445 scProductEntry.setNew(false);
446 }
447 catch (Exception e) {
448 throw processException(e);
449 }
450 finally {
451 closeSession(session);
452 }
453
454 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
455
456 if (isNew || !SCProductEntryModelImpl.COLUMN_BITMASK_ENABLED) {
457 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
458 }
459
460 else {
461 if ((scProductEntryModelImpl.getColumnBitmask() &
462 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID.getColumnBitmask()) != 0) {
463 Object[] args = new Object[] {
464 Long.valueOf(scProductEntryModelImpl.getOriginalGroupId())
465 };
466
467 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
468 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
469 args);
470
471 args = new Object[] {
472 Long.valueOf(scProductEntryModelImpl.getGroupId())
473 };
474
475 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
476 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
477 args);
478 }
479
480 if ((scProductEntryModelImpl.getColumnBitmask() &
481 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID.getColumnBitmask()) != 0) {
482 Object[] args = new Object[] {
483 Long.valueOf(scProductEntryModelImpl.getOriginalCompanyId())
484 };
485
486 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID,
487 args);
488 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
489 args);
490
491 args = new Object[] {
492 Long.valueOf(scProductEntryModelImpl.getCompanyId())
493 };
494
495 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID,
496 args);
497 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
498 args);
499 }
500
501 if ((scProductEntryModelImpl.getColumnBitmask() &
502 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U.getColumnBitmask()) != 0) {
503 Object[] args = new Object[] {
504 Long.valueOf(scProductEntryModelImpl.getOriginalGroupId()),
505 Long.valueOf(scProductEntryModelImpl.getOriginalUserId())
506 };
507
508 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_U, args);
509 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U,
510 args);
511
512 args = new Object[] {
513 Long.valueOf(scProductEntryModelImpl.getGroupId()),
514 Long.valueOf(scProductEntryModelImpl.getUserId())
515 };
516
517 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_U, args);
518 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U,
519 args);
520 }
521 }
522
523 EntityCacheUtil.putResult(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
524 SCProductEntryImpl.class, scProductEntry.getPrimaryKey(),
525 scProductEntry);
526
527 clearUniqueFindersCache(scProductEntry);
528 cacheUniqueFindersCache(scProductEntry);
529
530 return scProductEntry;
531 }
532
533 protected SCProductEntry toUnwrappedModel(SCProductEntry scProductEntry) {
534 if (scProductEntry instanceof SCProductEntryImpl) {
535 return scProductEntry;
536 }
537
538 SCProductEntryImpl scProductEntryImpl = new SCProductEntryImpl();
539
540 scProductEntryImpl.setNew(scProductEntry.isNew());
541 scProductEntryImpl.setPrimaryKey(scProductEntry.getPrimaryKey());
542
543 scProductEntryImpl.setProductEntryId(scProductEntry.getProductEntryId());
544 scProductEntryImpl.setGroupId(scProductEntry.getGroupId());
545 scProductEntryImpl.setCompanyId(scProductEntry.getCompanyId());
546 scProductEntryImpl.setUserId(scProductEntry.getUserId());
547 scProductEntryImpl.setUserName(scProductEntry.getUserName());
548 scProductEntryImpl.setCreateDate(scProductEntry.getCreateDate());
549 scProductEntryImpl.setModifiedDate(scProductEntry.getModifiedDate());
550 scProductEntryImpl.setName(scProductEntry.getName());
551 scProductEntryImpl.setType(scProductEntry.getType());
552 scProductEntryImpl.setTags(scProductEntry.getTags());
553 scProductEntryImpl.setShortDescription(scProductEntry.getShortDescription());
554 scProductEntryImpl.setLongDescription(scProductEntry.getLongDescription());
555 scProductEntryImpl.setPageURL(scProductEntry.getPageURL());
556 scProductEntryImpl.setAuthor(scProductEntry.getAuthor());
557 scProductEntryImpl.setRepoGroupId(scProductEntry.getRepoGroupId());
558 scProductEntryImpl.setRepoArtifactId(scProductEntry.getRepoArtifactId());
559
560 return scProductEntryImpl;
561 }
562
563
571 @Override
572 public SCProductEntry findByPrimaryKey(Serializable primaryKey)
573 throws NoSuchModelException, SystemException {
574 return findByPrimaryKey(((Long)primaryKey).longValue());
575 }
576
577
585 public SCProductEntry findByPrimaryKey(long productEntryId)
586 throws NoSuchProductEntryException, SystemException {
587 SCProductEntry scProductEntry = fetchByPrimaryKey(productEntryId);
588
589 if (scProductEntry == null) {
590 if (_log.isWarnEnabled()) {
591 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + productEntryId);
592 }
593
594 throw new NoSuchProductEntryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
595 productEntryId);
596 }
597
598 return scProductEntry;
599 }
600
601
608 @Override
609 public SCProductEntry fetchByPrimaryKey(Serializable primaryKey)
610 throws SystemException {
611 return fetchByPrimaryKey(((Long)primaryKey).longValue());
612 }
613
614
621 public SCProductEntry fetchByPrimaryKey(long productEntryId)
622 throws SystemException {
623 SCProductEntry scProductEntry = (SCProductEntry)EntityCacheUtil.getResult(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
624 SCProductEntryImpl.class, productEntryId);
625
626 if (scProductEntry == _nullSCProductEntry) {
627 return null;
628 }
629
630 if (scProductEntry == null) {
631 Session session = null;
632
633 boolean hasException = false;
634
635 try {
636 session = openSession();
637
638 scProductEntry = (SCProductEntry)session.get(SCProductEntryImpl.class,
639 Long.valueOf(productEntryId));
640 }
641 catch (Exception e) {
642 hasException = true;
643
644 throw processException(e);
645 }
646 finally {
647 if (scProductEntry != null) {
648 cacheResult(scProductEntry);
649 }
650 else if (!hasException) {
651 EntityCacheUtil.putResult(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
652 SCProductEntryImpl.class, productEntryId,
653 _nullSCProductEntry);
654 }
655
656 closeSession(session);
657 }
658 }
659
660 return scProductEntry;
661 }
662
663
670 public List<SCProductEntry> findByGroupId(long groupId)
671 throws SystemException {
672 return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
673 }
674
675
688 public List<SCProductEntry> findByGroupId(long groupId, int start, int end)
689 throws SystemException {
690 return findByGroupId(groupId, start, end, null);
691 }
692
693
707 public List<SCProductEntry> findByGroupId(long groupId, int start, int end,
708 OrderByComparator orderByComparator) throws SystemException {
709 FinderPath finderPath = null;
710 Object[] finderArgs = null;
711
712 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
713 (orderByComparator == null)) {
714 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID;
715 finderArgs = new Object[] { groupId };
716 }
717 else {
718 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID;
719 finderArgs = new Object[] { groupId, start, end, orderByComparator };
720 }
721
722 List<SCProductEntry> list = (List<SCProductEntry>)FinderCacheUtil.getResult(finderPath,
723 finderArgs, this);
724
725 if ((list != null) && !list.isEmpty()) {
726 for (SCProductEntry scProductEntry : list) {
727 if ((groupId != scProductEntry.getGroupId())) {
728 list = null;
729
730 break;
731 }
732 }
733 }
734
735 if (list == null) {
736 StringBundler query = null;
737
738 if (orderByComparator != null) {
739 query = new StringBundler(3 +
740 (orderByComparator.getOrderByFields().length * 3));
741 }
742 else {
743 query = new StringBundler(3);
744 }
745
746 query.append(_SQL_SELECT_SCPRODUCTENTRY_WHERE);
747
748 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
749
750 if (orderByComparator != null) {
751 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
752 orderByComparator);
753 }
754
755 else {
756 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
757 }
758
759 String sql = query.toString();
760
761 Session session = null;
762
763 try {
764 session = openSession();
765
766 Query q = session.createQuery(sql);
767
768 QueryPos qPos = QueryPos.getInstance(q);
769
770 qPos.add(groupId);
771
772 list = (List<SCProductEntry>)QueryUtil.list(q, getDialect(),
773 start, end);
774 }
775 catch (Exception e) {
776 throw processException(e);
777 }
778 finally {
779 if (list == null) {
780 FinderCacheUtil.removeResult(finderPath, finderArgs);
781 }
782 else {
783 cacheResult(list);
784
785 FinderCacheUtil.putResult(finderPath, finderArgs, list);
786 }
787
788 closeSession(session);
789 }
790 }
791
792 return list;
793 }
794
795
804 public SCProductEntry findByGroupId_First(long groupId,
805 OrderByComparator orderByComparator)
806 throws NoSuchProductEntryException, SystemException {
807 SCProductEntry scProductEntry = fetchByGroupId_First(groupId,
808 orderByComparator);
809
810 if (scProductEntry != null) {
811 return scProductEntry;
812 }
813
814 StringBundler msg = new StringBundler(4);
815
816 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
817
818 msg.append("groupId=");
819 msg.append(groupId);
820
821 msg.append(StringPool.CLOSE_CURLY_BRACE);
822
823 throw new NoSuchProductEntryException(msg.toString());
824 }
825
826
834 public SCProductEntry fetchByGroupId_First(long groupId,
835 OrderByComparator orderByComparator) throws SystemException {
836 List<SCProductEntry> list = findByGroupId(groupId, 0, 1,
837 orderByComparator);
838
839 if (!list.isEmpty()) {
840 return list.get(0);
841 }
842
843 return null;
844 }
845
846
855 public SCProductEntry findByGroupId_Last(long groupId,
856 OrderByComparator orderByComparator)
857 throws NoSuchProductEntryException, SystemException {
858 SCProductEntry scProductEntry = fetchByGroupId_Last(groupId,
859 orderByComparator);
860
861 if (scProductEntry != null) {
862 return scProductEntry;
863 }
864
865 StringBundler msg = new StringBundler(4);
866
867 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
868
869 msg.append("groupId=");
870 msg.append(groupId);
871
872 msg.append(StringPool.CLOSE_CURLY_BRACE);
873
874 throw new NoSuchProductEntryException(msg.toString());
875 }
876
877
885 public SCProductEntry fetchByGroupId_Last(long groupId,
886 OrderByComparator orderByComparator) throws SystemException {
887 int count = countByGroupId(groupId);
888
889 List<SCProductEntry> list = findByGroupId(groupId, count - 1, count,
890 orderByComparator);
891
892 if (!list.isEmpty()) {
893 return list.get(0);
894 }
895
896 return null;
897 }
898
899
909 public SCProductEntry[] findByGroupId_PrevAndNext(long productEntryId,
910 long groupId, OrderByComparator orderByComparator)
911 throws NoSuchProductEntryException, SystemException {
912 SCProductEntry scProductEntry = findByPrimaryKey(productEntryId);
913
914 Session session = null;
915
916 try {
917 session = openSession();
918
919 SCProductEntry[] array = new SCProductEntryImpl[3];
920
921 array[0] = getByGroupId_PrevAndNext(session, scProductEntry,
922 groupId, orderByComparator, true);
923
924 array[1] = scProductEntry;
925
926 array[2] = getByGroupId_PrevAndNext(session, scProductEntry,
927 groupId, orderByComparator, false);
928
929 return array;
930 }
931 catch (Exception e) {
932 throw processException(e);
933 }
934 finally {
935 closeSession(session);
936 }
937 }
938
939 protected SCProductEntry getByGroupId_PrevAndNext(Session session,
940 SCProductEntry scProductEntry, long groupId,
941 OrderByComparator orderByComparator, boolean previous) {
942 StringBundler query = null;
943
944 if (orderByComparator != null) {
945 query = new StringBundler(6 +
946 (orderByComparator.getOrderByFields().length * 6));
947 }
948 else {
949 query = new StringBundler(3);
950 }
951
952 query.append(_SQL_SELECT_SCPRODUCTENTRY_WHERE);
953
954 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
955
956 if (orderByComparator != null) {
957 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
958
959 if (orderByConditionFields.length > 0) {
960 query.append(WHERE_AND);
961 }
962
963 for (int i = 0; i < orderByConditionFields.length; i++) {
964 query.append(_ORDER_BY_ENTITY_ALIAS);
965 query.append(orderByConditionFields[i]);
966
967 if ((i + 1) < orderByConditionFields.length) {
968 if (orderByComparator.isAscending() ^ previous) {
969 query.append(WHERE_GREATER_THAN_HAS_NEXT);
970 }
971 else {
972 query.append(WHERE_LESSER_THAN_HAS_NEXT);
973 }
974 }
975 else {
976 if (orderByComparator.isAscending() ^ previous) {
977 query.append(WHERE_GREATER_THAN);
978 }
979 else {
980 query.append(WHERE_LESSER_THAN);
981 }
982 }
983 }
984
985 query.append(ORDER_BY_CLAUSE);
986
987 String[] orderByFields = orderByComparator.getOrderByFields();
988
989 for (int i = 0; i < orderByFields.length; i++) {
990 query.append(_ORDER_BY_ENTITY_ALIAS);
991 query.append(orderByFields[i]);
992
993 if ((i + 1) < orderByFields.length) {
994 if (orderByComparator.isAscending() ^ previous) {
995 query.append(ORDER_BY_ASC_HAS_NEXT);
996 }
997 else {
998 query.append(ORDER_BY_DESC_HAS_NEXT);
999 }
1000 }
1001 else {
1002 if (orderByComparator.isAscending() ^ previous) {
1003 query.append(ORDER_BY_ASC);
1004 }
1005 else {
1006 query.append(ORDER_BY_DESC);
1007 }
1008 }
1009 }
1010 }
1011
1012 else {
1013 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
1014 }
1015
1016 String sql = query.toString();
1017
1018 Query q = session.createQuery(sql);
1019
1020 q.setFirstResult(0);
1021 q.setMaxResults(2);
1022
1023 QueryPos qPos = QueryPos.getInstance(q);
1024
1025 qPos.add(groupId);
1026
1027 if (orderByComparator != null) {
1028 Object[] values = orderByComparator.getOrderByConditionValues(scProductEntry);
1029
1030 for (Object value : values) {
1031 qPos.add(value);
1032 }
1033 }
1034
1035 List<SCProductEntry> list = q.list();
1036
1037 if (list.size() == 2) {
1038 return list.get(1);
1039 }
1040 else {
1041 return null;
1042 }
1043 }
1044
1045
1052 public List<SCProductEntry> filterFindByGroupId(long groupId)
1053 throws SystemException {
1054 return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
1055 QueryUtil.ALL_POS, null);
1056 }
1057
1058
1071 public List<SCProductEntry> filterFindByGroupId(long groupId, int start,
1072 int end) throws SystemException {
1073 return filterFindByGroupId(groupId, start, end, null);
1074 }
1075
1076
1090 public List<SCProductEntry> filterFindByGroupId(long groupId, int start,
1091 int end, OrderByComparator orderByComparator) throws SystemException {
1092 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1093 return findByGroupId(groupId, start, end, orderByComparator);
1094 }
1095
1096 StringBundler query = null;
1097
1098 if (orderByComparator != null) {
1099 query = new StringBundler(3 +
1100 (orderByComparator.getOrderByFields().length * 3));
1101 }
1102 else {
1103 query = new StringBundler(3);
1104 }
1105
1106 if (getDB().isSupportsInlineDistinct()) {
1107 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_WHERE);
1108 }
1109 else {
1110 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_1);
1111 }
1112
1113 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1114
1115 if (!getDB().isSupportsInlineDistinct()) {
1116 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_2);
1117 }
1118
1119 if (orderByComparator != null) {
1120 if (getDB().isSupportsInlineDistinct()) {
1121 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1122 orderByComparator);
1123 }
1124 else {
1125 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1126 orderByComparator);
1127 }
1128 }
1129
1130 else {
1131 if (getDB().isSupportsInlineDistinct()) {
1132 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
1133 }
1134 else {
1135 query.append(SCProductEntryModelImpl.ORDER_BY_SQL);
1136 }
1137 }
1138
1139 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1140 SCProductEntry.class.getName(),
1141 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
1142
1143 Session session = null;
1144
1145 try {
1146 session = openSession();
1147
1148 SQLQuery q = session.createSQLQuery(sql);
1149
1150 if (getDB().isSupportsInlineDistinct()) {
1151 q.addEntity(_FILTER_ENTITY_ALIAS, SCProductEntryImpl.class);
1152 }
1153 else {
1154 q.addEntity(_FILTER_ENTITY_TABLE, SCProductEntryImpl.class);
1155 }
1156
1157 QueryPos qPos = QueryPos.getInstance(q);
1158
1159 qPos.add(groupId);
1160
1161 return (List<SCProductEntry>)QueryUtil.list(q, getDialect(), start,
1162 end);
1163 }
1164 catch (Exception e) {
1165 throw processException(e);
1166 }
1167 finally {
1168 closeSession(session);
1169 }
1170 }
1171
1172
1182 public SCProductEntry[] filterFindByGroupId_PrevAndNext(
1183 long productEntryId, long groupId, OrderByComparator orderByComparator)
1184 throws NoSuchProductEntryException, SystemException {
1185 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1186 return findByGroupId_PrevAndNext(productEntryId, groupId,
1187 orderByComparator);
1188 }
1189
1190 SCProductEntry scProductEntry = findByPrimaryKey(productEntryId);
1191
1192 Session session = null;
1193
1194 try {
1195 session = openSession();
1196
1197 SCProductEntry[] array = new SCProductEntryImpl[3];
1198
1199 array[0] = filterGetByGroupId_PrevAndNext(session, scProductEntry,
1200 groupId, orderByComparator, true);
1201
1202 array[1] = scProductEntry;
1203
1204 array[2] = filterGetByGroupId_PrevAndNext(session, scProductEntry,
1205 groupId, orderByComparator, false);
1206
1207 return array;
1208 }
1209 catch (Exception e) {
1210 throw processException(e);
1211 }
1212 finally {
1213 closeSession(session);
1214 }
1215 }
1216
1217 protected SCProductEntry filterGetByGroupId_PrevAndNext(Session session,
1218 SCProductEntry scProductEntry, long groupId,
1219 OrderByComparator orderByComparator, boolean previous) {
1220 StringBundler query = null;
1221
1222 if (orderByComparator != null) {
1223 query = new StringBundler(6 +
1224 (orderByComparator.getOrderByFields().length * 6));
1225 }
1226 else {
1227 query = new StringBundler(3);
1228 }
1229
1230 if (getDB().isSupportsInlineDistinct()) {
1231 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_WHERE);
1232 }
1233 else {
1234 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_1);
1235 }
1236
1237 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1238
1239 if (!getDB().isSupportsInlineDistinct()) {
1240 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_2);
1241 }
1242
1243 if (orderByComparator != null) {
1244 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1245
1246 if (orderByConditionFields.length > 0) {
1247 query.append(WHERE_AND);
1248 }
1249
1250 for (int i = 0; i < orderByConditionFields.length; i++) {
1251 if (getDB().isSupportsInlineDistinct()) {
1252 query.append(_ORDER_BY_ENTITY_ALIAS);
1253 }
1254 else {
1255 query.append(_ORDER_BY_ENTITY_TABLE);
1256 }
1257
1258 query.append(orderByConditionFields[i]);
1259
1260 if ((i + 1) < orderByConditionFields.length) {
1261 if (orderByComparator.isAscending() ^ previous) {
1262 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1263 }
1264 else {
1265 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1266 }
1267 }
1268 else {
1269 if (orderByComparator.isAscending() ^ previous) {
1270 query.append(WHERE_GREATER_THAN);
1271 }
1272 else {
1273 query.append(WHERE_LESSER_THAN);
1274 }
1275 }
1276 }
1277
1278 query.append(ORDER_BY_CLAUSE);
1279
1280 String[] orderByFields = orderByComparator.getOrderByFields();
1281
1282 for (int i = 0; i < orderByFields.length; i++) {
1283 if (getDB().isSupportsInlineDistinct()) {
1284 query.append(_ORDER_BY_ENTITY_ALIAS);
1285 }
1286 else {
1287 query.append(_ORDER_BY_ENTITY_TABLE);
1288 }
1289
1290 query.append(orderByFields[i]);
1291
1292 if ((i + 1) < orderByFields.length) {
1293 if (orderByComparator.isAscending() ^ previous) {
1294 query.append(ORDER_BY_ASC_HAS_NEXT);
1295 }
1296 else {
1297 query.append(ORDER_BY_DESC_HAS_NEXT);
1298 }
1299 }
1300 else {
1301 if (orderByComparator.isAscending() ^ previous) {
1302 query.append(ORDER_BY_ASC);
1303 }
1304 else {
1305 query.append(ORDER_BY_DESC);
1306 }
1307 }
1308 }
1309 }
1310
1311 else {
1312 if (getDB().isSupportsInlineDistinct()) {
1313 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
1314 }
1315 else {
1316 query.append(SCProductEntryModelImpl.ORDER_BY_SQL);
1317 }
1318 }
1319
1320 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1321 SCProductEntry.class.getName(),
1322 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
1323
1324 SQLQuery q = session.createSQLQuery(sql);
1325
1326 q.setFirstResult(0);
1327 q.setMaxResults(2);
1328
1329 if (getDB().isSupportsInlineDistinct()) {
1330 q.addEntity(_FILTER_ENTITY_ALIAS, SCProductEntryImpl.class);
1331 }
1332 else {
1333 q.addEntity(_FILTER_ENTITY_TABLE, SCProductEntryImpl.class);
1334 }
1335
1336 QueryPos qPos = QueryPos.getInstance(q);
1337
1338 qPos.add(groupId);
1339
1340 if (orderByComparator != null) {
1341 Object[] values = orderByComparator.getOrderByConditionValues(scProductEntry);
1342
1343 for (Object value : values) {
1344 qPos.add(value);
1345 }
1346 }
1347
1348 List<SCProductEntry> list = q.list();
1349
1350 if (list.size() == 2) {
1351 return list.get(1);
1352 }
1353 else {
1354 return null;
1355 }
1356 }
1357
1358
1365 public List<SCProductEntry> findByCompanyId(long companyId)
1366 throws SystemException {
1367 return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1368 null);
1369 }
1370
1371
1384 public List<SCProductEntry> findByCompanyId(long companyId, int start,
1385 int end) throws SystemException {
1386 return findByCompanyId(companyId, start, end, null);
1387 }
1388
1389
1403 public List<SCProductEntry> findByCompanyId(long companyId, int start,
1404 int end, OrderByComparator orderByComparator) throws SystemException {
1405 FinderPath finderPath = null;
1406 Object[] finderArgs = null;
1407
1408 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1409 (orderByComparator == null)) {
1410 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID;
1411 finderArgs = new Object[] { companyId };
1412 }
1413 else {
1414 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID;
1415 finderArgs = new Object[] { companyId, start, end, orderByComparator };
1416 }
1417
1418 List<SCProductEntry> list = (List<SCProductEntry>)FinderCacheUtil.getResult(finderPath,
1419 finderArgs, this);
1420
1421 if ((list != null) && !list.isEmpty()) {
1422 for (SCProductEntry scProductEntry : list) {
1423 if ((companyId != scProductEntry.getCompanyId())) {
1424 list = null;
1425
1426 break;
1427 }
1428 }
1429 }
1430
1431 if (list == null) {
1432 StringBundler query = null;
1433
1434 if (orderByComparator != null) {
1435 query = new StringBundler(3 +
1436 (orderByComparator.getOrderByFields().length * 3));
1437 }
1438 else {
1439 query = new StringBundler(3);
1440 }
1441
1442 query.append(_SQL_SELECT_SCPRODUCTENTRY_WHERE);
1443
1444 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1445
1446 if (orderByComparator != null) {
1447 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1448 orderByComparator);
1449 }
1450
1451 else {
1452 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
1453 }
1454
1455 String sql = query.toString();
1456
1457 Session session = null;
1458
1459 try {
1460 session = openSession();
1461
1462 Query q = session.createQuery(sql);
1463
1464 QueryPos qPos = QueryPos.getInstance(q);
1465
1466 qPos.add(companyId);
1467
1468 list = (List<SCProductEntry>)QueryUtil.list(q, getDialect(),
1469 start, end);
1470 }
1471 catch (Exception e) {
1472 throw processException(e);
1473 }
1474 finally {
1475 if (list == null) {
1476 FinderCacheUtil.removeResult(finderPath, finderArgs);
1477 }
1478 else {
1479 cacheResult(list);
1480
1481 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1482 }
1483
1484 closeSession(session);
1485 }
1486 }
1487
1488 return list;
1489 }
1490
1491
1500 public SCProductEntry findByCompanyId_First(long companyId,
1501 OrderByComparator orderByComparator)
1502 throws NoSuchProductEntryException, SystemException {
1503 SCProductEntry scProductEntry = fetchByCompanyId_First(companyId,
1504 orderByComparator);
1505
1506 if (scProductEntry != null) {
1507 return scProductEntry;
1508 }
1509
1510 StringBundler msg = new StringBundler(4);
1511
1512 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1513
1514 msg.append("companyId=");
1515 msg.append(companyId);
1516
1517 msg.append(StringPool.CLOSE_CURLY_BRACE);
1518
1519 throw new NoSuchProductEntryException(msg.toString());
1520 }
1521
1522
1530 public SCProductEntry fetchByCompanyId_First(long companyId,
1531 OrderByComparator orderByComparator) throws SystemException {
1532 List<SCProductEntry> list = findByCompanyId(companyId, 0, 1,
1533 orderByComparator);
1534
1535 if (!list.isEmpty()) {
1536 return list.get(0);
1537 }
1538
1539 return null;
1540 }
1541
1542
1551 public SCProductEntry findByCompanyId_Last(long companyId,
1552 OrderByComparator orderByComparator)
1553 throws NoSuchProductEntryException, SystemException {
1554 SCProductEntry scProductEntry = fetchByCompanyId_Last(companyId,
1555 orderByComparator);
1556
1557 if (scProductEntry != null) {
1558 return scProductEntry;
1559 }
1560
1561 StringBundler msg = new StringBundler(4);
1562
1563 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1564
1565 msg.append("companyId=");
1566 msg.append(companyId);
1567
1568 msg.append(StringPool.CLOSE_CURLY_BRACE);
1569
1570 throw new NoSuchProductEntryException(msg.toString());
1571 }
1572
1573
1581 public SCProductEntry fetchByCompanyId_Last(long companyId,
1582 OrderByComparator orderByComparator) throws SystemException {
1583 int count = countByCompanyId(companyId);
1584
1585 List<SCProductEntry> list = findByCompanyId(companyId, count - 1,
1586 count, orderByComparator);
1587
1588 if (!list.isEmpty()) {
1589 return list.get(0);
1590 }
1591
1592 return null;
1593 }
1594
1595
1605 public SCProductEntry[] findByCompanyId_PrevAndNext(long productEntryId,
1606 long companyId, OrderByComparator orderByComparator)
1607 throws NoSuchProductEntryException, SystemException {
1608 SCProductEntry scProductEntry = findByPrimaryKey(productEntryId);
1609
1610 Session session = null;
1611
1612 try {
1613 session = openSession();
1614
1615 SCProductEntry[] array = new SCProductEntryImpl[3];
1616
1617 array[0] = getByCompanyId_PrevAndNext(session, scProductEntry,
1618 companyId, orderByComparator, true);
1619
1620 array[1] = scProductEntry;
1621
1622 array[2] = getByCompanyId_PrevAndNext(session, scProductEntry,
1623 companyId, orderByComparator, false);
1624
1625 return array;
1626 }
1627 catch (Exception e) {
1628 throw processException(e);
1629 }
1630 finally {
1631 closeSession(session);
1632 }
1633 }
1634
1635 protected SCProductEntry getByCompanyId_PrevAndNext(Session session,
1636 SCProductEntry scProductEntry, long companyId,
1637 OrderByComparator orderByComparator, boolean previous) {
1638 StringBundler query = null;
1639
1640 if (orderByComparator != null) {
1641 query = new StringBundler(6 +
1642 (orderByComparator.getOrderByFields().length * 6));
1643 }
1644 else {
1645 query = new StringBundler(3);
1646 }
1647
1648 query.append(_SQL_SELECT_SCPRODUCTENTRY_WHERE);
1649
1650 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1651
1652 if (orderByComparator != null) {
1653 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1654
1655 if (orderByConditionFields.length > 0) {
1656 query.append(WHERE_AND);
1657 }
1658
1659 for (int i = 0; i < orderByConditionFields.length; i++) {
1660 query.append(_ORDER_BY_ENTITY_ALIAS);
1661 query.append(orderByConditionFields[i]);
1662
1663 if ((i + 1) < orderByConditionFields.length) {
1664 if (orderByComparator.isAscending() ^ previous) {
1665 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1666 }
1667 else {
1668 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1669 }
1670 }
1671 else {
1672 if (orderByComparator.isAscending() ^ previous) {
1673 query.append(WHERE_GREATER_THAN);
1674 }
1675 else {
1676 query.append(WHERE_LESSER_THAN);
1677 }
1678 }
1679 }
1680
1681 query.append(ORDER_BY_CLAUSE);
1682
1683 String[] orderByFields = orderByComparator.getOrderByFields();
1684
1685 for (int i = 0; i < orderByFields.length; i++) {
1686 query.append(_ORDER_BY_ENTITY_ALIAS);
1687 query.append(orderByFields[i]);
1688
1689 if ((i + 1) < orderByFields.length) {
1690 if (orderByComparator.isAscending() ^ previous) {
1691 query.append(ORDER_BY_ASC_HAS_NEXT);
1692 }
1693 else {
1694 query.append(ORDER_BY_DESC_HAS_NEXT);
1695 }
1696 }
1697 else {
1698 if (orderByComparator.isAscending() ^ previous) {
1699 query.append(ORDER_BY_ASC);
1700 }
1701 else {
1702 query.append(ORDER_BY_DESC);
1703 }
1704 }
1705 }
1706 }
1707
1708 else {
1709 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
1710 }
1711
1712 String sql = query.toString();
1713
1714 Query q = session.createQuery(sql);
1715
1716 q.setFirstResult(0);
1717 q.setMaxResults(2);
1718
1719 QueryPos qPos = QueryPos.getInstance(q);
1720
1721 qPos.add(companyId);
1722
1723 if (orderByComparator != null) {
1724 Object[] values = orderByComparator.getOrderByConditionValues(scProductEntry);
1725
1726 for (Object value : values) {
1727 qPos.add(value);
1728 }
1729 }
1730
1731 List<SCProductEntry> list = q.list();
1732
1733 if (list.size() == 2) {
1734 return list.get(1);
1735 }
1736 else {
1737 return null;
1738 }
1739 }
1740
1741
1749 public List<SCProductEntry> findByG_U(long groupId, long userId)
1750 throws SystemException {
1751 return findByG_U(groupId, userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1752 null);
1753 }
1754
1755
1769 public List<SCProductEntry> findByG_U(long groupId, long userId, int start,
1770 int end) throws SystemException {
1771 return findByG_U(groupId, userId, start, end, null);
1772 }
1773
1774
1789 public List<SCProductEntry> findByG_U(long groupId, long userId, int start,
1790 int end, OrderByComparator orderByComparator) throws SystemException {
1791 FinderPath finderPath = null;
1792 Object[] finderArgs = null;
1793
1794 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1795 (orderByComparator == null)) {
1796 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U;
1797 finderArgs = new Object[] { groupId, userId };
1798 }
1799 else {
1800 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_U;
1801 finderArgs = new Object[] {
1802 groupId, userId,
1803
1804 start, end, orderByComparator
1805 };
1806 }
1807
1808 List<SCProductEntry> list = (List<SCProductEntry>)FinderCacheUtil.getResult(finderPath,
1809 finderArgs, this);
1810
1811 if ((list != null) && !list.isEmpty()) {
1812 for (SCProductEntry scProductEntry : list) {
1813 if ((groupId != scProductEntry.getGroupId()) ||
1814 (userId != scProductEntry.getUserId())) {
1815 list = null;
1816
1817 break;
1818 }
1819 }
1820 }
1821
1822 if (list == null) {
1823 StringBundler query = null;
1824
1825 if (orderByComparator != null) {
1826 query = new StringBundler(4 +
1827 (orderByComparator.getOrderByFields().length * 3));
1828 }
1829 else {
1830 query = new StringBundler(4);
1831 }
1832
1833 query.append(_SQL_SELECT_SCPRODUCTENTRY_WHERE);
1834
1835 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
1836
1837 query.append(_FINDER_COLUMN_G_U_USERID_2);
1838
1839 if (orderByComparator != null) {
1840 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1841 orderByComparator);
1842 }
1843
1844 else {
1845 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
1846 }
1847
1848 String sql = query.toString();
1849
1850 Session session = null;
1851
1852 try {
1853 session = openSession();
1854
1855 Query q = session.createQuery(sql);
1856
1857 QueryPos qPos = QueryPos.getInstance(q);
1858
1859 qPos.add(groupId);
1860
1861 qPos.add(userId);
1862
1863 list = (List<SCProductEntry>)QueryUtil.list(q, getDialect(),
1864 start, end);
1865 }
1866 catch (Exception e) {
1867 throw processException(e);
1868 }
1869 finally {
1870 if (list == null) {
1871 FinderCacheUtil.removeResult(finderPath, finderArgs);
1872 }
1873 else {
1874 cacheResult(list);
1875
1876 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1877 }
1878
1879 closeSession(session);
1880 }
1881 }
1882
1883 return list;
1884 }
1885
1886
1896 public SCProductEntry findByG_U_First(long groupId, long userId,
1897 OrderByComparator orderByComparator)
1898 throws NoSuchProductEntryException, SystemException {
1899 SCProductEntry scProductEntry = fetchByG_U_First(groupId, userId,
1900 orderByComparator);
1901
1902 if (scProductEntry != null) {
1903 return scProductEntry;
1904 }
1905
1906 StringBundler msg = new StringBundler(6);
1907
1908 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1909
1910 msg.append("groupId=");
1911 msg.append(groupId);
1912
1913 msg.append(", userId=");
1914 msg.append(userId);
1915
1916 msg.append(StringPool.CLOSE_CURLY_BRACE);
1917
1918 throw new NoSuchProductEntryException(msg.toString());
1919 }
1920
1921
1930 public SCProductEntry fetchByG_U_First(long groupId, long userId,
1931 OrderByComparator orderByComparator) throws SystemException {
1932 List<SCProductEntry> list = findByG_U(groupId, userId, 0, 1,
1933 orderByComparator);
1934
1935 if (!list.isEmpty()) {
1936 return list.get(0);
1937 }
1938
1939 return null;
1940 }
1941
1942
1952 public SCProductEntry findByG_U_Last(long groupId, long userId,
1953 OrderByComparator orderByComparator)
1954 throws NoSuchProductEntryException, SystemException {
1955 SCProductEntry scProductEntry = fetchByG_U_Last(groupId, userId,
1956 orderByComparator);
1957
1958 if (scProductEntry != null) {
1959 return scProductEntry;
1960 }
1961
1962 StringBundler msg = new StringBundler(6);
1963
1964 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1965
1966 msg.append("groupId=");
1967 msg.append(groupId);
1968
1969 msg.append(", userId=");
1970 msg.append(userId);
1971
1972 msg.append(StringPool.CLOSE_CURLY_BRACE);
1973
1974 throw new NoSuchProductEntryException(msg.toString());
1975 }
1976
1977
1986 public SCProductEntry fetchByG_U_Last(long groupId, long userId,
1987 OrderByComparator orderByComparator) throws SystemException {
1988 int count = countByG_U(groupId, userId);
1989
1990 List<SCProductEntry> list = findByG_U(groupId, userId, count - 1,
1991 count, orderByComparator);
1992
1993 if (!list.isEmpty()) {
1994 return list.get(0);
1995 }
1996
1997 return null;
1998 }
1999
2000
2011 public SCProductEntry[] findByG_U_PrevAndNext(long productEntryId,
2012 long groupId, long userId, OrderByComparator orderByComparator)
2013 throws NoSuchProductEntryException, SystemException {
2014 SCProductEntry scProductEntry = findByPrimaryKey(productEntryId);
2015
2016 Session session = null;
2017
2018 try {
2019 session = openSession();
2020
2021 SCProductEntry[] array = new SCProductEntryImpl[3];
2022
2023 array[0] = getByG_U_PrevAndNext(session, scProductEntry, groupId,
2024 userId, orderByComparator, true);
2025
2026 array[1] = scProductEntry;
2027
2028 array[2] = getByG_U_PrevAndNext(session, scProductEntry, groupId,
2029 userId, orderByComparator, false);
2030
2031 return array;
2032 }
2033 catch (Exception e) {
2034 throw processException(e);
2035 }
2036 finally {
2037 closeSession(session);
2038 }
2039 }
2040
2041 protected SCProductEntry getByG_U_PrevAndNext(Session session,
2042 SCProductEntry scProductEntry, long groupId, long userId,
2043 OrderByComparator orderByComparator, boolean previous) {
2044 StringBundler query = null;
2045
2046 if (orderByComparator != null) {
2047 query = new StringBundler(6 +
2048 (orderByComparator.getOrderByFields().length * 6));
2049 }
2050 else {
2051 query = new StringBundler(3);
2052 }
2053
2054 query.append(_SQL_SELECT_SCPRODUCTENTRY_WHERE);
2055
2056 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
2057
2058 query.append(_FINDER_COLUMN_G_U_USERID_2);
2059
2060 if (orderByComparator != null) {
2061 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2062
2063 if (orderByConditionFields.length > 0) {
2064 query.append(WHERE_AND);
2065 }
2066
2067 for (int i = 0; i < orderByConditionFields.length; i++) {
2068 query.append(_ORDER_BY_ENTITY_ALIAS);
2069 query.append(orderByConditionFields[i]);
2070
2071 if ((i + 1) < orderByConditionFields.length) {
2072 if (orderByComparator.isAscending() ^ previous) {
2073 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2074 }
2075 else {
2076 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2077 }
2078 }
2079 else {
2080 if (orderByComparator.isAscending() ^ previous) {
2081 query.append(WHERE_GREATER_THAN);
2082 }
2083 else {
2084 query.append(WHERE_LESSER_THAN);
2085 }
2086 }
2087 }
2088
2089 query.append(ORDER_BY_CLAUSE);
2090
2091 String[] orderByFields = orderByComparator.getOrderByFields();
2092
2093 for (int i = 0; i < orderByFields.length; i++) {
2094 query.append(_ORDER_BY_ENTITY_ALIAS);
2095 query.append(orderByFields[i]);
2096
2097 if ((i + 1) < orderByFields.length) {
2098 if (orderByComparator.isAscending() ^ previous) {
2099 query.append(ORDER_BY_ASC_HAS_NEXT);
2100 }
2101 else {
2102 query.append(ORDER_BY_DESC_HAS_NEXT);
2103 }
2104 }
2105 else {
2106 if (orderByComparator.isAscending() ^ previous) {
2107 query.append(ORDER_BY_ASC);
2108 }
2109 else {
2110 query.append(ORDER_BY_DESC);
2111 }
2112 }
2113 }
2114 }
2115
2116 else {
2117 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
2118 }
2119
2120 String sql = query.toString();
2121
2122 Query q = session.createQuery(sql);
2123
2124 q.setFirstResult(0);
2125 q.setMaxResults(2);
2126
2127 QueryPos qPos = QueryPos.getInstance(q);
2128
2129 qPos.add(groupId);
2130
2131 qPos.add(userId);
2132
2133 if (orderByComparator != null) {
2134 Object[] values = orderByComparator.getOrderByConditionValues(scProductEntry);
2135
2136 for (Object value : values) {
2137 qPos.add(value);
2138 }
2139 }
2140
2141 List<SCProductEntry> list = q.list();
2142
2143 if (list.size() == 2) {
2144 return list.get(1);
2145 }
2146 else {
2147 return null;
2148 }
2149 }
2150
2151
2159 public List<SCProductEntry> filterFindByG_U(long groupId, long userId)
2160 throws SystemException {
2161 return filterFindByG_U(groupId, userId, QueryUtil.ALL_POS,
2162 QueryUtil.ALL_POS, null);
2163 }
2164
2165
2179 public List<SCProductEntry> filterFindByG_U(long groupId, long userId,
2180 int start, int end) throws SystemException {
2181 return filterFindByG_U(groupId, userId, start, end, null);
2182 }
2183
2184
2199 public List<SCProductEntry> filterFindByG_U(long groupId, long userId,
2200 int start, int end, OrderByComparator orderByComparator)
2201 throws SystemException {
2202 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2203 return findByG_U(groupId, userId, start, end, orderByComparator);
2204 }
2205
2206 StringBundler query = null;
2207
2208 if (orderByComparator != null) {
2209 query = new StringBundler(4 +
2210 (orderByComparator.getOrderByFields().length * 3));
2211 }
2212 else {
2213 query = new StringBundler(4);
2214 }
2215
2216 if (getDB().isSupportsInlineDistinct()) {
2217 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_WHERE);
2218 }
2219 else {
2220 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_1);
2221 }
2222
2223 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
2224
2225 query.append(_FINDER_COLUMN_G_U_USERID_2);
2226
2227 if (!getDB().isSupportsInlineDistinct()) {
2228 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_2);
2229 }
2230
2231 if (orderByComparator != null) {
2232 if (getDB().isSupportsInlineDistinct()) {
2233 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2234 orderByComparator);
2235 }
2236 else {
2237 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
2238 orderByComparator);
2239 }
2240 }
2241
2242 else {
2243 if (getDB().isSupportsInlineDistinct()) {
2244 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
2245 }
2246 else {
2247 query.append(SCProductEntryModelImpl.ORDER_BY_SQL);
2248 }
2249 }
2250
2251 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2252 SCProductEntry.class.getName(),
2253 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
2254
2255 Session session = null;
2256
2257 try {
2258 session = openSession();
2259
2260 SQLQuery q = session.createSQLQuery(sql);
2261
2262 if (getDB().isSupportsInlineDistinct()) {
2263 q.addEntity(_FILTER_ENTITY_ALIAS, SCProductEntryImpl.class);
2264 }
2265 else {
2266 q.addEntity(_FILTER_ENTITY_TABLE, SCProductEntryImpl.class);
2267 }
2268
2269 QueryPos qPos = QueryPos.getInstance(q);
2270
2271 qPos.add(groupId);
2272
2273 qPos.add(userId);
2274
2275 return (List<SCProductEntry>)QueryUtil.list(q, getDialect(), start,
2276 end);
2277 }
2278 catch (Exception e) {
2279 throw processException(e);
2280 }
2281 finally {
2282 closeSession(session);
2283 }
2284 }
2285
2286
2297 public SCProductEntry[] filterFindByG_U_PrevAndNext(long productEntryId,
2298 long groupId, long userId, OrderByComparator orderByComparator)
2299 throws NoSuchProductEntryException, SystemException {
2300 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2301 return findByG_U_PrevAndNext(productEntryId, groupId, userId,
2302 orderByComparator);
2303 }
2304
2305 SCProductEntry scProductEntry = findByPrimaryKey(productEntryId);
2306
2307 Session session = null;
2308
2309 try {
2310 session = openSession();
2311
2312 SCProductEntry[] array = new SCProductEntryImpl[3];
2313
2314 array[0] = filterGetByG_U_PrevAndNext(session, scProductEntry,
2315 groupId, userId, orderByComparator, true);
2316
2317 array[1] = scProductEntry;
2318
2319 array[2] = filterGetByG_U_PrevAndNext(session, scProductEntry,
2320 groupId, userId, orderByComparator, false);
2321
2322 return array;
2323 }
2324 catch (Exception e) {
2325 throw processException(e);
2326 }
2327 finally {
2328 closeSession(session);
2329 }
2330 }
2331
2332 protected SCProductEntry filterGetByG_U_PrevAndNext(Session session,
2333 SCProductEntry scProductEntry, long groupId, long userId,
2334 OrderByComparator orderByComparator, boolean previous) {
2335 StringBundler query = null;
2336
2337 if (orderByComparator != null) {
2338 query = new StringBundler(6 +
2339 (orderByComparator.getOrderByFields().length * 6));
2340 }
2341 else {
2342 query = new StringBundler(3);
2343 }
2344
2345 if (getDB().isSupportsInlineDistinct()) {
2346 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_WHERE);
2347 }
2348 else {
2349 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_1);
2350 }
2351
2352 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
2353
2354 query.append(_FINDER_COLUMN_G_U_USERID_2);
2355
2356 if (!getDB().isSupportsInlineDistinct()) {
2357 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_2);
2358 }
2359
2360 if (orderByComparator != null) {
2361 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2362
2363 if (orderByConditionFields.length > 0) {
2364 query.append(WHERE_AND);
2365 }
2366
2367 for (int i = 0; i < orderByConditionFields.length; i++) {
2368 if (getDB().isSupportsInlineDistinct()) {
2369 query.append(_ORDER_BY_ENTITY_ALIAS);
2370 }
2371 else {
2372 query.append(_ORDER_BY_ENTITY_TABLE);
2373 }
2374
2375 query.append(orderByConditionFields[i]);
2376
2377 if ((i + 1) < orderByConditionFields.length) {
2378 if (orderByComparator.isAscending() ^ previous) {
2379 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2380 }
2381 else {
2382 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2383 }
2384 }
2385 else {
2386 if (orderByComparator.isAscending() ^ previous) {
2387 query.append(WHERE_GREATER_THAN);
2388 }
2389 else {
2390 query.append(WHERE_LESSER_THAN);
2391 }
2392 }
2393 }
2394
2395 query.append(ORDER_BY_CLAUSE);
2396
2397 String[] orderByFields = orderByComparator.getOrderByFields();
2398
2399 for (int i = 0; i < orderByFields.length; i++) {
2400 if (getDB().isSupportsInlineDistinct()) {
2401 query.append(_ORDER_BY_ENTITY_ALIAS);
2402 }
2403 else {
2404 query.append(_ORDER_BY_ENTITY_TABLE);
2405 }
2406
2407 query.append(orderByFields[i]);
2408
2409 if ((i + 1) < orderByFields.length) {
2410 if (orderByComparator.isAscending() ^ previous) {
2411 query.append(ORDER_BY_ASC_HAS_NEXT);
2412 }
2413 else {
2414 query.append(ORDER_BY_DESC_HAS_NEXT);
2415 }
2416 }
2417 else {
2418 if (orderByComparator.isAscending() ^ previous) {
2419 query.append(ORDER_BY_ASC);
2420 }
2421 else {
2422 query.append(ORDER_BY_DESC);
2423 }
2424 }
2425 }
2426 }
2427
2428 else {
2429 if (getDB().isSupportsInlineDistinct()) {
2430 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
2431 }
2432 else {
2433 query.append(SCProductEntryModelImpl.ORDER_BY_SQL);
2434 }
2435 }
2436
2437 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2438 SCProductEntry.class.getName(),
2439 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
2440
2441 SQLQuery q = session.createSQLQuery(sql);
2442
2443 q.setFirstResult(0);
2444 q.setMaxResults(2);
2445
2446 if (getDB().isSupportsInlineDistinct()) {
2447 q.addEntity(_FILTER_ENTITY_ALIAS, SCProductEntryImpl.class);
2448 }
2449 else {
2450 q.addEntity(_FILTER_ENTITY_TABLE, SCProductEntryImpl.class);
2451 }
2452
2453 QueryPos qPos = QueryPos.getInstance(q);
2454
2455 qPos.add(groupId);
2456
2457 qPos.add(userId);
2458
2459 if (orderByComparator != null) {
2460 Object[] values = orderByComparator.getOrderByConditionValues(scProductEntry);
2461
2462 for (Object value : values) {
2463 qPos.add(value);
2464 }
2465 }
2466
2467 List<SCProductEntry> list = q.list();
2468
2469 if (list.size() == 2) {
2470 return list.get(1);
2471 }
2472 else {
2473 return null;
2474 }
2475 }
2476
2477
2486 public SCProductEntry findByRG_RA(String repoGroupId, String repoArtifactId)
2487 throws NoSuchProductEntryException, SystemException {
2488 SCProductEntry scProductEntry = fetchByRG_RA(repoGroupId, repoArtifactId);
2489
2490 if (scProductEntry == null) {
2491 StringBundler msg = new StringBundler(6);
2492
2493 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2494
2495 msg.append("repoGroupId=");
2496 msg.append(repoGroupId);
2497
2498 msg.append(", repoArtifactId=");
2499 msg.append(repoArtifactId);
2500
2501 msg.append(StringPool.CLOSE_CURLY_BRACE);
2502
2503 if (_log.isWarnEnabled()) {
2504 _log.warn(msg.toString());
2505 }
2506
2507 throw new NoSuchProductEntryException(msg.toString());
2508 }
2509
2510 return scProductEntry;
2511 }
2512
2513
2521 public SCProductEntry fetchByRG_RA(String repoGroupId, String repoArtifactId)
2522 throws SystemException {
2523 return fetchByRG_RA(repoGroupId, repoArtifactId, true);
2524 }
2525
2526
2535 public SCProductEntry fetchByRG_RA(String repoGroupId,
2536 String repoArtifactId, boolean retrieveFromCache)
2537 throws SystemException {
2538 Object[] finderArgs = new Object[] { repoGroupId, repoArtifactId };
2539
2540 Object result = null;
2541
2542 if (retrieveFromCache) {
2543 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_RG_RA,
2544 finderArgs, this);
2545 }
2546
2547 if (result instanceof SCProductEntry) {
2548 SCProductEntry scProductEntry = (SCProductEntry)result;
2549
2550 if (!Validator.equals(repoGroupId, scProductEntry.getRepoGroupId()) ||
2551 !Validator.equals(repoArtifactId,
2552 scProductEntry.getRepoArtifactId())) {
2553 result = null;
2554 }
2555 }
2556
2557 if (result == null) {
2558 StringBundler query = new StringBundler(4);
2559
2560 query.append(_SQL_SELECT_SCPRODUCTENTRY_WHERE);
2561
2562 if (repoGroupId == null) {
2563 query.append(_FINDER_COLUMN_RG_RA_REPOGROUPID_1);
2564 }
2565 else {
2566 if (repoGroupId.equals(StringPool.BLANK)) {
2567 query.append(_FINDER_COLUMN_RG_RA_REPOGROUPID_3);
2568 }
2569 else {
2570 query.append(_FINDER_COLUMN_RG_RA_REPOGROUPID_2);
2571 }
2572 }
2573
2574 if (repoArtifactId == null) {
2575 query.append(_FINDER_COLUMN_RG_RA_REPOARTIFACTID_1);
2576 }
2577 else {
2578 if (repoArtifactId.equals(StringPool.BLANK)) {
2579 query.append(_FINDER_COLUMN_RG_RA_REPOARTIFACTID_3);
2580 }
2581 else {
2582 query.append(_FINDER_COLUMN_RG_RA_REPOARTIFACTID_2);
2583 }
2584 }
2585
2586 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
2587
2588 String sql = query.toString();
2589
2590 Session session = null;
2591
2592 try {
2593 session = openSession();
2594
2595 Query q = session.createQuery(sql);
2596
2597 QueryPos qPos = QueryPos.getInstance(q);
2598
2599 if (repoGroupId != null) {
2600 qPos.add(repoGroupId);
2601 }
2602
2603 if (repoArtifactId != null) {
2604 qPos.add(repoArtifactId);
2605 }
2606
2607 List<SCProductEntry> list = q.list();
2608
2609 result = list;
2610
2611 SCProductEntry scProductEntry = null;
2612
2613 if (list.isEmpty()) {
2614 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_RG_RA,
2615 finderArgs, list);
2616 }
2617 else {
2618 scProductEntry = list.get(0);
2619
2620 cacheResult(scProductEntry);
2621
2622 if ((scProductEntry.getRepoGroupId() == null) ||
2623 !scProductEntry.getRepoGroupId().equals(repoGroupId) ||
2624 (scProductEntry.getRepoArtifactId() == null) ||
2625 !scProductEntry.getRepoArtifactId()
2626 .equals(repoArtifactId)) {
2627 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_RG_RA,
2628 finderArgs, scProductEntry);
2629 }
2630 }
2631
2632 return scProductEntry;
2633 }
2634 catch (Exception e) {
2635 throw processException(e);
2636 }
2637 finally {
2638 if (result == null) {
2639 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_RG_RA,
2640 finderArgs);
2641 }
2642
2643 closeSession(session);
2644 }
2645 }
2646 else {
2647 if (result instanceof List<?>) {
2648 return null;
2649 }
2650 else {
2651 return (SCProductEntry)result;
2652 }
2653 }
2654 }
2655
2656
2662 public List<SCProductEntry> findAll() throws SystemException {
2663 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2664 }
2665
2666
2678 public List<SCProductEntry> findAll(int start, int end)
2679 throws SystemException {
2680 return findAll(start, end, null);
2681 }
2682
2683
2696 public List<SCProductEntry> findAll(int start, int end,
2697 OrderByComparator orderByComparator) throws SystemException {
2698 FinderPath finderPath = null;
2699 Object[] finderArgs = new Object[] { start, end, orderByComparator };
2700
2701 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2702 (orderByComparator == null)) {
2703 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
2704 finderArgs = FINDER_ARGS_EMPTY;
2705 }
2706 else {
2707 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
2708 finderArgs = new Object[] { start, end, orderByComparator };
2709 }
2710
2711 List<SCProductEntry> list = (List<SCProductEntry>)FinderCacheUtil.getResult(finderPath,
2712 finderArgs, this);
2713
2714 if (list == null) {
2715 StringBundler query = null;
2716 String sql = null;
2717
2718 if (orderByComparator != null) {
2719 query = new StringBundler(2 +
2720 (orderByComparator.getOrderByFields().length * 3));
2721
2722 query.append(_SQL_SELECT_SCPRODUCTENTRY);
2723
2724 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2725 orderByComparator);
2726
2727 sql = query.toString();
2728 }
2729 else {
2730 sql = _SQL_SELECT_SCPRODUCTENTRY.concat(SCProductEntryModelImpl.ORDER_BY_JPQL);
2731 }
2732
2733 Session session = null;
2734
2735 try {
2736 session = openSession();
2737
2738 Query q = session.createQuery(sql);
2739
2740 if (orderByComparator == null) {
2741 list = (List<SCProductEntry>)QueryUtil.list(q,
2742 getDialect(), start, end, false);
2743
2744 Collections.sort(list);
2745 }
2746 else {
2747 list = (List<SCProductEntry>)QueryUtil.list(q,
2748 getDialect(), start, end);
2749 }
2750 }
2751 catch (Exception e) {
2752 throw processException(e);
2753 }
2754 finally {
2755 if (list == null) {
2756 FinderCacheUtil.removeResult(finderPath, finderArgs);
2757 }
2758 else {
2759 cacheResult(list);
2760
2761 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2762 }
2763
2764 closeSession(session);
2765 }
2766 }
2767
2768 return list;
2769 }
2770
2771
2777 public void removeByGroupId(long groupId) throws SystemException {
2778 for (SCProductEntry scProductEntry : findByGroupId(groupId)) {
2779 remove(scProductEntry);
2780 }
2781 }
2782
2783
2789 public void removeByCompanyId(long companyId) throws SystemException {
2790 for (SCProductEntry scProductEntry : findByCompanyId(companyId)) {
2791 remove(scProductEntry);
2792 }
2793 }
2794
2795
2802 public void removeByG_U(long groupId, long userId)
2803 throws SystemException {
2804 for (SCProductEntry scProductEntry : findByG_U(groupId, userId)) {
2805 remove(scProductEntry);
2806 }
2807 }
2808
2809
2817 public SCProductEntry removeByRG_RA(String repoGroupId,
2818 String repoArtifactId)
2819 throws NoSuchProductEntryException, SystemException {
2820 SCProductEntry scProductEntry = findByRG_RA(repoGroupId, repoArtifactId);
2821
2822 return remove(scProductEntry);
2823 }
2824
2825
2830 public void removeAll() throws SystemException {
2831 for (SCProductEntry scProductEntry : findAll()) {
2832 remove(scProductEntry);
2833 }
2834 }
2835
2836
2843 public int countByGroupId(long groupId) throws SystemException {
2844 Object[] finderArgs = new Object[] { groupId };
2845
2846 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
2847 finderArgs, this);
2848
2849 if (count == null) {
2850 StringBundler query = new StringBundler(2);
2851
2852 query.append(_SQL_COUNT_SCPRODUCTENTRY_WHERE);
2853
2854 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2855
2856 String sql = query.toString();
2857
2858 Session session = null;
2859
2860 try {
2861 session = openSession();
2862
2863 Query q = session.createQuery(sql);
2864
2865 QueryPos qPos = QueryPos.getInstance(q);
2866
2867 qPos.add(groupId);
2868
2869 count = (Long)q.uniqueResult();
2870 }
2871 catch (Exception e) {
2872 throw processException(e);
2873 }
2874 finally {
2875 if (count == null) {
2876 count = Long.valueOf(0);
2877 }
2878
2879 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
2880 finderArgs, count);
2881
2882 closeSession(session);
2883 }
2884 }
2885
2886 return count.intValue();
2887 }
2888
2889
2896 public int filterCountByGroupId(long groupId) throws SystemException {
2897 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2898 return countByGroupId(groupId);
2899 }
2900
2901 StringBundler query = new StringBundler(2);
2902
2903 query.append(_FILTER_SQL_COUNT_SCPRODUCTENTRY_WHERE);
2904
2905 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2906
2907 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2908 SCProductEntry.class.getName(),
2909 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
2910
2911 Session session = null;
2912
2913 try {
2914 session = openSession();
2915
2916 SQLQuery q = session.createSQLQuery(sql);
2917
2918 q.addScalar(COUNT_COLUMN_NAME,
2919 com.liferay.portal.kernel.dao.orm.Type.LONG);
2920
2921 QueryPos qPos = QueryPos.getInstance(q);
2922
2923 qPos.add(groupId);
2924
2925 Long count = (Long)q.uniqueResult();
2926
2927 return count.intValue();
2928 }
2929 catch (Exception e) {
2930 throw processException(e);
2931 }
2932 finally {
2933 closeSession(session);
2934 }
2935 }
2936
2937
2944 public int countByCompanyId(long companyId) throws SystemException {
2945 Object[] finderArgs = new Object[] { companyId };
2946
2947 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
2948 finderArgs, this);
2949
2950 if (count == null) {
2951 StringBundler query = new StringBundler(2);
2952
2953 query.append(_SQL_COUNT_SCPRODUCTENTRY_WHERE);
2954
2955 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
2956
2957 String sql = query.toString();
2958
2959 Session session = null;
2960
2961 try {
2962 session = openSession();
2963
2964 Query q = session.createQuery(sql);
2965
2966 QueryPos qPos = QueryPos.getInstance(q);
2967
2968 qPos.add(companyId);
2969
2970 count = (Long)q.uniqueResult();
2971 }
2972 catch (Exception e) {
2973 throw processException(e);
2974 }
2975 finally {
2976 if (count == null) {
2977 count = Long.valueOf(0);
2978 }
2979
2980 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
2981 finderArgs, count);
2982
2983 closeSession(session);
2984 }
2985 }
2986
2987 return count.intValue();
2988 }
2989
2990
2998 public int countByG_U(long groupId, long userId) throws SystemException {
2999 Object[] finderArgs = new Object[] { groupId, userId };
3000
3001 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_U,
3002 finderArgs, this);
3003
3004 if (count == null) {
3005 StringBundler query = new StringBundler(3);
3006
3007 query.append(_SQL_COUNT_SCPRODUCTENTRY_WHERE);
3008
3009 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
3010
3011 query.append(_FINDER_COLUMN_G_U_USERID_2);
3012
3013 String sql = query.toString();
3014
3015 Session session = null;
3016
3017 try {
3018 session = openSession();
3019
3020 Query q = session.createQuery(sql);
3021
3022 QueryPos qPos = QueryPos.getInstance(q);
3023
3024 qPos.add(groupId);
3025
3026 qPos.add(userId);
3027
3028 count = (Long)q.uniqueResult();
3029 }
3030 catch (Exception e) {
3031 throw processException(e);
3032 }
3033 finally {
3034 if (count == null) {
3035 count = Long.valueOf(0);
3036 }
3037
3038 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_U, finderArgs,
3039 count);
3040
3041 closeSession(session);
3042 }
3043 }
3044
3045 return count.intValue();
3046 }
3047
3048
3056 public int filterCountByG_U(long groupId, long userId)
3057 throws SystemException {
3058 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3059 return countByG_U(groupId, userId);
3060 }
3061
3062 StringBundler query = new StringBundler(3);
3063
3064 query.append(_FILTER_SQL_COUNT_SCPRODUCTENTRY_WHERE);
3065
3066 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
3067
3068 query.append(_FINDER_COLUMN_G_U_USERID_2);
3069
3070 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3071 SCProductEntry.class.getName(),
3072 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
3073
3074 Session session = null;
3075
3076 try {
3077 session = openSession();
3078
3079 SQLQuery q = session.createSQLQuery(sql);
3080
3081 q.addScalar(COUNT_COLUMN_NAME,
3082 com.liferay.portal.kernel.dao.orm.Type.LONG);
3083
3084 QueryPos qPos = QueryPos.getInstance(q);
3085
3086 qPos.add(groupId);
3087
3088 qPos.add(userId);
3089
3090 Long count = (Long)q.uniqueResult();
3091
3092 return count.intValue();
3093 }
3094 catch (Exception e) {
3095 throw processException(e);
3096 }
3097 finally {
3098 closeSession(session);
3099 }
3100 }
3101
3102
3110 public int countByRG_RA(String repoGroupId, String repoArtifactId)
3111 throws SystemException {
3112 Object[] finderArgs = new Object[] { repoGroupId, repoArtifactId };
3113
3114 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_RG_RA,
3115 finderArgs, this);
3116
3117 if (count == null) {
3118 StringBundler query = new StringBundler(3);
3119
3120 query.append(_SQL_COUNT_SCPRODUCTENTRY_WHERE);
3121
3122 if (repoGroupId == null) {
3123 query.append(_FINDER_COLUMN_RG_RA_REPOGROUPID_1);
3124 }
3125 else {
3126 if (repoGroupId.equals(StringPool.BLANK)) {
3127 query.append(_FINDER_COLUMN_RG_RA_REPOGROUPID_3);
3128 }
3129 else {
3130 query.append(_FINDER_COLUMN_RG_RA_REPOGROUPID_2);
3131 }
3132 }
3133
3134 if (repoArtifactId == null) {
3135 query.append(_FINDER_COLUMN_RG_RA_REPOARTIFACTID_1);
3136 }
3137 else {
3138 if (repoArtifactId.equals(StringPool.BLANK)) {
3139 query.append(_FINDER_COLUMN_RG_RA_REPOARTIFACTID_3);
3140 }
3141 else {
3142 query.append(_FINDER_COLUMN_RG_RA_REPOARTIFACTID_2);
3143 }
3144 }
3145
3146 String sql = query.toString();
3147
3148 Session session = null;
3149
3150 try {
3151 session = openSession();
3152
3153 Query q = session.createQuery(sql);
3154
3155 QueryPos qPos = QueryPos.getInstance(q);
3156
3157 if (repoGroupId != null) {
3158 qPos.add(repoGroupId);
3159 }
3160
3161 if (repoArtifactId != null) {
3162 qPos.add(repoArtifactId);
3163 }
3164
3165 count = (Long)q.uniqueResult();
3166 }
3167 catch (Exception e) {
3168 throw processException(e);
3169 }
3170 finally {
3171 if (count == null) {
3172 count = Long.valueOf(0);
3173 }
3174
3175 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_RG_RA,
3176 finderArgs, count);
3177
3178 closeSession(session);
3179 }
3180 }
3181
3182 return count.intValue();
3183 }
3184
3185
3191 public int countAll() throws SystemException {
3192 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3193 FINDER_ARGS_EMPTY, this);
3194
3195 if (count == null) {
3196 Session session = null;
3197
3198 try {
3199 session = openSession();
3200
3201 Query q = session.createQuery(_SQL_COUNT_SCPRODUCTENTRY);
3202
3203 count = (Long)q.uniqueResult();
3204 }
3205 catch (Exception e) {
3206 throw processException(e);
3207 }
3208 finally {
3209 if (count == null) {
3210 count = Long.valueOf(0);
3211 }
3212
3213 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
3214 FINDER_ARGS_EMPTY, count);
3215
3216 closeSession(session);
3217 }
3218 }
3219
3220 return count.intValue();
3221 }
3222
3223
3230 public List<com.liferay.portlet.softwarecatalog.model.SCLicense> getSCLicenses(
3231 long pk) throws SystemException {
3232 return getSCLicenses(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
3233 }
3234
3235
3248 public List<com.liferay.portlet.softwarecatalog.model.SCLicense> getSCLicenses(
3249 long pk, int start, int end) throws SystemException {
3250 return getSCLicenses(pk, start, end, null);
3251 }
3252
3253 public static final FinderPath FINDER_PATH_GET_SCLICENSES = new FinderPath(com.liferay.portlet.softwarecatalog.model.impl.SCLicenseModelImpl.ENTITY_CACHE_ENABLED,
3254 SCProductEntryModelImpl.FINDER_CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES,
3255 com.liferay.portlet.softwarecatalog.model.impl.SCLicenseImpl.class,
3256 SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME,
3257 "getSCLicenses",
3258 new String[] {
3259 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
3260 "com.liferay.portal.kernel.util.OrderByComparator"
3261 });
3262
3263 static {
3264 FINDER_PATH_GET_SCLICENSES.setCacheKeyGeneratorCacheName(null);
3265 }
3266
3267
3281 public List<com.liferay.portlet.softwarecatalog.model.SCLicense> getSCLicenses(
3282 long pk, int start, int end, OrderByComparator orderByComparator)
3283 throws SystemException {
3284 Object[] finderArgs = new Object[] { pk, start, end, orderByComparator };
3285
3286 List<com.liferay.portlet.softwarecatalog.model.SCLicense> list = (List<com.liferay.portlet.softwarecatalog.model.SCLicense>)FinderCacheUtil.getResult(FINDER_PATH_GET_SCLICENSES,
3287 finderArgs, this);
3288
3289 if (list == null) {
3290 Session session = null;
3291
3292 try {
3293 session = openSession();
3294
3295 String sql = null;
3296
3297 if (orderByComparator != null) {
3298 sql = _SQL_GETSCLICENSES.concat(ORDER_BY_CLAUSE)
3299 .concat(orderByComparator.getOrderBy());
3300 }
3301 else {
3302 sql = _SQL_GETSCLICENSES.concat(com.liferay.portlet.softwarecatalog.model.impl.SCLicenseModelImpl.ORDER_BY_SQL);
3303 }
3304
3305 SQLQuery q = session.createSQLQuery(sql);
3306
3307 q.addEntity("SCLicense",
3308 com.liferay.portlet.softwarecatalog.model.impl.SCLicenseImpl.class);
3309
3310 QueryPos qPos = QueryPos.getInstance(q);
3311
3312 qPos.add(pk);
3313
3314 list = (List<com.liferay.portlet.softwarecatalog.model.SCLicense>)QueryUtil.list(q,
3315 getDialect(), start, end);
3316 }
3317 catch (Exception e) {
3318 throw processException(e);
3319 }
3320 finally {
3321 if (list == null) {
3322 FinderCacheUtil.removeResult(FINDER_PATH_GET_SCLICENSES,
3323 finderArgs);
3324 }
3325 else {
3326 scLicensePersistence.cacheResult(list);
3327
3328 FinderCacheUtil.putResult(FINDER_PATH_GET_SCLICENSES,
3329 finderArgs, list);
3330 }
3331
3332 closeSession(session);
3333 }
3334 }
3335
3336 return list;
3337 }
3338
3339 public static final FinderPath FINDER_PATH_GET_SCLICENSES_SIZE = new FinderPath(com.liferay.portlet.softwarecatalog.model.impl.SCLicenseModelImpl.ENTITY_CACHE_ENABLED,
3340 SCProductEntryModelImpl.FINDER_CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES,
3341 Long.class,
3342 SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME,
3343 "getSCLicensesSize", new String[] { Long.class.getName() });
3344
3345 static {
3346 FINDER_PATH_GET_SCLICENSES_SIZE.setCacheKeyGeneratorCacheName(null);
3347 }
3348
3349
3356 public int getSCLicensesSize(long pk) throws SystemException {
3357 Object[] finderArgs = new Object[] { pk };
3358
3359 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_SCLICENSES_SIZE,
3360 finderArgs, this);
3361
3362 if (count == null) {
3363 Session session = null;
3364
3365 try {
3366 session = openSession();
3367
3368 SQLQuery q = session.createSQLQuery(_SQL_GETSCLICENSESSIZE);
3369
3370 q.addScalar(COUNT_COLUMN_NAME,
3371 com.liferay.portal.kernel.dao.orm.Type.LONG);
3372
3373 QueryPos qPos = QueryPos.getInstance(q);
3374
3375 qPos.add(pk);
3376
3377 count = (Long)q.uniqueResult();
3378 }
3379 catch (Exception e) {
3380 throw processException(e);
3381 }
3382 finally {
3383 if (count == null) {
3384 count = Long.valueOf(0);
3385 }
3386
3387 FinderCacheUtil.putResult(FINDER_PATH_GET_SCLICENSES_SIZE,
3388 finderArgs, count);
3389
3390 closeSession(session);
3391 }
3392 }
3393
3394 return count.intValue();
3395 }
3396
3397 public static final FinderPath FINDER_PATH_CONTAINS_SCLICENSE = new FinderPath(com.liferay.portlet.softwarecatalog.model.impl.SCLicenseModelImpl.ENTITY_CACHE_ENABLED,
3398 SCProductEntryModelImpl.FINDER_CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES,
3399 Boolean.class,
3400 SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME,
3401 "containsSCLicense",
3402 new String[] { Long.class.getName(), Long.class.getName() });
3403
3404
3412 public boolean containsSCLicense(long pk, long scLicensePK)
3413 throws SystemException {
3414 Object[] finderArgs = new Object[] { pk, scLicensePK };
3415
3416 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_SCLICENSE,
3417 finderArgs, this);
3418
3419 if (value == null) {
3420 try {
3421 value = Boolean.valueOf(containsSCLicense.contains(pk,
3422 scLicensePK));
3423 }
3424 catch (Exception e) {
3425 throw processException(e);
3426 }
3427 finally {
3428 if (value == null) {
3429 value = Boolean.FALSE;
3430 }
3431
3432 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_SCLICENSE,
3433 finderArgs, value);
3434 }
3435 }
3436
3437 return value.booleanValue();
3438 }
3439
3440
3447 public boolean containsSCLicenses(long pk) throws SystemException {
3448 if (getSCLicensesSize(pk) > 0) {
3449 return true;
3450 }
3451 else {
3452 return false;
3453 }
3454 }
3455
3456
3463 public void addSCLicense(long pk, long scLicensePK)
3464 throws SystemException {
3465 try {
3466 addSCLicense.add(pk, scLicensePK);
3467 }
3468 catch (Exception e) {
3469 throw processException(e);
3470 }
3471 finally {
3472 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3473 }
3474 }
3475
3476
3483 public void addSCLicense(long pk,
3484 com.liferay.portlet.softwarecatalog.model.SCLicense scLicense)
3485 throws SystemException {
3486 try {
3487 addSCLicense.add(pk, scLicense.getPrimaryKey());
3488 }
3489 catch (Exception e) {
3490 throw processException(e);
3491 }
3492 finally {
3493 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3494 }
3495 }
3496
3497
3504 public void addSCLicenses(long pk, long[] scLicensePKs)
3505 throws SystemException {
3506 try {
3507 for (long scLicensePK : scLicensePKs) {
3508 addSCLicense.add(pk, scLicensePK);
3509 }
3510 }
3511 catch (Exception e) {
3512 throw processException(e);
3513 }
3514 finally {
3515 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3516 }
3517 }
3518
3519
3526 public void addSCLicenses(long pk,
3527 List<com.liferay.portlet.softwarecatalog.model.SCLicense> scLicenses)
3528 throws SystemException {
3529 try {
3530 for (com.liferay.portlet.softwarecatalog.model.SCLicense scLicense : scLicenses) {
3531 addSCLicense.add(pk, scLicense.getPrimaryKey());
3532 }
3533 }
3534 catch (Exception e) {
3535 throw processException(e);
3536 }
3537 finally {
3538 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3539 }
3540 }
3541
3542
3548 public void clearSCLicenses(long pk) throws SystemException {
3549 try {
3550 clearSCLicenses.clear(pk);
3551 }
3552 catch (Exception e) {
3553 throw processException(e);
3554 }
3555 finally {
3556 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3557 }
3558 }
3559
3560
3567 public void removeSCLicense(long pk, long scLicensePK)
3568 throws SystemException {
3569 try {
3570 removeSCLicense.remove(pk, scLicensePK);
3571 }
3572 catch (Exception e) {
3573 throw processException(e);
3574 }
3575 finally {
3576 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3577 }
3578 }
3579
3580
3587 public void removeSCLicense(long pk,
3588 com.liferay.portlet.softwarecatalog.model.SCLicense scLicense)
3589 throws SystemException {
3590 try {
3591 removeSCLicense.remove(pk, scLicense.getPrimaryKey());
3592 }
3593 catch (Exception e) {
3594 throw processException(e);
3595 }
3596 finally {
3597 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3598 }
3599 }
3600
3601
3608 public void removeSCLicenses(long pk, long[] scLicensePKs)
3609 throws SystemException {
3610 try {
3611 for (long scLicensePK : scLicensePKs) {
3612 removeSCLicense.remove(pk, scLicensePK);
3613 }
3614 }
3615 catch (Exception e) {
3616 throw processException(e);
3617 }
3618 finally {
3619 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3620 }
3621 }
3622
3623
3630 public void removeSCLicenses(long pk,
3631 List<com.liferay.portlet.softwarecatalog.model.SCLicense> scLicenses)
3632 throws SystemException {
3633 try {
3634 for (com.liferay.portlet.softwarecatalog.model.SCLicense scLicense : scLicenses) {
3635 removeSCLicense.remove(pk, scLicense.getPrimaryKey());
3636 }
3637 }
3638 catch (Exception e) {
3639 throw processException(e);
3640 }
3641 finally {
3642 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3643 }
3644 }
3645
3646
3653 public void setSCLicenses(long pk, long[] scLicensePKs)
3654 throws SystemException {
3655 try {
3656 Set<Long> scLicensePKSet = SetUtil.fromArray(scLicensePKs);
3657
3658 List<com.liferay.portlet.softwarecatalog.model.SCLicense> scLicenses =
3659 getSCLicenses(pk);
3660
3661 for (com.liferay.portlet.softwarecatalog.model.SCLicense scLicense : scLicenses) {
3662 if (!scLicensePKSet.remove(scLicense.getPrimaryKey())) {
3663 removeSCLicense.remove(pk, scLicense.getPrimaryKey());
3664 }
3665 }
3666
3667 for (Long scLicensePK : scLicensePKSet) {
3668 addSCLicense.add(pk, scLicensePK);
3669 }
3670 }
3671 catch (Exception e) {
3672 throw processException(e);
3673 }
3674 finally {
3675 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3676 }
3677 }
3678
3679
3686 public void setSCLicenses(long pk,
3687 List<com.liferay.portlet.softwarecatalog.model.SCLicense> scLicenses)
3688 throws SystemException {
3689 try {
3690 long[] scLicensePKs = new long[scLicenses.size()];
3691
3692 for (int i = 0; i < scLicenses.size(); i++) {
3693 com.liferay.portlet.softwarecatalog.model.SCLicense scLicense = scLicenses.get(i);
3694
3695 scLicensePKs[i] = scLicense.getPrimaryKey();
3696 }
3697
3698 setSCLicenses(pk, scLicensePKs);
3699 }
3700 catch (Exception e) {
3701 throw processException(e);
3702 }
3703 finally {
3704 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3705 }
3706 }
3707
3708
3711 public void afterPropertiesSet() {
3712 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
3713 com.liferay.portal.util.PropsUtil.get(
3714 "value.object.listener.com.liferay.portlet.softwarecatalog.model.SCProductEntry")));
3715
3716 if (listenerClassNames.length > 0) {
3717 try {
3718 List<ModelListener<SCProductEntry>> listenersList = new ArrayList<ModelListener<SCProductEntry>>();
3719
3720 for (String listenerClassName : listenerClassNames) {
3721 Class<?> clazz = getClass();
3722
3723 listenersList.add((ModelListener<SCProductEntry>)InstanceFactory.newInstance(
3724 clazz.getClassLoader(), listenerClassName));
3725 }
3726
3727 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3728 }
3729 catch (Exception e) {
3730 _log.error(e);
3731 }
3732 }
3733
3734 containsSCLicense = new ContainsSCLicense();
3735
3736 addSCLicense = new AddSCLicense();
3737 clearSCLicenses = new ClearSCLicenses();
3738 removeSCLicense = new RemoveSCLicense();
3739 }
3740
3741 public void destroy() {
3742 EntityCacheUtil.removeCache(SCProductEntryImpl.class.getName());
3743 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
3744 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
3745 }
3746
3747 @BeanReference(type = SCFrameworkVersionPersistence.class)
3748 protected SCFrameworkVersionPersistence scFrameworkVersionPersistence;
3749 @BeanReference(type = SCLicensePersistence.class)
3750 protected SCLicensePersistence scLicensePersistence;
3751 @BeanReference(type = SCProductEntryPersistence.class)
3752 protected SCProductEntryPersistence scProductEntryPersistence;
3753 @BeanReference(type = SCProductScreenshotPersistence.class)
3754 protected SCProductScreenshotPersistence scProductScreenshotPersistence;
3755 @BeanReference(type = SCProductVersionPersistence.class)
3756 protected SCProductVersionPersistence scProductVersionPersistence;
3757 @BeanReference(type = GroupPersistence.class)
3758 protected GroupPersistence groupPersistence;
3759 @BeanReference(type = ImagePersistence.class)
3760 protected ImagePersistence imagePersistence;
3761 @BeanReference(type = ResourcePersistence.class)
3762 protected ResourcePersistence resourcePersistence;
3763 @BeanReference(type = SubscriptionPersistence.class)
3764 protected SubscriptionPersistence subscriptionPersistence;
3765 @BeanReference(type = UserPersistence.class)
3766 protected UserPersistence userPersistence;
3767 @BeanReference(type = MBMessagePersistence.class)
3768 protected MBMessagePersistence mbMessagePersistence;
3769 @BeanReference(type = RatingsStatsPersistence.class)
3770 protected RatingsStatsPersistence ratingsStatsPersistence;
3771 protected ContainsSCLicense containsSCLicense;
3772 protected AddSCLicense addSCLicense;
3773 protected ClearSCLicenses clearSCLicenses;
3774 protected RemoveSCLicense removeSCLicense;
3775
3776 protected class ContainsSCLicense {
3777 protected ContainsSCLicense() {
3778 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
3779 _SQL_CONTAINSSCLICENSE,
3780 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
3781 RowMapper.COUNT);
3782 }
3783
3784 protected boolean contains(long productEntryId, long licenseId) {
3785 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
3786 new Long(productEntryId), new Long(licenseId)
3787 });
3788
3789 if (results.size() > 0) {
3790 Integer count = results.get(0);
3791
3792 if (count.intValue() > 0) {
3793 return true;
3794 }
3795 }
3796
3797 return false;
3798 }
3799
3800 private MappingSqlQuery<Integer> _mappingSqlQuery;
3801 }
3802
3803 protected class AddSCLicense {
3804 protected AddSCLicense() {
3805 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
3806 "INSERT INTO SCLicenses_SCProductEntries (productEntryId, licenseId) VALUES (?, ?)",
3807 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
3808 }
3809
3810 protected void add(long productEntryId, long licenseId)
3811 throws SystemException {
3812 if (!containsSCLicense.contains(productEntryId, licenseId)) {
3813 ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense>[] scLicenseListeners =
3814 scLicensePersistence.getListeners();
3815
3816 for (ModelListener<SCProductEntry> listener : listeners) {
3817 listener.onBeforeAddAssociation(productEntryId,
3818 com.liferay.portlet.softwarecatalog.model.SCLicense.class.getName(),
3819 licenseId);
3820 }
3821
3822 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense> listener : scLicenseListeners) {
3823 listener.onBeforeAddAssociation(licenseId,
3824 SCProductEntry.class.getName(), productEntryId);
3825 }
3826
3827 _sqlUpdate.update(new Object[] {
3828 new Long(productEntryId), new Long(licenseId)
3829 });
3830
3831 for (ModelListener<SCProductEntry> listener : listeners) {
3832 listener.onAfterAddAssociation(productEntryId,
3833 com.liferay.portlet.softwarecatalog.model.SCLicense.class.getName(),
3834 licenseId);
3835 }
3836
3837 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense> listener : scLicenseListeners) {
3838 listener.onAfterAddAssociation(licenseId,
3839 SCProductEntry.class.getName(), productEntryId);
3840 }
3841 }
3842 }
3843
3844 private SqlUpdate _sqlUpdate;
3845 }
3846
3847 protected class ClearSCLicenses {
3848 protected ClearSCLicenses() {
3849 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
3850 "DELETE FROM SCLicenses_SCProductEntries WHERE productEntryId = ?",
3851 new int[] { java.sql.Types.BIGINT });
3852 }
3853
3854 protected void clear(long productEntryId) throws SystemException {
3855 ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense>[] scLicenseListeners =
3856 scLicensePersistence.getListeners();
3857
3858 List<com.liferay.portlet.softwarecatalog.model.SCLicense> scLicenses =
3859 null;
3860
3861 if ((listeners.length > 0) || (scLicenseListeners.length > 0)) {
3862 scLicenses = getSCLicenses(productEntryId);
3863
3864 for (com.liferay.portlet.softwarecatalog.model.SCLicense scLicense : scLicenses) {
3865 for (ModelListener<SCProductEntry> listener : listeners) {
3866 listener.onBeforeRemoveAssociation(productEntryId,
3867 com.liferay.portlet.softwarecatalog.model.SCLicense.class.getName(),
3868 scLicense.getPrimaryKey());
3869 }
3870
3871 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense> listener : scLicenseListeners) {
3872 listener.onBeforeRemoveAssociation(scLicense.getPrimaryKey(),
3873 SCProductEntry.class.getName(), productEntryId);
3874 }
3875 }
3876 }
3877
3878 _sqlUpdate.update(new Object[] { new Long(productEntryId) });
3879
3880 if ((listeners.length > 0) || (scLicenseListeners.length > 0)) {
3881 for (com.liferay.portlet.softwarecatalog.model.SCLicense scLicense : scLicenses) {
3882 for (ModelListener<SCProductEntry> listener : listeners) {
3883 listener.onAfterRemoveAssociation(productEntryId,
3884 com.liferay.portlet.softwarecatalog.model.SCLicense.class.getName(),
3885 scLicense.getPrimaryKey());
3886 }
3887
3888 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense> listener : scLicenseListeners) {
3889 listener.onAfterRemoveAssociation(scLicense.getPrimaryKey(),
3890 SCProductEntry.class.getName(), productEntryId);
3891 }
3892 }
3893 }
3894 }
3895
3896 private SqlUpdate _sqlUpdate;
3897 }
3898
3899 protected class RemoveSCLicense {
3900 protected RemoveSCLicense() {
3901 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
3902 "DELETE FROM SCLicenses_SCProductEntries WHERE productEntryId = ? AND licenseId = ?",
3903 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
3904 }
3905
3906 protected void remove(long productEntryId, long licenseId)
3907 throws SystemException {
3908 if (containsSCLicense.contains(productEntryId, licenseId)) {
3909 ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense>[] scLicenseListeners =
3910 scLicensePersistence.getListeners();
3911
3912 for (ModelListener<SCProductEntry> listener : listeners) {
3913 listener.onBeforeRemoveAssociation(productEntryId,
3914 com.liferay.portlet.softwarecatalog.model.SCLicense.class.getName(),
3915 licenseId);
3916 }
3917
3918 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense> listener : scLicenseListeners) {
3919 listener.onBeforeRemoveAssociation(licenseId,
3920 SCProductEntry.class.getName(), productEntryId);
3921 }
3922
3923 _sqlUpdate.update(new Object[] {
3924 new Long(productEntryId), new Long(licenseId)
3925 });
3926
3927 for (ModelListener<SCProductEntry> listener : listeners) {
3928 listener.onAfterRemoveAssociation(productEntryId,
3929 com.liferay.portlet.softwarecatalog.model.SCLicense.class.getName(),
3930 licenseId);
3931 }
3932
3933 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense> listener : scLicenseListeners) {
3934 listener.onAfterRemoveAssociation(licenseId,
3935 SCProductEntry.class.getName(), productEntryId);
3936 }
3937 }
3938 }
3939
3940 private SqlUpdate _sqlUpdate;
3941 }
3942
3943 private static final String _SQL_SELECT_SCPRODUCTENTRY = "SELECT scProductEntry FROM SCProductEntry scProductEntry";
3944 private static final String _SQL_SELECT_SCPRODUCTENTRY_WHERE = "SELECT scProductEntry FROM SCProductEntry scProductEntry WHERE ";
3945 private static final String _SQL_COUNT_SCPRODUCTENTRY = "SELECT COUNT(scProductEntry) FROM SCProductEntry scProductEntry";
3946 private static final String _SQL_COUNT_SCPRODUCTENTRY_WHERE = "SELECT COUNT(scProductEntry) FROM SCProductEntry scProductEntry WHERE ";
3947 private static final String _SQL_GETSCLICENSES = "SELECT {SCLicense.*} FROM SCLicense INNER JOIN SCLicenses_SCProductEntries ON (SCLicenses_SCProductEntries.licenseId = SCLicense.licenseId) WHERE (SCLicenses_SCProductEntries.productEntryId = ?)";
3948 private static final String _SQL_GETSCLICENSESSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM SCLicenses_SCProductEntries WHERE productEntryId = ?";
3949 private static final String _SQL_CONTAINSSCLICENSE = "SELECT COUNT(*) AS COUNT_VALUE FROM SCLicenses_SCProductEntries WHERE productEntryId = ? AND licenseId = ?";
3950 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "scProductEntry.groupId = ?";
3951 private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "scProductEntry.companyId = ?";
3952 private static final String _FINDER_COLUMN_G_U_GROUPID_2 = "scProductEntry.groupId = ? AND ";
3953 private static final String _FINDER_COLUMN_G_U_USERID_2 = "scProductEntry.userId = ?";
3954 private static final String _FINDER_COLUMN_RG_RA_REPOGROUPID_1 = "scProductEntry.repoGroupId IS NULL AND ";
3955 private static final String _FINDER_COLUMN_RG_RA_REPOGROUPID_2 = "lower(scProductEntry.repoGroupId) = lower(CAST_TEXT(?)) AND ";
3956 private static final String _FINDER_COLUMN_RG_RA_REPOGROUPID_3 = "(scProductEntry.repoGroupId IS NULL OR lower(scProductEntry.repoGroupId) = lower(CAST_TEXT(?))) AND ";
3957 private static final String _FINDER_COLUMN_RG_RA_REPOARTIFACTID_1 = "scProductEntry.repoArtifactId IS NULL";
3958 private static final String _FINDER_COLUMN_RG_RA_REPOARTIFACTID_2 = "lower(scProductEntry.repoArtifactId) = lower(CAST_TEXT(?))";
3959 private static final String _FINDER_COLUMN_RG_RA_REPOARTIFACTID_3 = "(scProductEntry.repoArtifactId IS NULL OR lower(scProductEntry.repoArtifactId) = lower(CAST_TEXT(?)))";
3960 private static final String _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN = "scProductEntry.productEntryId";
3961 private static final String _FILTER_SQL_SELECT_SCPRODUCTENTRY_WHERE = "SELECT DISTINCT {scProductEntry.*} FROM SCProductEntry scProductEntry WHERE ";
3962 private static final String _FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_1 =
3963 "SELECT {SCProductEntry.*} FROM (SELECT DISTINCT scProductEntry.productEntryId FROM SCProductEntry scProductEntry WHERE ";
3964 private static final String _FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_2 =
3965 ") TEMP_TABLE INNER JOIN SCProductEntry ON TEMP_TABLE.productEntryId = SCProductEntry.productEntryId";
3966 private static final String _FILTER_SQL_COUNT_SCPRODUCTENTRY_WHERE = "SELECT COUNT(DISTINCT scProductEntry.productEntryId) AS COUNT_VALUE FROM SCProductEntry scProductEntry WHERE ";
3967 private static final String _FILTER_ENTITY_ALIAS = "scProductEntry";
3968 private static final String _FILTER_ENTITY_TABLE = "SCProductEntry";
3969 private static final String _ORDER_BY_ENTITY_ALIAS = "scProductEntry.";
3970 private static final String _ORDER_BY_ENTITY_TABLE = "SCProductEntry.";
3971 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No SCProductEntry exists with the primary key ";
3972 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No SCProductEntry exists with the key {";
3973 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
3974 private static Log _log = LogFactoryUtil.getLog(SCProductEntryPersistenceImpl.class);
3975 private static SCProductEntry _nullSCProductEntry = new SCProductEntryImpl() {
3976 @Override
3977 public Object clone() {
3978 return this;
3979 }
3980
3981 @Override
3982 public CacheModel<SCProductEntry> toCacheModel() {
3983 return _nullSCProductEntryCacheModel;
3984 }
3985 };
3986
3987 private static CacheModel<SCProductEntry> _nullSCProductEntryCacheModel = new CacheModel<SCProductEntry>() {
3988 public SCProductEntry toEntityModel() {
3989 return _nullSCProductEntry;
3990 }
3991 };
3992 }