001
014
015 package com.liferay.portlet.softwarecatalog.service.persistence;
016
017 import com.liferay.portal.kernel.bean.BeanReference;
018 import com.liferay.portal.kernel.cache.CacheRegistryUtil;
019 import com.liferay.portal.kernel.dao.jdbc.MappingSqlQuery;
020 import com.liferay.portal.kernel.dao.jdbc.MappingSqlQueryFactoryUtil;
021 import com.liferay.portal.kernel.dao.jdbc.RowMapper;
022 import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
023 import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
024 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
025 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
026 import com.liferay.portal.kernel.dao.orm.FinderPath;
027 import com.liferay.portal.kernel.dao.orm.Query;
028 import com.liferay.portal.kernel.dao.orm.QueryPos;
029 import com.liferay.portal.kernel.dao.orm.QueryUtil;
030 import com.liferay.portal.kernel.dao.orm.SQLQuery;
031 import com.liferay.portal.kernel.dao.orm.Session;
032 import com.liferay.portal.kernel.exception.SystemException;
033 import com.liferay.portal.kernel.log.Log;
034 import com.liferay.portal.kernel.log.LogFactoryUtil;
035 import com.liferay.portal.kernel.util.GetterUtil;
036 import com.liferay.portal.kernel.util.InstanceFactory;
037 import com.liferay.portal.kernel.util.OrderByComparator;
038 import com.liferay.portal.kernel.util.SetUtil;
039 import com.liferay.portal.kernel.util.StringBundler;
040 import com.liferay.portal.kernel.util.StringPool;
041 import com.liferay.portal.kernel.util.StringUtil;
042 import com.liferay.portal.kernel.util.UnmodifiableList;
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.impl.BasePersistenceImpl;
048
049 import com.liferay.portlet.softwarecatalog.NoSuchProductEntryException;
050 import com.liferay.portlet.softwarecatalog.model.SCProductEntry;
051 import com.liferay.portlet.softwarecatalog.model.impl.SCProductEntryImpl;
052 import com.liferay.portlet.softwarecatalog.model.impl.SCProductEntryModelImpl;
053
054 import java.io.Serializable;
055
056 import java.util.ArrayList;
057 import java.util.Collections;
058 import java.util.List;
059 import java.util.Set;
060
061
073 public class SCProductEntryPersistenceImpl extends BasePersistenceImpl<SCProductEntry>
074 implements SCProductEntryPersistence {
075
080 public static final String FINDER_CLASS_NAME_ENTITY = SCProductEntryImpl.class.getName();
081 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
082 ".List1";
083 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
084 ".List2";
085 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
086 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
087 SCProductEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
088 "findAll", new String[0]);
089 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
090 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
091 SCProductEntryImpl.class,
092 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
093 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
094 SCProductEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
095 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
096 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
097 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
098 SCProductEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
099 "findByGroupId",
100 new String[] {
101 Long.class.getName(),
102
103 Integer.class.getName(), Integer.class.getName(),
104 OrderByComparator.class.getName()
105 });
106 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID =
107 new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
108 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
109 SCProductEntryImpl.class,
110 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByGroupId",
111 new String[] { Long.class.getName() },
112 SCProductEntryModelImpl.GROUPID_COLUMN_BITMASK |
113 SCProductEntryModelImpl.MODIFIEDDATE_COLUMN_BITMASK |
114 SCProductEntryModelImpl.NAME_COLUMN_BITMASK);
115 public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
116 SCProductEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
117 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByGroupId",
118 new String[] { Long.class.getName() });
119
120
127 @Override
128 public List<SCProductEntry> findByGroupId(long groupId)
129 throws SystemException {
130 return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
131 }
132
133
146 @Override
147 public List<SCProductEntry> findByGroupId(long groupId, int start, int end)
148 throws SystemException {
149 return findByGroupId(groupId, start, end, null);
150 }
151
152
166 @Override
167 public List<SCProductEntry> findByGroupId(long groupId, int start, int end,
168 OrderByComparator orderByComparator) throws SystemException {
169 boolean pagination = true;
170 FinderPath finderPath = null;
171 Object[] finderArgs = null;
172
173 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
174 (orderByComparator == null)) {
175 pagination = false;
176 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID;
177 finderArgs = new Object[] { groupId };
178 }
179 else {
180 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID;
181 finderArgs = new Object[] { groupId, start, end, orderByComparator };
182 }
183
184 List<SCProductEntry> list = (List<SCProductEntry>)FinderCacheUtil.getResult(finderPath,
185 finderArgs, this);
186
187 if ((list != null) && !list.isEmpty()) {
188 for (SCProductEntry scProductEntry : list) {
189 if ((groupId != scProductEntry.getGroupId())) {
190 list = null;
191
192 break;
193 }
194 }
195 }
196
197 if (list == null) {
198 StringBundler query = null;
199
200 if (orderByComparator != null) {
201 query = new StringBundler(3 +
202 (orderByComparator.getOrderByFields().length * 3));
203 }
204 else {
205 query = new StringBundler(3);
206 }
207
208 query.append(_SQL_SELECT_SCPRODUCTENTRY_WHERE);
209
210 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
211
212 if (orderByComparator != null) {
213 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
214 orderByComparator);
215 }
216 else
217 if (pagination) {
218 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
219 }
220
221 String sql = query.toString();
222
223 Session session = null;
224
225 try {
226 session = openSession();
227
228 Query q = session.createQuery(sql);
229
230 QueryPos qPos = QueryPos.getInstance(q);
231
232 qPos.add(groupId);
233
234 if (!pagination) {
235 list = (List<SCProductEntry>)QueryUtil.list(q,
236 getDialect(), start, end, false);
237
238 Collections.sort(list);
239
240 list = new UnmodifiableList<SCProductEntry>(list);
241 }
242 else {
243 list = (List<SCProductEntry>)QueryUtil.list(q,
244 getDialect(), start, end);
245 }
246
247 cacheResult(list);
248
249 FinderCacheUtil.putResult(finderPath, finderArgs, list);
250 }
251 catch (Exception e) {
252 FinderCacheUtil.removeResult(finderPath, finderArgs);
253
254 throw processException(e);
255 }
256 finally {
257 closeSession(session);
258 }
259 }
260
261 return list;
262 }
263
264
273 @Override
274 public SCProductEntry findByGroupId_First(long groupId,
275 OrderByComparator orderByComparator)
276 throws NoSuchProductEntryException, SystemException {
277 SCProductEntry scProductEntry = fetchByGroupId_First(groupId,
278 orderByComparator);
279
280 if (scProductEntry != null) {
281 return scProductEntry;
282 }
283
284 StringBundler msg = new StringBundler(4);
285
286 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
287
288 msg.append("groupId=");
289 msg.append(groupId);
290
291 msg.append(StringPool.CLOSE_CURLY_BRACE);
292
293 throw new NoSuchProductEntryException(msg.toString());
294 }
295
296
304 @Override
305 public SCProductEntry fetchByGroupId_First(long groupId,
306 OrderByComparator orderByComparator) throws SystemException {
307 List<SCProductEntry> list = findByGroupId(groupId, 0, 1,
308 orderByComparator);
309
310 if (!list.isEmpty()) {
311 return list.get(0);
312 }
313
314 return null;
315 }
316
317
326 @Override
327 public SCProductEntry findByGroupId_Last(long groupId,
328 OrderByComparator orderByComparator)
329 throws NoSuchProductEntryException, SystemException {
330 SCProductEntry scProductEntry = fetchByGroupId_Last(groupId,
331 orderByComparator);
332
333 if (scProductEntry != null) {
334 return scProductEntry;
335 }
336
337 StringBundler msg = new StringBundler(4);
338
339 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
340
341 msg.append("groupId=");
342 msg.append(groupId);
343
344 msg.append(StringPool.CLOSE_CURLY_BRACE);
345
346 throw new NoSuchProductEntryException(msg.toString());
347 }
348
349
357 @Override
358 public SCProductEntry fetchByGroupId_Last(long groupId,
359 OrderByComparator orderByComparator) throws SystemException {
360 int count = countByGroupId(groupId);
361
362 if (count == 0) {
363 return null;
364 }
365
366 List<SCProductEntry> list = findByGroupId(groupId, count - 1, count,
367 orderByComparator);
368
369 if (!list.isEmpty()) {
370 return list.get(0);
371 }
372
373 return null;
374 }
375
376
386 @Override
387 public SCProductEntry[] findByGroupId_PrevAndNext(long productEntryId,
388 long groupId, OrderByComparator orderByComparator)
389 throws NoSuchProductEntryException, SystemException {
390 SCProductEntry scProductEntry = findByPrimaryKey(productEntryId);
391
392 Session session = null;
393
394 try {
395 session = openSession();
396
397 SCProductEntry[] array = new SCProductEntryImpl[3];
398
399 array[0] = getByGroupId_PrevAndNext(session, scProductEntry,
400 groupId, orderByComparator, true);
401
402 array[1] = scProductEntry;
403
404 array[2] = getByGroupId_PrevAndNext(session, scProductEntry,
405 groupId, orderByComparator, false);
406
407 return array;
408 }
409 catch (Exception e) {
410 throw processException(e);
411 }
412 finally {
413 closeSession(session);
414 }
415 }
416
417 protected SCProductEntry getByGroupId_PrevAndNext(Session session,
418 SCProductEntry scProductEntry, long groupId,
419 OrderByComparator orderByComparator, boolean previous) {
420 StringBundler query = null;
421
422 if (orderByComparator != null) {
423 query = new StringBundler(6 +
424 (orderByComparator.getOrderByFields().length * 6));
425 }
426 else {
427 query = new StringBundler(3);
428 }
429
430 query.append(_SQL_SELECT_SCPRODUCTENTRY_WHERE);
431
432 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
433
434 if (orderByComparator != null) {
435 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
436
437 if (orderByConditionFields.length > 0) {
438 query.append(WHERE_AND);
439 }
440
441 for (int i = 0; i < orderByConditionFields.length; i++) {
442 query.append(_ORDER_BY_ENTITY_ALIAS);
443 query.append(orderByConditionFields[i]);
444
445 if ((i + 1) < orderByConditionFields.length) {
446 if (orderByComparator.isAscending() ^ previous) {
447 query.append(WHERE_GREATER_THAN_HAS_NEXT);
448 }
449 else {
450 query.append(WHERE_LESSER_THAN_HAS_NEXT);
451 }
452 }
453 else {
454 if (orderByComparator.isAscending() ^ previous) {
455 query.append(WHERE_GREATER_THAN);
456 }
457 else {
458 query.append(WHERE_LESSER_THAN);
459 }
460 }
461 }
462
463 query.append(ORDER_BY_CLAUSE);
464
465 String[] orderByFields = orderByComparator.getOrderByFields();
466
467 for (int i = 0; i < orderByFields.length; i++) {
468 query.append(_ORDER_BY_ENTITY_ALIAS);
469 query.append(orderByFields[i]);
470
471 if ((i + 1) < orderByFields.length) {
472 if (orderByComparator.isAscending() ^ previous) {
473 query.append(ORDER_BY_ASC_HAS_NEXT);
474 }
475 else {
476 query.append(ORDER_BY_DESC_HAS_NEXT);
477 }
478 }
479 else {
480 if (orderByComparator.isAscending() ^ previous) {
481 query.append(ORDER_BY_ASC);
482 }
483 else {
484 query.append(ORDER_BY_DESC);
485 }
486 }
487 }
488 }
489 else {
490 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
491 }
492
493 String sql = query.toString();
494
495 Query q = session.createQuery(sql);
496
497 q.setFirstResult(0);
498 q.setMaxResults(2);
499
500 QueryPos qPos = QueryPos.getInstance(q);
501
502 qPos.add(groupId);
503
504 if (orderByComparator != null) {
505 Object[] values = orderByComparator.getOrderByConditionValues(scProductEntry);
506
507 for (Object value : values) {
508 qPos.add(value);
509 }
510 }
511
512 List<SCProductEntry> list = q.list();
513
514 if (list.size() == 2) {
515 return list.get(1);
516 }
517 else {
518 return null;
519 }
520 }
521
522
529 @Override
530 public List<SCProductEntry> filterFindByGroupId(long groupId)
531 throws SystemException {
532 return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
533 QueryUtil.ALL_POS, null);
534 }
535
536
549 @Override
550 public List<SCProductEntry> filterFindByGroupId(long groupId, int start,
551 int end) throws SystemException {
552 return filterFindByGroupId(groupId, start, end, null);
553 }
554
555
569 @Override
570 public List<SCProductEntry> filterFindByGroupId(long groupId, int start,
571 int end, OrderByComparator orderByComparator) throws SystemException {
572 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
573 return findByGroupId(groupId, start, end, orderByComparator);
574 }
575
576 StringBundler query = null;
577
578 if (orderByComparator != null) {
579 query = new StringBundler(3 +
580 (orderByComparator.getOrderByFields().length * 3));
581 }
582 else {
583 query = new StringBundler(3);
584 }
585
586 if (getDB().isSupportsInlineDistinct()) {
587 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_WHERE);
588 }
589 else {
590 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_1);
591 }
592
593 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
594
595 if (!getDB().isSupportsInlineDistinct()) {
596 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_2);
597 }
598
599 if (orderByComparator != null) {
600 if (getDB().isSupportsInlineDistinct()) {
601 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
602 orderByComparator, true);
603 }
604 else {
605 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
606 orderByComparator, true);
607 }
608 }
609 else {
610 if (getDB().isSupportsInlineDistinct()) {
611 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
612 }
613 else {
614 query.append(SCProductEntryModelImpl.ORDER_BY_SQL);
615 }
616 }
617
618 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
619 SCProductEntry.class.getName(),
620 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
621
622 Session session = null;
623
624 try {
625 session = openSession();
626
627 SQLQuery q = session.createSQLQuery(sql);
628
629 if (getDB().isSupportsInlineDistinct()) {
630 q.addEntity(_FILTER_ENTITY_ALIAS, SCProductEntryImpl.class);
631 }
632 else {
633 q.addEntity(_FILTER_ENTITY_TABLE, SCProductEntryImpl.class);
634 }
635
636 QueryPos qPos = QueryPos.getInstance(q);
637
638 qPos.add(groupId);
639
640 return (List<SCProductEntry>)QueryUtil.list(q, getDialect(), start,
641 end);
642 }
643 catch (Exception e) {
644 throw processException(e);
645 }
646 finally {
647 closeSession(session);
648 }
649 }
650
651
661 @Override
662 public SCProductEntry[] filterFindByGroupId_PrevAndNext(
663 long productEntryId, long groupId, OrderByComparator orderByComparator)
664 throws NoSuchProductEntryException, SystemException {
665 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
666 return findByGroupId_PrevAndNext(productEntryId, groupId,
667 orderByComparator);
668 }
669
670 SCProductEntry scProductEntry = findByPrimaryKey(productEntryId);
671
672 Session session = null;
673
674 try {
675 session = openSession();
676
677 SCProductEntry[] array = new SCProductEntryImpl[3];
678
679 array[0] = filterGetByGroupId_PrevAndNext(session, scProductEntry,
680 groupId, orderByComparator, true);
681
682 array[1] = scProductEntry;
683
684 array[2] = filterGetByGroupId_PrevAndNext(session, scProductEntry,
685 groupId, orderByComparator, false);
686
687 return array;
688 }
689 catch (Exception e) {
690 throw processException(e);
691 }
692 finally {
693 closeSession(session);
694 }
695 }
696
697 protected SCProductEntry filterGetByGroupId_PrevAndNext(Session session,
698 SCProductEntry scProductEntry, long groupId,
699 OrderByComparator orderByComparator, boolean previous) {
700 StringBundler query = null;
701
702 if (orderByComparator != null) {
703 query = new StringBundler(6 +
704 (orderByComparator.getOrderByFields().length * 6));
705 }
706 else {
707 query = new StringBundler(3);
708 }
709
710 if (getDB().isSupportsInlineDistinct()) {
711 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_WHERE);
712 }
713 else {
714 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_1);
715 }
716
717 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
718
719 if (!getDB().isSupportsInlineDistinct()) {
720 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_2);
721 }
722
723 if (orderByComparator != null) {
724 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
725
726 if (orderByConditionFields.length > 0) {
727 query.append(WHERE_AND);
728 }
729
730 for (int i = 0; i < orderByConditionFields.length; i++) {
731 if (getDB().isSupportsInlineDistinct()) {
732 query.append(_ORDER_BY_ENTITY_ALIAS);
733 }
734 else {
735 query.append(_ORDER_BY_ENTITY_TABLE);
736 }
737
738 query.append(orderByConditionFields[i]);
739
740 if ((i + 1) < orderByConditionFields.length) {
741 if (orderByComparator.isAscending() ^ previous) {
742 query.append(WHERE_GREATER_THAN_HAS_NEXT);
743 }
744 else {
745 query.append(WHERE_LESSER_THAN_HAS_NEXT);
746 }
747 }
748 else {
749 if (orderByComparator.isAscending() ^ previous) {
750 query.append(WHERE_GREATER_THAN);
751 }
752 else {
753 query.append(WHERE_LESSER_THAN);
754 }
755 }
756 }
757
758 query.append(ORDER_BY_CLAUSE);
759
760 String[] orderByFields = orderByComparator.getOrderByFields();
761
762 for (int i = 0; i < orderByFields.length; i++) {
763 if (getDB().isSupportsInlineDistinct()) {
764 query.append(_ORDER_BY_ENTITY_ALIAS);
765 }
766 else {
767 query.append(_ORDER_BY_ENTITY_TABLE);
768 }
769
770 query.append(orderByFields[i]);
771
772 if ((i + 1) < orderByFields.length) {
773 if (orderByComparator.isAscending() ^ previous) {
774 query.append(ORDER_BY_ASC_HAS_NEXT);
775 }
776 else {
777 query.append(ORDER_BY_DESC_HAS_NEXT);
778 }
779 }
780 else {
781 if (orderByComparator.isAscending() ^ previous) {
782 query.append(ORDER_BY_ASC);
783 }
784 else {
785 query.append(ORDER_BY_DESC);
786 }
787 }
788 }
789 }
790 else {
791 if (getDB().isSupportsInlineDistinct()) {
792 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
793 }
794 else {
795 query.append(SCProductEntryModelImpl.ORDER_BY_SQL);
796 }
797 }
798
799 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
800 SCProductEntry.class.getName(),
801 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
802
803 SQLQuery q = session.createSQLQuery(sql);
804
805 q.setFirstResult(0);
806 q.setMaxResults(2);
807
808 if (getDB().isSupportsInlineDistinct()) {
809 q.addEntity(_FILTER_ENTITY_ALIAS, SCProductEntryImpl.class);
810 }
811 else {
812 q.addEntity(_FILTER_ENTITY_TABLE, SCProductEntryImpl.class);
813 }
814
815 QueryPos qPos = QueryPos.getInstance(q);
816
817 qPos.add(groupId);
818
819 if (orderByComparator != null) {
820 Object[] values = orderByComparator.getOrderByConditionValues(scProductEntry);
821
822 for (Object value : values) {
823 qPos.add(value);
824 }
825 }
826
827 List<SCProductEntry> list = q.list();
828
829 if (list.size() == 2) {
830 return list.get(1);
831 }
832 else {
833 return null;
834 }
835 }
836
837
843 @Override
844 public void removeByGroupId(long groupId) throws SystemException {
845 for (SCProductEntry scProductEntry : findByGroupId(groupId,
846 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
847 remove(scProductEntry);
848 }
849 }
850
851
858 @Override
859 public int countByGroupId(long groupId) throws SystemException {
860 FinderPath finderPath = FINDER_PATH_COUNT_BY_GROUPID;
861
862 Object[] finderArgs = new Object[] { groupId };
863
864 Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
865 this);
866
867 if (count == null) {
868 StringBundler query = new StringBundler(2);
869
870 query.append(_SQL_COUNT_SCPRODUCTENTRY_WHERE);
871
872 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
873
874 String sql = query.toString();
875
876 Session session = null;
877
878 try {
879 session = openSession();
880
881 Query q = session.createQuery(sql);
882
883 QueryPos qPos = QueryPos.getInstance(q);
884
885 qPos.add(groupId);
886
887 count = (Long)q.uniqueResult();
888
889 FinderCacheUtil.putResult(finderPath, finderArgs, count);
890 }
891 catch (Exception e) {
892 FinderCacheUtil.removeResult(finderPath, finderArgs);
893
894 throw processException(e);
895 }
896 finally {
897 closeSession(session);
898 }
899 }
900
901 return count.intValue();
902 }
903
904
911 @Override
912 public int filterCountByGroupId(long groupId) throws SystemException {
913 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
914 return countByGroupId(groupId);
915 }
916
917 StringBundler query = new StringBundler(2);
918
919 query.append(_FILTER_SQL_COUNT_SCPRODUCTENTRY_WHERE);
920
921 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
922
923 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
924 SCProductEntry.class.getName(),
925 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
926
927 Session session = null;
928
929 try {
930 session = openSession();
931
932 SQLQuery q = session.createSQLQuery(sql);
933
934 q.addScalar(COUNT_COLUMN_NAME,
935 com.liferay.portal.kernel.dao.orm.Type.LONG);
936
937 QueryPos qPos = QueryPos.getInstance(q);
938
939 qPos.add(groupId);
940
941 Long count = (Long)q.uniqueResult();
942
943 return count.intValue();
944 }
945 catch (Exception e) {
946 throw processException(e);
947 }
948 finally {
949 closeSession(session);
950 }
951 }
952
953 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "scProductEntry.groupId = ?";
954 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID =
955 new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
956 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
957 SCProductEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
958 "findByCompanyId",
959 new String[] {
960 Long.class.getName(),
961
962 Integer.class.getName(), Integer.class.getName(),
963 OrderByComparator.class.getName()
964 });
965 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID =
966 new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
967 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
968 SCProductEntryImpl.class,
969 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByCompanyId",
970 new String[] { Long.class.getName() },
971 SCProductEntryModelImpl.COMPANYID_COLUMN_BITMASK |
972 SCProductEntryModelImpl.MODIFIEDDATE_COLUMN_BITMASK |
973 SCProductEntryModelImpl.NAME_COLUMN_BITMASK);
974 public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
975 SCProductEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
976 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByCompanyId",
977 new String[] { Long.class.getName() });
978
979
986 @Override
987 public List<SCProductEntry> findByCompanyId(long companyId)
988 throws SystemException {
989 return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
990 null);
991 }
992
993
1006 @Override
1007 public List<SCProductEntry> findByCompanyId(long companyId, int start,
1008 int end) throws SystemException {
1009 return findByCompanyId(companyId, start, end, null);
1010 }
1011
1012
1026 @Override
1027 public List<SCProductEntry> findByCompanyId(long companyId, int start,
1028 int end, OrderByComparator orderByComparator) throws SystemException {
1029 boolean pagination = true;
1030 FinderPath finderPath = null;
1031 Object[] finderArgs = null;
1032
1033 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1034 (orderByComparator == null)) {
1035 pagination = false;
1036 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID;
1037 finderArgs = new Object[] { companyId };
1038 }
1039 else {
1040 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID;
1041 finderArgs = new Object[] { companyId, start, end, orderByComparator };
1042 }
1043
1044 List<SCProductEntry> list = (List<SCProductEntry>)FinderCacheUtil.getResult(finderPath,
1045 finderArgs, this);
1046
1047 if ((list != null) && !list.isEmpty()) {
1048 for (SCProductEntry scProductEntry : list) {
1049 if ((companyId != scProductEntry.getCompanyId())) {
1050 list = null;
1051
1052 break;
1053 }
1054 }
1055 }
1056
1057 if (list == null) {
1058 StringBundler query = null;
1059
1060 if (orderByComparator != null) {
1061 query = new StringBundler(3 +
1062 (orderByComparator.getOrderByFields().length * 3));
1063 }
1064 else {
1065 query = new StringBundler(3);
1066 }
1067
1068 query.append(_SQL_SELECT_SCPRODUCTENTRY_WHERE);
1069
1070 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1071
1072 if (orderByComparator != null) {
1073 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1074 orderByComparator);
1075 }
1076 else
1077 if (pagination) {
1078 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
1079 }
1080
1081 String sql = query.toString();
1082
1083 Session session = null;
1084
1085 try {
1086 session = openSession();
1087
1088 Query q = session.createQuery(sql);
1089
1090 QueryPos qPos = QueryPos.getInstance(q);
1091
1092 qPos.add(companyId);
1093
1094 if (!pagination) {
1095 list = (List<SCProductEntry>)QueryUtil.list(q,
1096 getDialect(), start, end, false);
1097
1098 Collections.sort(list);
1099
1100 list = new UnmodifiableList<SCProductEntry>(list);
1101 }
1102 else {
1103 list = (List<SCProductEntry>)QueryUtil.list(q,
1104 getDialect(), start, end);
1105 }
1106
1107 cacheResult(list);
1108
1109 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1110 }
1111 catch (Exception e) {
1112 FinderCacheUtil.removeResult(finderPath, finderArgs);
1113
1114 throw processException(e);
1115 }
1116 finally {
1117 closeSession(session);
1118 }
1119 }
1120
1121 return list;
1122 }
1123
1124
1133 @Override
1134 public SCProductEntry findByCompanyId_First(long companyId,
1135 OrderByComparator orderByComparator)
1136 throws NoSuchProductEntryException, SystemException {
1137 SCProductEntry scProductEntry = fetchByCompanyId_First(companyId,
1138 orderByComparator);
1139
1140 if (scProductEntry != null) {
1141 return scProductEntry;
1142 }
1143
1144 StringBundler msg = new StringBundler(4);
1145
1146 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1147
1148 msg.append("companyId=");
1149 msg.append(companyId);
1150
1151 msg.append(StringPool.CLOSE_CURLY_BRACE);
1152
1153 throw new NoSuchProductEntryException(msg.toString());
1154 }
1155
1156
1164 @Override
1165 public SCProductEntry fetchByCompanyId_First(long companyId,
1166 OrderByComparator orderByComparator) throws SystemException {
1167 List<SCProductEntry> list = findByCompanyId(companyId, 0, 1,
1168 orderByComparator);
1169
1170 if (!list.isEmpty()) {
1171 return list.get(0);
1172 }
1173
1174 return null;
1175 }
1176
1177
1186 @Override
1187 public SCProductEntry findByCompanyId_Last(long companyId,
1188 OrderByComparator orderByComparator)
1189 throws NoSuchProductEntryException, SystemException {
1190 SCProductEntry scProductEntry = fetchByCompanyId_Last(companyId,
1191 orderByComparator);
1192
1193 if (scProductEntry != null) {
1194 return scProductEntry;
1195 }
1196
1197 StringBundler msg = new StringBundler(4);
1198
1199 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1200
1201 msg.append("companyId=");
1202 msg.append(companyId);
1203
1204 msg.append(StringPool.CLOSE_CURLY_BRACE);
1205
1206 throw new NoSuchProductEntryException(msg.toString());
1207 }
1208
1209
1217 @Override
1218 public SCProductEntry fetchByCompanyId_Last(long companyId,
1219 OrderByComparator orderByComparator) throws SystemException {
1220 int count = countByCompanyId(companyId);
1221
1222 if (count == 0) {
1223 return null;
1224 }
1225
1226 List<SCProductEntry> list = findByCompanyId(companyId, count - 1,
1227 count, orderByComparator);
1228
1229 if (!list.isEmpty()) {
1230 return list.get(0);
1231 }
1232
1233 return null;
1234 }
1235
1236
1246 @Override
1247 public SCProductEntry[] findByCompanyId_PrevAndNext(long productEntryId,
1248 long companyId, OrderByComparator orderByComparator)
1249 throws NoSuchProductEntryException, SystemException {
1250 SCProductEntry scProductEntry = findByPrimaryKey(productEntryId);
1251
1252 Session session = null;
1253
1254 try {
1255 session = openSession();
1256
1257 SCProductEntry[] array = new SCProductEntryImpl[3];
1258
1259 array[0] = getByCompanyId_PrevAndNext(session, scProductEntry,
1260 companyId, orderByComparator, true);
1261
1262 array[1] = scProductEntry;
1263
1264 array[2] = getByCompanyId_PrevAndNext(session, scProductEntry,
1265 companyId, orderByComparator, false);
1266
1267 return array;
1268 }
1269 catch (Exception e) {
1270 throw processException(e);
1271 }
1272 finally {
1273 closeSession(session);
1274 }
1275 }
1276
1277 protected SCProductEntry getByCompanyId_PrevAndNext(Session session,
1278 SCProductEntry scProductEntry, long companyId,
1279 OrderByComparator orderByComparator, boolean previous) {
1280 StringBundler query = null;
1281
1282 if (orderByComparator != null) {
1283 query = new StringBundler(6 +
1284 (orderByComparator.getOrderByFields().length * 6));
1285 }
1286 else {
1287 query = new StringBundler(3);
1288 }
1289
1290 query.append(_SQL_SELECT_SCPRODUCTENTRY_WHERE);
1291
1292 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1293
1294 if (orderByComparator != null) {
1295 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1296
1297 if (orderByConditionFields.length > 0) {
1298 query.append(WHERE_AND);
1299 }
1300
1301 for (int i = 0; i < orderByConditionFields.length; i++) {
1302 query.append(_ORDER_BY_ENTITY_ALIAS);
1303 query.append(orderByConditionFields[i]);
1304
1305 if ((i + 1) < orderByConditionFields.length) {
1306 if (orderByComparator.isAscending() ^ previous) {
1307 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1308 }
1309 else {
1310 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1311 }
1312 }
1313 else {
1314 if (orderByComparator.isAscending() ^ previous) {
1315 query.append(WHERE_GREATER_THAN);
1316 }
1317 else {
1318 query.append(WHERE_LESSER_THAN);
1319 }
1320 }
1321 }
1322
1323 query.append(ORDER_BY_CLAUSE);
1324
1325 String[] orderByFields = orderByComparator.getOrderByFields();
1326
1327 for (int i = 0; i < orderByFields.length; i++) {
1328 query.append(_ORDER_BY_ENTITY_ALIAS);
1329 query.append(orderByFields[i]);
1330
1331 if ((i + 1) < orderByFields.length) {
1332 if (orderByComparator.isAscending() ^ previous) {
1333 query.append(ORDER_BY_ASC_HAS_NEXT);
1334 }
1335 else {
1336 query.append(ORDER_BY_DESC_HAS_NEXT);
1337 }
1338 }
1339 else {
1340 if (orderByComparator.isAscending() ^ previous) {
1341 query.append(ORDER_BY_ASC);
1342 }
1343 else {
1344 query.append(ORDER_BY_DESC);
1345 }
1346 }
1347 }
1348 }
1349 else {
1350 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
1351 }
1352
1353 String sql = query.toString();
1354
1355 Query q = session.createQuery(sql);
1356
1357 q.setFirstResult(0);
1358 q.setMaxResults(2);
1359
1360 QueryPos qPos = QueryPos.getInstance(q);
1361
1362 qPos.add(companyId);
1363
1364 if (orderByComparator != null) {
1365 Object[] values = orderByComparator.getOrderByConditionValues(scProductEntry);
1366
1367 for (Object value : values) {
1368 qPos.add(value);
1369 }
1370 }
1371
1372 List<SCProductEntry> list = q.list();
1373
1374 if (list.size() == 2) {
1375 return list.get(1);
1376 }
1377 else {
1378 return null;
1379 }
1380 }
1381
1382
1388 @Override
1389 public void removeByCompanyId(long companyId) throws SystemException {
1390 for (SCProductEntry scProductEntry : findByCompanyId(companyId,
1391 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
1392 remove(scProductEntry);
1393 }
1394 }
1395
1396
1403 @Override
1404 public int countByCompanyId(long companyId) throws SystemException {
1405 FinderPath finderPath = FINDER_PATH_COUNT_BY_COMPANYID;
1406
1407 Object[] finderArgs = new Object[] { companyId };
1408
1409 Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
1410 this);
1411
1412 if (count == null) {
1413 StringBundler query = new StringBundler(2);
1414
1415 query.append(_SQL_COUNT_SCPRODUCTENTRY_WHERE);
1416
1417 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1418
1419 String sql = query.toString();
1420
1421 Session session = null;
1422
1423 try {
1424 session = openSession();
1425
1426 Query q = session.createQuery(sql);
1427
1428 QueryPos qPos = QueryPos.getInstance(q);
1429
1430 qPos.add(companyId);
1431
1432 count = (Long)q.uniqueResult();
1433
1434 FinderCacheUtil.putResult(finderPath, finderArgs, count);
1435 }
1436 catch (Exception e) {
1437 FinderCacheUtil.removeResult(finderPath, finderArgs);
1438
1439 throw processException(e);
1440 }
1441 finally {
1442 closeSession(session);
1443 }
1444 }
1445
1446 return count.intValue();
1447 }
1448
1449 private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "scProductEntry.companyId = ?";
1450 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_U = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
1451 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
1452 SCProductEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
1453 "findByG_U",
1454 new String[] {
1455 Long.class.getName(), Long.class.getName(),
1456
1457 Integer.class.getName(), Integer.class.getName(),
1458 OrderByComparator.class.getName()
1459 });
1460 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
1461 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
1462 SCProductEntryImpl.class,
1463 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_U",
1464 new String[] { Long.class.getName(), Long.class.getName() },
1465 SCProductEntryModelImpl.GROUPID_COLUMN_BITMASK |
1466 SCProductEntryModelImpl.USERID_COLUMN_BITMASK |
1467 SCProductEntryModelImpl.MODIFIEDDATE_COLUMN_BITMASK |
1468 SCProductEntryModelImpl.NAME_COLUMN_BITMASK);
1469 public static final FinderPath FINDER_PATH_COUNT_BY_G_U = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
1470 SCProductEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
1471 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_U",
1472 new String[] { Long.class.getName(), Long.class.getName() });
1473
1474
1482 @Override
1483 public List<SCProductEntry> findByG_U(long groupId, long userId)
1484 throws SystemException {
1485 return findByG_U(groupId, userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1486 null);
1487 }
1488
1489
1503 @Override
1504 public List<SCProductEntry> findByG_U(long groupId, long userId, int start,
1505 int end) throws SystemException {
1506 return findByG_U(groupId, userId, start, end, null);
1507 }
1508
1509
1524 @Override
1525 public List<SCProductEntry> findByG_U(long groupId, long userId, int start,
1526 int end, OrderByComparator orderByComparator) throws SystemException {
1527 boolean pagination = true;
1528 FinderPath finderPath = null;
1529 Object[] finderArgs = null;
1530
1531 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1532 (orderByComparator == null)) {
1533 pagination = false;
1534 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U;
1535 finderArgs = new Object[] { groupId, userId };
1536 }
1537 else {
1538 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_U;
1539 finderArgs = new Object[] {
1540 groupId, userId,
1541
1542 start, end, orderByComparator
1543 };
1544 }
1545
1546 List<SCProductEntry> list = (List<SCProductEntry>)FinderCacheUtil.getResult(finderPath,
1547 finderArgs, this);
1548
1549 if ((list != null) && !list.isEmpty()) {
1550 for (SCProductEntry scProductEntry : list) {
1551 if ((groupId != scProductEntry.getGroupId()) ||
1552 (userId != scProductEntry.getUserId())) {
1553 list = null;
1554
1555 break;
1556 }
1557 }
1558 }
1559
1560 if (list == null) {
1561 StringBundler query = null;
1562
1563 if (orderByComparator != null) {
1564 query = new StringBundler(4 +
1565 (orderByComparator.getOrderByFields().length * 3));
1566 }
1567 else {
1568 query = new StringBundler(4);
1569 }
1570
1571 query.append(_SQL_SELECT_SCPRODUCTENTRY_WHERE);
1572
1573 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
1574
1575 query.append(_FINDER_COLUMN_G_U_USERID_2);
1576
1577 if (orderByComparator != null) {
1578 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1579 orderByComparator);
1580 }
1581 else
1582 if (pagination) {
1583 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
1584 }
1585
1586 String sql = query.toString();
1587
1588 Session session = null;
1589
1590 try {
1591 session = openSession();
1592
1593 Query q = session.createQuery(sql);
1594
1595 QueryPos qPos = QueryPos.getInstance(q);
1596
1597 qPos.add(groupId);
1598
1599 qPos.add(userId);
1600
1601 if (!pagination) {
1602 list = (List<SCProductEntry>)QueryUtil.list(q,
1603 getDialect(), start, end, false);
1604
1605 Collections.sort(list);
1606
1607 list = new UnmodifiableList<SCProductEntry>(list);
1608 }
1609 else {
1610 list = (List<SCProductEntry>)QueryUtil.list(q,
1611 getDialect(), start, end);
1612 }
1613
1614 cacheResult(list);
1615
1616 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1617 }
1618 catch (Exception e) {
1619 FinderCacheUtil.removeResult(finderPath, finderArgs);
1620
1621 throw processException(e);
1622 }
1623 finally {
1624 closeSession(session);
1625 }
1626 }
1627
1628 return list;
1629 }
1630
1631
1641 @Override
1642 public SCProductEntry findByG_U_First(long groupId, long userId,
1643 OrderByComparator orderByComparator)
1644 throws NoSuchProductEntryException, SystemException {
1645 SCProductEntry scProductEntry = fetchByG_U_First(groupId, userId,
1646 orderByComparator);
1647
1648 if (scProductEntry != null) {
1649 return scProductEntry;
1650 }
1651
1652 StringBundler msg = new StringBundler(6);
1653
1654 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1655
1656 msg.append("groupId=");
1657 msg.append(groupId);
1658
1659 msg.append(", userId=");
1660 msg.append(userId);
1661
1662 msg.append(StringPool.CLOSE_CURLY_BRACE);
1663
1664 throw new NoSuchProductEntryException(msg.toString());
1665 }
1666
1667
1676 @Override
1677 public SCProductEntry fetchByG_U_First(long groupId, long userId,
1678 OrderByComparator orderByComparator) throws SystemException {
1679 List<SCProductEntry> list = findByG_U(groupId, userId, 0, 1,
1680 orderByComparator);
1681
1682 if (!list.isEmpty()) {
1683 return list.get(0);
1684 }
1685
1686 return null;
1687 }
1688
1689
1699 @Override
1700 public SCProductEntry findByG_U_Last(long groupId, long userId,
1701 OrderByComparator orderByComparator)
1702 throws NoSuchProductEntryException, SystemException {
1703 SCProductEntry scProductEntry = fetchByG_U_Last(groupId, userId,
1704 orderByComparator);
1705
1706 if (scProductEntry != null) {
1707 return scProductEntry;
1708 }
1709
1710 StringBundler msg = new StringBundler(6);
1711
1712 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1713
1714 msg.append("groupId=");
1715 msg.append(groupId);
1716
1717 msg.append(", userId=");
1718 msg.append(userId);
1719
1720 msg.append(StringPool.CLOSE_CURLY_BRACE);
1721
1722 throw new NoSuchProductEntryException(msg.toString());
1723 }
1724
1725
1734 @Override
1735 public SCProductEntry fetchByG_U_Last(long groupId, long userId,
1736 OrderByComparator orderByComparator) throws SystemException {
1737 int count = countByG_U(groupId, userId);
1738
1739 if (count == 0) {
1740 return null;
1741 }
1742
1743 List<SCProductEntry> list = findByG_U(groupId, userId, count - 1,
1744 count, orderByComparator);
1745
1746 if (!list.isEmpty()) {
1747 return list.get(0);
1748 }
1749
1750 return null;
1751 }
1752
1753
1764 @Override
1765 public SCProductEntry[] findByG_U_PrevAndNext(long productEntryId,
1766 long groupId, long userId, OrderByComparator orderByComparator)
1767 throws NoSuchProductEntryException, SystemException {
1768 SCProductEntry scProductEntry = findByPrimaryKey(productEntryId);
1769
1770 Session session = null;
1771
1772 try {
1773 session = openSession();
1774
1775 SCProductEntry[] array = new SCProductEntryImpl[3];
1776
1777 array[0] = getByG_U_PrevAndNext(session, scProductEntry, groupId,
1778 userId, orderByComparator, true);
1779
1780 array[1] = scProductEntry;
1781
1782 array[2] = getByG_U_PrevAndNext(session, scProductEntry, groupId,
1783 userId, orderByComparator, false);
1784
1785 return array;
1786 }
1787 catch (Exception e) {
1788 throw processException(e);
1789 }
1790 finally {
1791 closeSession(session);
1792 }
1793 }
1794
1795 protected SCProductEntry getByG_U_PrevAndNext(Session session,
1796 SCProductEntry scProductEntry, long groupId, long userId,
1797 OrderByComparator orderByComparator, boolean previous) {
1798 StringBundler query = null;
1799
1800 if (orderByComparator != null) {
1801 query = new StringBundler(6 +
1802 (orderByComparator.getOrderByFields().length * 6));
1803 }
1804 else {
1805 query = new StringBundler(3);
1806 }
1807
1808 query.append(_SQL_SELECT_SCPRODUCTENTRY_WHERE);
1809
1810 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
1811
1812 query.append(_FINDER_COLUMN_G_U_USERID_2);
1813
1814 if (orderByComparator != null) {
1815 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1816
1817 if (orderByConditionFields.length > 0) {
1818 query.append(WHERE_AND);
1819 }
1820
1821 for (int i = 0; i < orderByConditionFields.length; i++) {
1822 query.append(_ORDER_BY_ENTITY_ALIAS);
1823 query.append(orderByConditionFields[i]);
1824
1825 if ((i + 1) < orderByConditionFields.length) {
1826 if (orderByComparator.isAscending() ^ previous) {
1827 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1828 }
1829 else {
1830 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1831 }
1832 }
1833 else {
1834 if (orderByComparator.isAscending() ^ previous) {
1835 query.append(WHERE_GREATER_THAN);
1836 }
1837 else {
1838 query.append(WHERE_LESSER_THAN);
1839 }
1840 }
1841 }
1842
1843 query.append(ORDER_BY_CLAUSE);
1844
1845 String[] orderByFields = orderByComparator.getOrderByFields();
1846
1847 for (int i = 0; i < orderByFields.length; i++) {
1848 query.append(_ORDER_BY_ENTITY_ALIAS);
1849 query.append(orderByFields[i]);
1850
1851 if ((i + 1) < orderByFields.length) {
1852 if (orderByComparator.isAscending() ^ previous) {
1853 query.append(ORDER_BY_ASC_HAS_NEXT);
1854 }
1855 else {
1856 query.append(ORDER_BY_DESC_HAS_NEXT);
1857 }
1858 }
1859 else {
1860 if (orderByComparator.isAscending() ^ previous) {
1861 query.append(ORDER_BY_ASC);
1862 }
1863 else {
1864 query.append(ORDER_BY_DESC);
1865 }
1866 }
1867 }
1868 }
1869 else {
1870 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
1871 }
1872
1873 String sql = query.toString();
1874
1875 Query q = session.createQuery(sql);
1876
1877 q.setFirstResult(0);
1878 q.setMaxResults(2);
1879
1880 QueryPos qPos = QueryPos.getInstance(q);
1881
1882 qPos.add(groupId);
1883
1884 qPos.add(userId);
1885
1886 if (orderByComparator != null) {
1887 Object[] values = orderByComparator.getOrderByConditionValues(scProductEntry);
1888
1889 for (Object value : values) {
1890 qPos.add(value);
1891 }
1892 }
1893
1894 List<SCProductEntry> list = q.list();
1895
1896 if (list.size() == 2) {
1897 return list.get(1);
1898 }
1899 else {
1900 return null;
1901 }
1902 }
1903
1904
1912 @Override
1913 public List<SCProductEntry> filterFindByG_U(long groupId, long userId)
1914 throws SystemException {
1915 return filterFindByG_U(groupId, userId, QueryUtil.ALL_POS,
1916 QueryUtil.ALL_POS, null);
1917 }
1918
1919
1933 @Override
1934 public List<SCProductEntry> filterFindByG_U(long groupId, long userId,
1935 int start, int end) throws SystemException {
1936 return filterFindByG_U(groupId, userId, start, end, null);
1937 }
1938
1939
1954 @Override
1955 public List<SCProductEntry> filterFindByG_U(long groupId, long userId,
1956 int start, int end, OrderByComparator orderByComparator)
1957 throws SystemException {
1958 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1959 return findByG_U(groupId, userId, start, end, orderByComparator);
1960 }
1961
1962 StringBundler query = null;
1963
1964 if (orderByComparator != null) {
1965 query = new StringBundler(4 +
1966 (orderByComparator.getOrderByFields().length * 3));
1967 }
1968 else {
1969 query = new StringBundler(4);
1970 }
1971
1972 if (getDB().isSupportsInlineDistinct()) {
1973 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_WHERE);
1974 }
1975 else {
1976 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_1);
1977 }
1978
1979 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
1980
1981 query.append(_FINDER_COLUMN_G_U_USERID_2);
1982
1983 if (!getDB().isSupportsInlineDistinct()) {
1984 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_2);
1985 }
1986
1987 if (orderByComparator != null) {
1988 if (getDB().isSupportsInlineDistinct()) {
1989 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1990 orderByComparator, true);
1991 }
1992 else {
1993 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1994 orderByComparator, true);
1995 }
1996 }
1997 else {
1998 if (getDB().isSupportsInlineDistinct()) {
1999 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
2000 }
2001 else {
2002 query.append(SCProductEntryModelImpl.ORDER_BY_SQL);
2003 }
2004 }
2005
2006 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2007 SCProductEntry.class.getName(),
2008 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
2009
2010 Session session = null;
2011
2012 try {
2013 session = openSession();
2014
2015 SQLQuery q = session.createSQLQuery(sql);
2016
2017 if (getDB().isSupportsInlineDistinct()) {
2018 q.addEntity(_FILTER_ENTITY_ALIAS, SCProductEntryImpl.class);
2019 }
2020 else {
2021 q.addEntity(_FILTER_ENTITY_TABLE, SCProductEntryImpl.class);
2022 }
2023
2024 QueryPos qPos = QueryPos.getInstance(q);
2025
2026 qPos.add(groupId);
2027
2028 qPos.add(userId);
2029
2030 return (List<SCProductEntry>)QueryUtil.list(q, getDialect(), start,
2031 end);
2032 }
2033 catch (Exception e) {
2034 throw processException(e);
2035 }
2036 finally {
2037 closeSession(session);
2038 }
2039 }
2040
2041
2052 @Override
2053 public SCProductEntry[] filterFindByG_U_PrevAndNext(long productEntryId,
2054 long groupId, long userId, OrderByComparator orderByComparator)
2055 throws NoSuchProductEntryException, SystemException {
2056 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2057 return findByG_U_PrevAndNext(productEntryId, groupId, userId,
2058 orderByComparator);
2059 }
2060
2061 SCProductEntry scProductEntry = findByPrimaryKey(productEntryId);
2062
2063 Session session = null;
2064
2065 try {
2066 session = openSession();
2067
2068 SCProductEntry[] array = new SCProductEntryImpl[3];
2069
2070 array[0] = filterGetByG_U_PrevAndNext(session, scProductEntry,
2071 groupId, userId, orderByComparator, true);
2072
2073 array[1] = scProductEntry;
2074
2075 array[2] = filterGetByG_U_PrevAndNext(session, scProductEntry,
2076 groupId, userId, orderByComparator, false);
2077
2078 return array;
2079 }
2080 catch (Exception e) {
2081 throw processException(e);
2082 }
2083 finally {
2084 closeSession(session);
2085 }
2086 }
2087
2088 protected SCProductEntry filterGetByG_U_PrevAndNext(Session session,
2089 SCProductEntry scProductEntry, long groupId, long userId,
2090 OrderByComparator orderByComparator, boolean previous) {
2091 StringBundler query = null;
2092
2093 if (orderByComparator != null) {
2094 query = new StringBundler(6 +
2095 (orderByComparator.getOrderByFields().length * 6));
2096 }
2097 else {
2098 query = new StringBundler(3);
2099 }
2100
2101 if (getDB().isSupportsInlineDistinct()) {
2102 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_WHERE);
2103 }
2104 else {
2105 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_1);
2106 }
2107
2108 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
2109
2110 query.append(_FINDER_COLUMN_G_U_USERID_2);
2111
2112 if (!getDB().isSupportsInlineDistinct()) {
2113 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_2);
2114 }
2115
2116 if (orderByComparator != null) {
2117 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2118
2119 if (orderByConditionFields.length > 0) {
2120 query.append(WHERE_AND);
2121 }
2122
2123 for (int i = 0; i < orderByConditionFields.length; i++) {
2124 if (getDB().isSupportsInlineDistinct()) {
2125 query.append(_ORDER_BY_ENTITY_ALIAS);
2126 }
2127 else {
2128 query.append(_ORDER_BY_ENTITY_TABLE);
2129 }
2130
2131 query.append(orderByConditionFields[i]);
2132
2133 if ((i + 1) < orderByConditionFields.length) {
2134 if (orderByComparator.isAscending() ^ previous) {
2135 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2136 }
2137 else {
2138 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2139 }
2140 }
2141 else {
2142 if (orderByComparator.isAscending() ^ previous) {
2143 query.append(WHERE_GREATER_THAN);
2144 }
2145 else {
2146 query.append(WHERE_LESSER_THAN);
2147 }
2148 }
2149 }
2150
2151 query.append(ORDER_BY_CLAUSE);
2152
2153 String[] orderByFields = orderByComparator.getOrderByFields();
2154
2155 for (int i = 0; i < orderByFields.length; i++) {
2156 if (getDB().isSupportsInlineDistinct()) {
2157 query.append(_ORDER_BY_ENTITY_ALIAS);
2158 }
2159 else {
2160 query.append(_ORDER_BY_ENTITY_TABLE);
2161 }
2162
2163 query.append(orderByFields[i]);
2164
2165 if ((i + 1) < orderByFields.length) {
2166 if (orderByComparator.isAscending() ^ previous) {
2167 query.append(ORDER_BY_ASC_HAS_NEXT);
2168 }
2169 else {
2170 query.append(ORDER_BY_DESC_HAS_NEXT);
2171 }
2172 }
2173 else {
2174 if (orderByComparator.isAscending() ^ previous) {
2175 query.append(ORDER_BY_ASC);
2176 }
2177 else {
2178 query.append(ORDER_BY_DESC);
2179 }
2180 }
2181 }
2182 }
2183 else {
2184 if (getDB().isSupportsInlineDistinct()) {
2185 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
2186 }
2187 else {
2188 query.append(SCProductEntryModelImpl.ORDER_BY_SQL);
2189 }
2190 }
2191
2192 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2193 SCProductEntry.class.getName(),
2194 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
2195
2196 SQLQuery q = session.createSQLQuery(sql);
2197
2198 q.setFirstResult(0);
2199 q.setMaxResults(2);
2200
2201 if (getDB().isSupportsInlineDistinct()) {
2202 q.addEntity(_FILTER_ENTITY_ALIAS, SCProductEntryImpl.class);
2203 }
2204 else {
2205 q.addEntity(_FILTER_ENTITY_TABLE, SCProductEntryImpl.class);
2206 }
2207
2208 QueryPos qPos = QueryPos.getInstance(q);
2209
2210 qPos.add(groupId);
2211
2212 qPos.add(userId);
2213
2214 if (orderByComparator != null) {
2215 Object[] values = orderByComparator.getOrderByConditionValues(scProductEntry);
2216
2217 for (Object value : values) {
2218 qPos.add(value);
2219 }
2220 }
2221
2222 List<SCProductEntry> list = q.list();
2223
2224 if (list.size() == 2) {
2225 return list.get(1);
2226 }
2227 else {
2228 return null;
2229 }
2230 }
2231
2232
2239 @Override
2240 public void removeByG_U(long groupId, long userId)
2241 throws SystemException {
2242 for (SCProductEntry scProductEntry : findByG_U(groupId, userId,
2243 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
2244 remove(scProductEntry);
2245 }
2246 }
2247
2248
2256 @Override
2257 public int countByG_U(long groupId, long userId) throws SystemException {
2258 FinderPath finderPath = FINDER_PATH_COUNT_BY_G_U;
2259
2260 Object[] finderArgs = new Object[] { groupId, userId };
2261
2262 Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
2263 this);
2264
2265 if (count == null) {
2266 StringBundler query = new StringBundler(3);
2267
2268 query.append(_SQL_COUNT_SCPRODUCTENTRY_WHERE);
2269
2270 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
2271
2272 query.append(_FINDER_COLUMN_G_U_USERID_2);
2273
2274 String sql = query.toString();
2275
2276 Session session = null;
2277
2278 try {
2279 session = openSession();
2280
2281 Query q = session.createQuery(sql);
2282
2283 QueryPos qPos = QueryPos.getInstance(q);
2284
2285 qPos.add(groupId);
2286
2287 qPos.add(userId);
2288
2289 count = (Long)q.uniqueResult();
2290
2291 FinderCacheUtil.putResult(finderPath, finderArgs, count);
2292 }
2293 catch (Exception e) {
2294 FinderCacheUtil.removeResult(finderPath, finderArgs);
2295
2296 throw processException(e);
2297 }
2298 finally {
2299 closeSession(session);
2300 }
2301 }
2302
2303 return count.intValue();
2304 }
2305
2306
2314 @Override
2315 public int filterCountByG_U(long groupId, long userId)
2316 throws SystemException {
2317 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2318 return countByG_U(groupId, userId);
2319 }
2320
2321 StringBundler query = new StringBundler(3);
2322
2323 query.append(_FILTER_SQL_COUNT_SCPRODUCTENTRY_WHERE);
2324
2325 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
2326
2327 query.append(_FINDER_COLUMN_G_U_USERID_2);
2328
2329 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2330 SCProductEntry.class.getName(),
2331 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
2332
2333 Session session = null;
2334
2335 try {
2336 session = openSession();
2337
2338 SQLQuery q = session.createSQLQuery(sql);
2339
2340 q.addScalar(COUNT_COLUMN_NAME,
2341 com.liferay.portal.kernel.dao.orm.Type.LONG);
2342
2343 QueryPos qPos = QueryPos.getInstance(q);
2344
2345 qPos.add(groupId);
2346
2347 qPos.add(userId);
2348
2349 Long count = (Long)q.uniqueResult();
2350
2351 return count.intValue();
2352 }
2353 catch (Exception e) {
2354 throw processException(e);
2355 }
2356 finally {
2357 closeSession(session);
2358 }
2359 }
2360
2361 private static final String _FINDER_COLUMN_G_U_GROUPID_2 = "scProductEntry.groupId = ? AND ";
2362 private static final String _FINDER_COLUMN_G_U_USERID_2 = "scProductEntry.userId = ?";
2363 public static final FinderPath FINDER_PATH_FETCH_BY_RG_RA = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
2364 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
2365 SCProductEntryImpl.class, FINDER_CLASS_NAME_ENTITY, "fetchByRG_RA",
2366 new String[] { String.class.getName(), String.class.getName() },
2367 SCProductEntryModelImpl.REPOGROUPID_COLUMN_BITMASK |
2368 SCProductEntryModelImpl.REPOARTIFACTID_COLUMN_BITMASK);
2369 public static final FinderPath FINDER_PATH_COUNT_BY_RG_RA = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
2370 SCProductEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
2371 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByRG_RA",
2372 new String[] { String.class.getName(), String.class.getName() });
2373
2374
2383 @Override
2384 public SCProductEntry findByRG_RA(String repoGroupId, String repoArtifactId)
2385 throws NoSuchProductEntryException, SystemException {
2386 SCProductEntry scProductEntry = fetchByRG_RA(repoGroupId, repoArtifactId);
2387
2388 if (scProductEntry == null) {
2389 StringBundler msg = new StringBundler(6);
2390
2391 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2392
2393 msg.append("repoGroupId=");
2394 msg.append(repoGroupId);
2395
2396 msg.append(", repoArtifactId=");
2397 msg.append(repoArtifactId);
2398
2399 msg.append(StringPool.CLOSE_CURLY_BRACE);
2400
2401 if (_log.isWarnEnabled()) {
2402 _log.warn(msg.toString());
2403 }
2404
2405 throw new NoSuchProductEntryException(msg.toString());
2406 }
2407
2408 return scProductEntry;
2409 }
2410
2411
2419 @Override
2420 public SCProductEntry fetchByRG_RA(String repoGroupId, String repoArtifactId)
2421 throws SystemException {
2422 return fetchByRG_RA(repoGroupId, repoArtifactId, true);
2423 }
2424
2425
2434 @Override
2435 public SCProductEntry fetchByRG_RA(String repoGroupId,
2436 String repoArtifactId, boolean retrieveFromCache)
2437 throws SystemException {
2438 Object[] finderArgs = new Object[] { repoGroupId, repoArtifactId };
2439
2440 Object result = null;
2441
2442 if (retrieveFromCache) {
2443 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_RG_RA,
2444 finderArgs, this);
2445 }
2446
2447 if (result instanceof SCProductEntry) {
2448 SCProductEntry scProductEntry = (SCProductEntry)result;
2449
2450 if (!Validator.equals(repoGroupId, scProductEntry.getRepoGroupId()) ||
2451 !Validator.equals(repoArtifactId,
2452 scProductEntry.getRepoArtifactId())) {
2453 result = null;
2454 }
2455 }
2456
2457 if (result == null) {
2458 StringBundler query = new StringBundler(4);
2459
2460 query.append(_SQL_SELECT_SCPRODUCTENTRY_WHERE);
2461
2462 boolean bindRepoGroupId = false;
2463
2464 if (repoGroupId == null) {
2465 query.append(_FINDER_COLUMN_RG_RA_REPOGROUPID_1);
2466 }
2467 else if (repoGroupId.equals(StringPool.BLANK)) {
2468 query.append(_FINDER_COLUMN_RG_RA_REPOGROUPID_3);
2469 }
2470 else {
2471 bindRepoGroupId = true;
2472
2473 query.append(_FINDER_COLUMN_RG_RA_REPOGROUPID_2);
2474 }
2475
2476 boolean bindRepoArtifactId = false;
2477
2478 if (repoArtifactId == null) {
2479 query.append(_FINDER_COLUMN_RG_RA_REPOARTIFACTID_1);
2480 }
2481 else if (repoArtifactId.equals(StringPool.BLANK)) {
2482 query.append(_FINDER_COLUMN_RG_RA_REPOARTIFACTID_3);
2483 }
2484 else {
2485 bindRepoArtifactId = true;
2486
2487 query.append(_FINDER_COLUMN_RG_RA_REPOARTIFACTID_2);
2488 }
2489
2490 String sql = query.toString();
2491
2492 Session session = null;
2493
2494 try {
2495 session = openSession();
2496
2497 Query q = session.createQuery(sql);
2498
2499 QueryPos qPos = QueryPos.getInstance(q);
2500
2501 if (bindRepoGroupId) {
2502 qPos.add(repoGroupId.toLowerCase());
2503 }
2504
2505 if (bindRepoArtifactId) {
2506 qPos.add(repoArtifactId.toLowerCase());
2507 }
2508
2509 List<SCProductEntry> list = q.list();
2510
2511 if (list.isEmpty()) {
2512 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_RG_RA,
2513 finderArgs, list);
2514 }
2515 else {
2516 if ((list.size() > 1) && _log.isWarnEnabled()) {
2517 _log.warn(
2518 "SCProductEntryPersistenceImpl.fetchByRG_RA(String, String, boolean) with parameters (" +
2519 StringUtil.merge(finderArgs) +
2520 ") yields a result set with more than 1 result. This violates the logical unique restriction. There is no order guarantee on which result is returned by this finder.");
2521 }
2522
2523 SCProductEntry scProductEntry = list.get(0);
2524
2525 result = scProductEntry;
2526
2527 cacheResult(scProductEntry);
2528
2529 if ((scProductEntry.getRepoGroupId() == null) ||
2530 !scProductEntry.getRepoGroupId().equals(repoGroupId) ||
2531 (scProductEntry.getRepoArtifactId() == null) ||
2532 !scProductEntry.getRepoArtifactId()
2533 .equals(repoArtifactId)) {
2534 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_RG_RA,
2535 finderArgs, scProductEntry);
2536 }
2537 }
2538 }
2539 catch (Exception e) {
2540 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_RG_RA,
2541 finderArgs);
2542
2543 throw processException(e);
2544 }
2545 finally {
2546 closeSession(session);
2547 }
2548 }
2549
2550 if (result instanceof List<?>) {
2551 return null;
2552 }
2553 else {
2554 return (SCProductEntry)result;
2555 }
2556 }
2557
2558
2566 @Override
2567 public SCProductEntry removeByRG_RA(String repoGroupId,
2568 String repoArtifactId)
2569 throws NoSuchProductEntryException, SystemException {
2570 SCProductEntry scProductEntry = findByRG_RA(repoGroupId, repoArtifactId);
2571
2572 return remove(scProductEntry);
2573 }
2574
2575
2583 @Override
2584 public int countByRG_RA(String repoGroupId, String repoArtifactId)
2585 throws SystemException {
2586 FinderPath finderPath = FINDER_PATH_COUNT_BY_RG_RA;
2587
2588 Object[] finderArgs = new Object[] { repoGroupId, repoArtifactId };
2589
2590 Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
2591 this);
2592
2593 if (count == null) {
2594 StringBundler query = new StringBundler(3);
2595
2596 query.append(_SQL_COUNT_SCPRODUCTENTRY_WHERE);
2597
2598 boolean bindRepoGroupId = false;
2599
2600 if (repoGroupId == null) {
2601 query.append(_FINDER_COLUMN_RG_RA_REPOGROUPID_1);
2602 }
2603 else if (repoGroupId.equals(StringPool.BLANK)) {
2604 query.append(_FINDER_COLUMN_RG_RA_REPOGROUPID_3);
2605 }
2606 else {
2607 bindRepoGroupId = true;
2608
2609 query.append(_FINDER_COLUMN_RG_RA_REPOGROUPID_2);
2610 }
2611
2612 boolean bindRepoArtifactId = false;
2613
2614 if (repoArtifactId == null) {
2615 query.append(_FINDER_COLUMN_RG_RA_REPOARTIFACTID_1);
2616 }
2617 else if (repoArtifactId.equals(StringPool.BLANK)) {
2618 query.append(_FINDER_COLUMN_RG_RA_REPOARTIFACTID_3);
2619 }
2620 else {
2621 bindRepoArtifactId = true;
2622
2623 query.append(_FINDER_COLUMN_RG_RA_REPOARTIFACTID_2);
2624 }
2625
2626 String sql = query.toString();
2627
2628 Session session = null;
2629
2630 try {
2631 session = openSession();
2632
2633 Query q = session.createQuery(sql);
2634
2635 QueryPos qPos = QueryPos.getInstance(q);
2636
2637 if (bindRepoGroupId) {
2638 qPos.add(repoGroupId.toLowerCase());
2639 }
2640
2641 if (bindRepoArtifactId) {
2642 qPos.add(repoArtifactId.toLowerCase());
2643 }
2644
2645 count = (Long)q.uniqueResult();
2646
2647 FinderCacheUtil.putResult(finderPath, finderArgs, count);
2648 }
2649 catch (Exception e) {
2650 FinderCacheUtil.removeResult(finderPath, finderArgs);
2651
2652 throw processException(e);
2653 }
2654 finally {
2655 closeSession(session);
2656 }
2657 }
2658
2659 return count.intValue();
2660 }
2661
2662 private static final String _FINDER_COLUMN_RG_RA_REPOGROUPID_1 = "scProductEntry.repoGroupId IS NULL AND ";
2663 private static final String _FINDER_COLUMN_RG_RA_REPOGROUPID_2 = "lower(scProductEntry.repoGroupId) = ? AND ";
2664 private static final String _FINDER_COLUMN_RG_RA_REPOGROUPID_3 = "(scProductEntry.repoGroupId IS NULL OR scProductEntry.repoGroupId = '') AND ";
2665 private static final String _FINDER_COLUMN_RG_RA_REPOARTIFACTID_1 = "scProductEntry.repoArtifactId IS NULL";
2666 private static final String _FINDER_COLUMN_RG_RA_REPOARTIFACTID_2 = "lower(scProductEntry.repoArtifactId) = ?";
2667 private static final String _FINDER_COLUMN_RG_RA_REPOARTIFACTID_3 = "(scProductEntry.repoArtifactId IS NULL OR scProductEntry.repoArtifactId = '')";
2668
2669
2674 @Override
2675 public void cacheResult(SCProductEntry scProductEntry) {
2676 EntityCacheUtil.putResult(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
2677 SCProductEntryImpl.class, scProductEntry.getPrimaryKey(),
2678 scProductEntry);
2679
2680 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_RG_RA,
2681 new Object[] {
2682 scProductEntry.getRepoGroupId(),
2683 scProductEntry.getRepoArtifactId()
2684 }, scProductEntry);
2685
2686 scProductEntry.resetOriginalValues();
2687 }
2688
2689
2694 @Override
2695 public void cacheResult(List<SCProductEntry> scProductEntries) {
2696 for (SCProductEntry scProductEntry : scProductEntries) {
2697 if (EntityCacheUtil.getResult(
2698 SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
2699 SCProductEntryImpl.class, scProductEntry.getPrimaryKey()) == null) {
2700 cacheResult(scProductEntry);
2701 }
2702 else {
2703 scProductEntry.resetOriginalValues();
2704 }
2705 }
2706 }
2707
2708
2715 @Override
2716 public void clearCache() {
2717 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
2718 CacheRegistryUtil.clear(SCProductEntryImpl.class.getName());
2719 }
2720
2721 EntityCacheUtil.clearCache(SCProductEntryImpl.class.getName());
2722
2723 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
2724 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
2725 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2726 }
2727
2728
2735 @Override
2736 public void clearCache(SCProductEntry scProductEntry) {
2737 EntityCacheUtil.removeResult(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
2738 SCProductEntryImpl.class, scProductEntry.getPrimaryKey());
2739
2740 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
2741 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2742
2743 clearUniqueFindersCache(scProductEntry);
2744 }
2745
2746 @Override
2747 public void clearCache(List<SCProductEntry> scProductEntries) {
2748 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
2749 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2750
2751 for (SCProductEntry scProductEntry : scProductEntries) {
2752 EntityCacheUtil.removeResult(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
2753 SCProductEntryImpl.class, scProductEntry.getPrimaryKey());
2754
2755 clearUniqueFindersCache(scProductEntry);
2756 }
2757 }
2758
2759 protected void cacheUniqueFindersCache(SCProductEntry scProductEntry) {
2760 if (scProductEntry.isNew()) {
2761 Object[] args = new Object[] {
2762 scProductEntry.getRepoGroupId(),
2763 scProductEntry.getRepoArtifactId()
2764 };
2765
2766 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_RG_RA, args,
2767 Long.valueOf(1));
2768 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_RG_RA, args,
2769 scProductEntry);
2770 }
2771 else {
2772 SCProductEntryModelImpl scProductEntryModelImpl = (SCProductEntryModelImpl)scProductEntry;
2773
2774 if ((scProductEntryModelImpl.getColumnBitmask() &
2775 FINDER_PATH_FETCH_BY_RG_RA.getColumnBitmask()) != 0) {
2776 Object[] args = new Object[] {
2777 scProductEntry.getRepoGroupId(),
2778 scProductEntry.getRepoArtifactId()
2779 };
2780
2781 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_RG_RA, args,
2782 Long.valueOf(1));
2783 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_RG_RA, args,
2784 scProductEntry);
2785 }
2786 }
2787 }
2788
2789 protected void clearUniqueFindersCache(SCProductEntry scProductEntry) {
2790 SCProductEntryModelImpl scProductEntryModelImpl = (SCProductEntryModelImpl)scProductEntry;
2791
2792 Object[] args = new Object[] {
2793 scProductEntry.getRepoGroupId(),
2794 scProductEntry.getRepoArtifactId()
2795 };
2796
2797 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_RG_RA, args);
2798 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_RG_RA, args);
2799
2800 if ((scProductEntryModelImpl.getColumnBitmask() &
2801 FINDER_PATH_FETCH_BY_RG_RA.getColumnBitmask()) != 0) {
2802 args = new Object[] {
2803 scProductEntryModelImpl.getOriginalRepoGroupId(),
2804 scProductEntryModelImpl.getOriginalRepoArtifactId()
2805 };
2806
2807 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_RG_RA, args);
2808 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_RG_RA, args);
2809 }
2810 }
2811
2812
2818 @Override
2819 public SCProductEntry create(long productEntryId) {
2820 SCProductEntry scProductEntry = new SCProductEntryImpl();
2821
2822 scProductEntry.setNew(true);
2823 scProductEntry.setPrimaryKey(productEntryId);
2824
2825 return scProductEntry;
2826 }
2827
2828
2836 @Override
2837 public SCProductEntry remove(long productEntryId)
2838 throws NoSuchProductEntryException, SystemException {
2839 return remove((Serializable)productEntryId);
2840 }
2841
2842
2850 @Override
2851 public SCProductEntry remove(Serializable primaryKey)
2852 throws NoSuchProductEntryException, SystemException {
2853 Session session = null;
2854
2855 try {
2856 session = openSession();
2857
2858 SCProductEntry scProductEntry = (SCProductEntry)session.get(SCProductEntryImpl.class,
2859 primaryKey);
2860
2861 if (scProductEntry == null) {
2862 if (_log.isWarnEnabled()) {
2863 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
2864 }
2865
2866 throw new NoSuchProductEntryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
2867 primaryKey);
2868 }
2869
2870 return remove(scProductEntry);
2871 }
2872 catch (NoSuchProductEntryException nsee) {
2873 throw nsee;
2874 }
2875 catch (Exception e) {
2876 throw processException(e);
2877 }
2878 finally {
2879 closeSession(session);
2880 }
2881 }
2882
2883 @Override
2884 protected SCProductEntry removeImpl(SCProductEntry scProductEntry)
2885 throws SystemException {
2886 scProductEntry = toUnwrappedModel(scProductEntry);
2887
2888 try {
2889 clearSCLicenses.clear(scProductEntry.getPrimaryKey());
2890 }
2891 catch (Exception e) {
2892 throw processException(e);
2893 }
2894 finally {
2895 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
2896 }
2897
2898 Session session = null;
2899
2900 try {
2901 session = openSession();
2902
2903 if (!session.contains(scProductEntry)) {
2904 scProductEntry = (SCProductEntry)session.get(SCProductEntryImpl.class,
2905 scProductEntry.getPrimaryKeyObj());
2906 }
2907
2908 if (scProductEntry != null) {
2909 session.delete(scProductEntry);
2910 }
2911 }
2912 catch (Exception e) {
2913 throw processException(e);
2914 }
2915 finally {
2916 closeSession(session);
2917 }
2918
2919 if (scProductEntry != null) {
2920 clearCache(scProductEntry);
2921 }
2922
2923 return scProductEntry;
2924 }
2925
2926 @Override
2927 public SCProductEntry updateImpl(
2928 com.liferay.portlet.softwarecatalog.model.SCProductEntry scProductEntry)
2929 throws SystemException {
2930 scProductEntry = toUnwrappedModel(scProductEntry);
2931
2932 boolean isNew = scProductEntry.isNew();
2933
2934 SCProductEntryModelImpl scProductEntryModelImpl = (SCProductEntryModelImpl)scProductEntry;
2935
2936 Session session = null;
2937
2938 try {
2939 session = openSession();
2940
2941 if (scProductEntry.isNew()) {
2942 session.save(scProductEntry);
2943
2944 scProductEntry.setNew(false);
2945 }
2946 else {
2947 session.merge(scProductEntry);
2948 }
2949 }
2950 catch (Exception e) {
2951 throw processException(e);
2952 }
2953 finally {
2954 closeSession(session);
2955 }
2956
2957 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
2958
2959 if (isNew || !SCProductEntryModelImpl.COLUMN_BITMASK_ENABLED) {
2960 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2961 }
2962
2963 else {
2964 if ((scProductEntryModelImpl.getColumnBitmask() &
2965 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID.getColumnBitmask()) != 0) {
2966 Object[] args = new Object[] {
2967 scProductEntryModelImpl.getOriginalGroupId()
2968 };
2969
2970 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
2971 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
2972 args);
2973
2974 args = new Object[] { scProductEntryModelImpl.getGroupId() };
2975
2976 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
2977 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
2978 args);
2979 }
2980
2981 if ((scProductEntryModelImpl.getColumnBitmask() &
2982 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID.getColumnBitmask()) != 0) {
2983 Object[] args = new Object[] {
2984 scProductEntryModelImpl.getOriginalCompanyId()
2985 };
2986
2987 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID,
2988 args);
2989 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
2990 args);
2991
2992 args = new Object[] { scProductEntryModelImpl.getCompanyId() };
2993
2994 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID,
2995 args);
2996 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
2997 args);
2998 }
2999
3000 if ((scProductEntryModelImpl.getColumnBitmask() &
3001 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U.getColumnBitmask()) != 0) {
3002 Object[] args = new Object[] {
3003 scProductEntryModelImpl.getOriginalGroupId(),
3004 scProductEntryModelImpl.getOriginalUserId()
3005 };
3006
3007 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_U, args);
3008 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U,
3009 args);
3010
3011 args = new Object[] {
3012 scProductEntryModelImpl.getGroupId(),
3013 scProductEntryModelImpl.getUserId()
3014 };
3015
3016 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_U, args);
3017 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U,
3018 args);
3019 }
3020 }
3021
3022 EntityCacheUtil.putResult(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
3023 SCProductEntryImpl.class, scProductEntry.getPrimaryKey(),
3024 scProductEntry);
3025
3026 clearUniqueFindersCache(scProductEntry);
3027 cacheUniqueFindersCache(scProductEntry);
3028
3029 return scProductEntry;
3030 }
3031
3032 protected SCProductEntry toUnwrappedModel(SCProductEntry scProductEntry) {
3033 if (scProductEntry instanceof SCProductEntryImpl) {
3034 return scProductEntry;
3035 }
3036
3037 SCProductEntryImpl scProductEntryImpl = new SCProductEntryImpl();
3038
3039 scProductEntryImpl.setNew(scProductEntry.isNew());
3040 scProductEntryImpl.setPrimaryKey(scProductEntry.getPrimaryKey());
3041
3042 scProductEntryImpl.setProductEntryId(scProductEntry.getProductEntryId());
3043 scProductEntryImpl.setGroupId(scProductEntry.getGroupId());
3044 scProductEntryImpl.setCompanyId(scProductEntry.getCompanyId());
3045 scProductEntryImpl.setUserId(scProductEntry.getUserId());
3046 scProductEntryImpl.setUserName(scProductEntry.getUserName());
3047 scProductEntryImpl.setCreateDate(scProductEntry.getCreateDate());
3048 scProductEntryImpl.setModifiedDate(scProductEntry.getModifiedDate());
3049 scProductEntryImpl.setName(scProductEntry.getName());
3050 scProductEntryImpl.setType(scProductEntry.getType());
3051 scProductEntryImpl.setTags(scProductEntry.getTags());
3052 scProductEntryImpl.setShortDescription(scProductEntry.getShortDescription());
3053 scProductEntryImpl.setLongDescription(scProductEntry.getLongDescription());
3054 scProductEntryImpl.setPageURL(scProductEntry.getPageURL());
3055 scProductEntryImpl.setAuthor(scProductEntry.getAuthor());
3056 scProductEntryImpl.setRepoGroupId(scProductEntry.getRepoGroupId());
3057 scProductEntryImpl.setRepoArtifactId(scProductEntry.getRepoArtifactId());
3058
3059 return scProductEntryImpl;
3060 }
3061
3062
3070 @Override
3071 public SCProductEntry findByPrimaryKey(Serializable primaryKey)
3072 throws NoSuchProductEntryException, SystemException {
3073 SCProductEntry scProductEntry = fetchByPrimaryKey(primaryKey);
3074
3075 if (scProductEntry == null) {
3076 if (_log.isWarnEnabled()) {
3077 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
3078 }
3079
3080 throw new NoSuchProductEntryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
3081 primaryKey);
3082 }
3083
3084 return scProductEntry;
3085 }
3086
3087
3095 @Override
3096 public SCProductEntry findByPrimaryKey(long productEntryId)
3097 throws NoSuchProductEntryException, SystemException {
3098 return findByPrimaryKey((Serializable)productEntryId);
3099 }
3100
3101
3108 @Override
3109 public SCProductEntry fetchByPrimaryKey(Serializable primaryKey)
3110 throws SystemException {
3111 SCProductEntry scProductEntry = (SCProductEntry)EntityCacheUtil.getResult(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
3112 SCProductEntryImpl.class, primaryKey);
3113
3114 if (scProductEntry == _nullSCProductEntry) {
3115 return null;
3116 }
3117
3118 if (scProductEntry == null) {
3119 Session session = null;
3120
3121 try {
3122 session = openSession();
3123
3124 scProductEntry = (SCProductEntry)session.get(SCProductEntryImpl.class,
3125 primaryKey);
3126
3127 if (scProductEntry != null) {
3128 cacheResult(scProductEntry);
3129 }
3130 else {
3131 EntityCacheUtil.putResult(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
3132 SCProductEntryImpl.class, primaryKey,
3133 _nullSCProductEntry);
3134 }
3135 }
3136 catch (Exception e) {
3137 EntityCacheUtil.removeResult(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
3138 SCProductEntryImpl.class, primaryKey);
3139
3140 throw processException(e);
3141 }
3142 finally {
3143 closeSession(session);
3144 }
3145 }
3146
3147 return scProductEntry;
3148 }
3149
3150
3157 @Override
3158 public SCProductEntry fetchByPrimaryKey(long productEntryId)
3159 throws SystemException {
3160 return fetchByPrimaryKey((Serializable)productEntryId);
3161 }
3162
3163
3169 @Override
3170 public List<SCProductEntry> findAll() throws SystemException {
3171 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
3172 }
3173
3174
3186 @Override
3187 public List<SCProductEntry> findAll(int start, int end)
3188 throws SystemException {
3189 return findAll(start, end, null);
3190 }
3191
3192
3205 @Override
3206 public List<SCProductEntry> findAll(int start, int end,
3207 OrderByComparator orderByComparator) throws SystemException {
3208 boolean pagination = true;
3209 FinderPath finderPath = null;
3210 Object[] finderArgs = null;
3211
3212 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
3213 (orderByComparator == null)) {
3214 pagination = false;
3215 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
3216 finderArgs = FINDER_ARGS_EMPTY;
3217 }
3218 else {
3219 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
3220 finderArgs = new Object[] { start, end, orderByComparator };
3221 }
3222
3223 List<SCProductEntry> list = (List<SCProductEntry>)FinderCacheUtil.getResult(finderPath,
3224 finderArgs, this);
3225
3226 if (list == null) {
3227 StringBundler query = null;
3228 String sql = null;
3229
3230 if (orderByComparator != null) {
3231 query = new StringBundler(2 +
3232 (orderByComparator.getOrderByFields().length * 3));
3233
3234 query.append(_SQL_SELECT_SCPRODUCTENTRY);
3235
3236 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3237 orderByComparator);
3238
3239 sql = query.toString();
3240 }
3241 else {
3242 sql = _SQL_SELECT_SCPRODUCTENTRY;
3243
3244 if (pagination) {
3245 sql = sql.concat(SCProductEntryModelImpl.ORDER_BY_JPQL);
3246 }
3247 }
3248
3249 Session session = null;
3250
3251 try {
3252 session = openSession();
3253
3254 Query q = session.createQuery(sql);
3255
3256 if (!pagination) {
3257 list = (List<SCProductEntry>)QueryUtil.list(q,
3258 getDialect(), start, end, false);
3259
3260 Collections.sort(list);
3261
3262 list = new UnmodifiableList<SCProductEntry>(list);
3263 }
3264 else {
3265 list = (List<SCProductEntry>)QueryUtil.list(q,
3266 getDialect(), start, end);
3267 }
3268
3269 cacheResult(list);
3270
3271 FinderCacheUtil.putResult(finderPath, finderArgs, list);
3272 }
3273 catch (Exception e) {
3274 FinderCacheUtil.removeResult(finderPath, finderArgs);
3275
3276 throw processException(e);
3277 }
3278 finally {
3279 closeSession(session);
3280 }
3281 }
3282
3283 return list;
3284 }
3285
3286
3291 @Override
3292 public void removeAll() throws SystemException {
3293 for (SCProductEntry scProductEntry : findAll()) {
3294 remove(scProductEntry);
3295 }
3296 }
3297
3298
3304 @Override
3305 public int countAll() throws SystemException {
3306 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3307 FINDER_ARGS_EMPTY, this);
3308
3309 if (count == null) {
3310 Session session = null;
3311
3312 try {
3313 session = openSession();
3314
3315 Query q = session.createQuery(_SQL_COUNT_SCPRODUCTENTRY);
3316
3317 count = (Long)q.uniqueResult();
3318
3319 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
3320 FINDER_ARGS_EMPTY, count);
3321 }
3322 catch (Exception e) {
3323 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_ALL,
3324 FINDER_ARGS_EMPTY);
3325
3326 throw processException(e);
3327 }
3328 finally {
3329 closeSession(session);
3330 }
3331 }
3332
3333 return count.intValue();
3334 }
3335
3336
3343 @Override
3344 public List<com.liferay.portlet.softwarecatalog.model.SCLicense> getSCLicenses(
3345 long pk) throws SystemException {
3346 return getSCLicenses(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
3347 }
3348
3349
3362 @Override
3363 public List<com.liferay.portlet.softwarecatalog.model.SCLicense> getSCLicenses(
3364 long pk, int start, int end) throws SystemException {
3365 return getSCLicenses(pk, start, end, null);
3366 }
3367
3368 public static final FinderPath FINDER_PATH_GET_SCLICENSES = new FinderPath(com.liferay.portlet.softwarecatalog.model.impl.SCLicenseModelImpl.ENTITY_CACHE_ENABLED,
3369 SCProductEntryModelImpl.FINDER_CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES,
3370 com.liferay.portlet.softwarecatalog.model.impl.SCLicenseImpl.class,
3371 SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME,
3372 "getSCLicenses",
3373 new String[] {
3374 Long.class.getName(), Integer.class.getName(),
3375 Integer.class.getName(), OrderByComparator.class.getName()
3376 });
3377
3378 static {
3379 FINDER_PATH_GET_SCLICENSES.setCacheKeyGeneratorCacheName(null);
3380 }
3381
3382
3396 @Override
3397 public List<com.liferay.portlet.softwarecatalog.model.SCLicense> getSCLicenses(
3398 long pk, int start, int end, OrderByComparator orderByComparator)
3399 throws SystemException {
3400 boolean pagination = true;
3401 Object[] finderArgs = null;
3402
3403 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
3404 (orderByComparator == null)) {
3405 pagination = false;
3406 finderArgs = new Object[] { pk };
3407 }
3408 else {
3409 finderArgs = new Object[] { pk, start, end, orderByComparator };
3410 }
3411
3412 List<com.liferay.portlet.softwarecatalog.model.SCLicense> list = (List<com.liferay.portlet.softwarecatalog.model.SCLicense>)FinderCacheUtil.getResult(FINDER_PATH_GET_SCLICENSES,
3413 finderArgs, this);
3414
3415 if (list == null) {
3416 Session session = null;
3417
3418 try {
3419 session = openSession();
3420
3421 String sql = null;
3422
3423 if (orderByComparator != null) {
3424 sql = _SQL_GETSCLICENSES.concat(ORDER_BY_CLAUSE)
3425 .concat(orderByComparator.getOrderBy());
3426 }
3427 else {
3428 sql = _SQL_GETSCLICENSES;
3429
3430 if (pagination) {
3431 sql = sql.concat(com.liferay.portlet.softwarecatalog.model.impl.SCLicenseModelImpl.ORDER_BY_SQL);
3432 }
3433 }
3434
3435 SQLQuery q = session.createSQLQuery(sql);
3436
3437 q.addEntity("SCLicense",
3438 com.liferay.portlet.softwarecatalog.model.impl.SCLicenseImpl.class);
3439
3440 QueryPos qPos = QueryPos.getInstance(q);
3441
3442 qPos.add(pk);
3443
3444 if (!pagination) {
3445 list = (List<com.liferay.portlet.softwarecatalog.model.SCLicense>)QueryUtil.list(q,
3446 getDialect(), start, end, false);
3447
3448 Collections.sort(list);
3449
3450 list = new UnmodifiableList<com.liferay.portlet.softwarecatalog.model.SCLicense>(list);
3451 }
3452 else {
3453 list = (List<com.liferay.portlet.softwarecatalog.model.SCLicense>)QueryUtil.list(q,
3454 getDialect(), start, end);
3455 }
3456
3457 scLicensePersistence.cacheResult(list);
3458
3459 FinderCacheUtil.putResult(FINDER_PATH_GET_SCLICENSES,
3460 finderArgs, list);
3461 }
3462 catch (Exception e) {
3463 FinderCacheUtil.removeResult(FINDER_PATH_GET_SCLICENSES,
3464 finderArgs);
3465
3466 throw processException(e);
3467 }
3468 finally {
3469 closeSession(session);
3470 }
3471 }
3472
3473 return list;
3474 }
3475
3476 public static final FinderPath FINDER_PATH_GET_SCLICENSES_SIZE = new FinderPath(com.liferay.portlet.softwarecatalog.model.impl.SCLicenseModelImpl.ENTITY_CACHE_ENABLED,
3477 SCProductEntryModelImpl.FINDER_CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES,
3478 Long.class,
3479 SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME,
3480 "getSCLicensesSize", new String[] { Long.class.getName() });
3481
3482 static {
3483 FINDER_PATH_GET_SCLICENSES_SIZE.setCacheKeyGeneratorCacheName(null);
3484 }
3485
3486
3493 @Override
3494 public int getSCLicensesSize(long pk) throws SystemException {
3495 Object[] finderArgs = new Object[] { pk };
3496
3497 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_SCLICENSES_SIZE,
3498 finderArgs, this);
3499
3500 if (count == null) {
3501 Session session = null;
3502
3503 try {
3504 session = openSession();
3505
3506 SQLQuery q = session.createSQLQuery(_SQL_GETSCLICENSESSIZE);
3507
3508 q.addScalar(COUNT_COLUMN_NAME,
3509 com.liferay.portal.kernel.dao.orm.Type.LONG);
3510
3511 QueryPos qPos = QueryPos.getInstance(q);
3512
3513 qPos.add(pk);
3514
3515 count = (Long)q.uniqueResult();
3516
3517 FinderCacheUtil.putResult(FINDER_PATH_GET_SCLICENSES_SIZE,
3518 finderArgs, count);
3519 }
3520 catch (Exception e) {
3521 FinderCacheUtil.removeResult(FINDER_PATH_GET_SCLICENSES_SIZE,
3522 finderArgs);
3523
3524 throw processException(e);
3525 }
3526 finally {
3527 closeSession(session);
3528 }
3529 }
3530
3531 return count.intValue();
3532 }
3533
3534 public static final FinderPath FINDER_PATH_CONTAINS_SCLICENSE = new FinderPath(com.liferay.portlet.softwarecatalog.model.impl.SCLicenseModelImpl.ENTITY_CACHE_ENABLED,
3535 SCProductEntryModelImpl.FINDER_CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES,
3536 Boolean.class,
3537 SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME,
3538 "containsSCLicense",
3539 new String[] { Long.class.getName(), Long.class.getName() });
3540
3541
3549 @Override
3550 public boolean containsSCLicense(long pk, long scLicensePK)
3551 throws SystemException {
3552 Object[] finderArgs = new Object[] { pk, scLicensePK };
3553
3554 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_SCLICENSE,
3555 finderArgs, this);
3556
3557 if (value == null) {
3558 try {
3559 value = Boolean.valueOf(containsSCLicense.contains(pk,
3560 scLicensePK));
3561
3562 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_SCLICENSE,
3563 finderArgs, value);
3564 }
3565 catch (Exception e) {
3566 FinderCacheUtil.removeResult(FINDER_PATH_CONTAINS_SCLICENSE,
3567 finderArgs);
3568
3569 throw processException(e);
3570 }
3571 }
3572
3573 return value.booleanValue();
3574 }
3575
3576
3583 @Override
3584 public boolean containsSCLicenses(long pk) throws SystemException {
3585 if (getSCLicensesSize(pk) > 0) {
3586 return true;
3587 }
3588 else {
3589 return false;
3590 }
3591 }
3592
3593
3600 @Override
3601 public void addSCLicense(long pk, long scLicensePK)
3602 throws SystemException {
3603 try {
3604 addSCLicense.add(pk, scLicensePK);
3605 }
3606 catch (Exception e) {
3607 throw processException(e);
3608 }
3609 finally {
3610 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3611 }
3612 }
3613
3614
3621 @Override
3622 public void addSCLicense(long pk,
3623 com.liferay.portlet.softwarecatalog.model.SCLicense scLicense)
3624 throws SystemException {
3625 try {
3626 addSCLicense.add(pk, scLicense.getPrimaryKey());
3627 }
3628 catch (Exception e) {
3629 throw processException(e);
3630 }
3631 finally {
3632 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3633 }
3634 }
3635
3636
3643 @Override
3644 public void addSCLicenses(long pk, long[] scLicensePKs)
3645 throws SystemException {
3646 try {
3647 for (long scLicensePK : scLicensePKs) {
3648 addSCLicense.add(pk, scLicensePK);
3649 }
3650 }
3651 catch (Exception e) {
3652 throw processException(e);
3653 }
3654 finally {
3655 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3656 }
3657 }
3658
3659
3666 @Override
3667 public void addSCLicenses(long pk,
3668 List<com.liferay.portlet.softwarecatalog.model.SCLicense> scLicenses)
3669 throws SystemException {
3670 try {
3671 for (com.liferay.portlet.softwarecatalog.model.SCLicense scLicense : scLicenses) {
3672 addSCLicense.add(pk, scLicense.getPrimaryKey());
3673 }
3674 }
3675 catch (Exception e) {
3676 throw processException(e);
3677 }
3678 finally {
3679 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3680 }
3681 }
3682
3683
3689 @Override
3690 public void clearSCLicenses(long pk) throws SystemException {
3691 try {
3692 clearSCLicenses.clear(pk);
3693 }
3694 catch (Exception e) {
3695 throw processException(e);
3696 }
3697 finally {
3698 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3699 }
3700 }
3701
3702
3709 @Override
3710 public void removeSCLicense(long pk, long scLicensePK)
3711 throws SystemException {
3712 try {
3713 removeSCLicense.remove(pk, scLicensePK);
3714 }
3715 catch (Exception e) {
3716 throw processException(e);
3717 }
3718 finally {
3719 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3720 }
3721 }
3722
3723
3730 @Override
3731 public void removeSCLicense(long pk,
3732 com.liferay.portlet.softwarecatalog.model.SCLicense scLicense)
3733 throws SystemException {
3734 try {
3735 removeSCLicense.remove(pk, scLicense.getPrimaryKey());
3736 }
3737 catch (Exception e) {
3738 throw processException(e);
3739 }
3740 finally {
3741 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3742 }
3743 }
3744
3745
3752 @Override
3753 public void removeSCLicenses(long pk, long[] scLicensePKs)
3754 throws SystemException {
3755 try {
3756 for (long scLicensePK : scLicensePKs) {
3757 removeSCLicense.remove(pk, scLicensePK);
3758 }
3759 }
3760 catch (Exception e) {
3761 throw processException(e);
3762 }
3763 finally {
3764 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3765 }
3766 }
3767
3768
3775 @Override
3776 public void removeSCLicenses(long pk,
3777 List<com.liferay.portlet.softwarecatalog.model.SCLicense> scLicenses)
3778 throws SystemException {
3779 try {
3780 for (com.liferay.portlet.softwarecatalog.model.SCLicense scLicense : scLicenses) {
3781 removeSCLicense.remove(pk, scLicense.getPrimaryKey());
3782 }
3783 }
3784 catch (Exception e) {
3785 throw processException(e);
3786 }
3787 finally {
3788 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3789 }
3790 }
3791
3792
3799 @Override
3800 public void setSCLicenses(long pk, long[] scLicensePKs)
3801 throws SystemException {
3802 try {
3803 Set<Long> scLicensePKSet = SetUtil.fromArray(scLicensePKs);
3804
3805 List<com.liferay.portlet.softwarecatalog.model.SCLicense> scLicenses =
3806 getSCLicenses(pk);
3807
3808 for (com.liferay.portlet.softwarecatalog.model.SCLicense scLicense : scLicenses) {
3809 if (!scLicensePKSet.remove(scLicense.getPrimaryKey())) {
3810 removeSCLicense.remove(pk, scLicense.getPrimaryKey());
3811 }
3812 }
3813
3814 for (Long scLicensePK : scLicensePKSet) {
3815 addSCLicense.add(pk, scLicensePK);
3816 }
3817 }
3818 catch (Exception e) {
3819 throw processException(e);
3820 }
3821 finally {
3822 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3823 }
3824 }
3825
3826
3833 @Override
3834 public void setSCLicenses(long pk,
3835 List<com.liferay.portlet.softwarecatalog.model.SCLicense> scLicenses)
3836 throws SystemException {
3837 try {
3838 long[] scLicensePKs = new long[scLicenses.size()];
3839
3840 for (int i = 0; i < scLicenses.size(); i++) {
3841 com.liferay.portlet.softwarecatalog.model.SCLicense scLicense = scLicenses.get(i);
3842
3843 scLicensePKs[i] = scLicense.getPrimaryKey();
3844 }
3845
3846 setSCLicenses(pk, scLicensePKs);
3847 }
3848 catch (Exception e) {
3849 throw processException(e);
3850 }
3851 finally {
3852 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3853 }
3854 }
3855
3856 @Override
3857 protected Set<String> getBadColumnNames() {
3858 return _badColumnNames;
3859 }
3860
3861
3864 public void afterPropertiesSet() {
3865 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
3866 com.liferay.portal.util.PropsUtil.get(
3867 "value.object.listener.com.liferay.portlet.softwarecatalog.model.SCProductEntry")));
3868
3869 if (listenerClassNames.length > 0) {
3870 try {
3871 List<ModelListener<SCProductEntry>> listenersList = new ArrayList<ModelListener<SCProductEntry>>();
3872
3873 for (String listenerClassName : listenerClassNames) {
3874 listenersList.add((ModelListener<SCProductEntry>)InstanceFactory.newInstance(
3875 getClassLoader(), listenerClassName));
3876 }
3877
3878 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3879 }
3880 catch (Exception e) {
3881 _log.error(e);
3882 }
3883 }
3884
3885 containsSCLicense = new ContainsSCLicense();
3886
3887 addSCLicense = new AddSCLicense();
3888 clearSCLicenses = new ClearSCLicenses();
3889 removeSCLicense = new RemoveSCLicense();
3890 }
3891
3892 public void destroy() {
3893 EntityCacheUtil.removeCache(SCProductEntryImpl.class.getName());
3894 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
3895 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
3896 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
3897 }
3898
3899 @BeanReference(type = SCLicensePersistence.class)
3900 protected SCLicensePersistence scLicensePersistence;
3901 protected ContainsSCLicense containsSCLicense;
3902 protected AddSCLicense addSCLicense;
3903 protected ClearSCLicenses clearSCLicenses;
3904 protected RemoveSCLicense removeSCLicense;
3905
3906 protected class ContainsSCLicense {
3907 protected ContainsSCLicense() {
3908 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
3909 "SELECT 1 FROM SCLicenses_SCProductEntries WHERE productEntryId = ? AND licenseId = ?",
3910 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
3911 RowMapper.COUNT);
3912 }
3913
3914 protected boolean contains(long productEntryId, long licenseId) {
3915 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
3916 new Long(productEntryId), new Long(licenseId)
3917 });
3918
3919 if (results.isEmpty()) {
3920 return false;
3921 }
3922
3923 return true;
3924 }
3925
3926 private MappingSqlQuery<Integer> _mappingSqlQuery;
3927 }
3928
3929 protected class AddSCLicense {
3930 protected AddSCLicense() {
3931 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
3932 "INSERT INTO SCLicenses_SCProductEntries (productEntryId, licenseId) VALUES (?, ?)",
3933 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
3934 }
3935
3936 protected void add(long productEntryId, long licenseId)
3937 throws SystemException {
3938 if (!containsSCLicense.contains(productEntryId, licenseId)) {
3939 ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense>[] scLicenseListeners =
3940 scLicensePersistence.getListeners();
3941
3942 for (ModelListener<SCProductEntry> listener : listeners) {
3943 listener.onBeforeAddAssociation(productEntryId,
3944 com.liferay.portlet.softwarecatalog.model.SCLicense.class.getName(),
3945 licenseId);
3946 }
3947
3948 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense> listener : scLicenseListeners) {
3949 listener.onBeforeAddAssociation(licenseId,
3950 SCProductEntry.class.getName(), productEntryId);
3951 }
3952
3953 _sqlUpdate.update(new Object[] {
3954 new Long(productEntryId), new Long(licenseId)
3955 });
3956
3957 for (ModelListener<SCProductEntry> listener : listeners) {
3958 listener.onAfterAddAssociation(productEntryId,
3959 com.liferay.portlet.softwarecatalog.model.SCLicense.class.getName(),
3960 licenseId);
3961 }
3962
3963 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense> listener : scLicenseListeners) {
3964 listener.onAfterAddAssociation(licenseId,
3965 SCProductEntry.class.getName(), productEntryId);
3966 }
3967 }
3968 }
3969
3970 private SqlUpdate _sqlUpdate;
3971 }
3972
3973 protected class ClearSCLicenses {
3974 protected ClearSCLicenses() {
3975 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
3976 "DELETE FROM SCLicenses_SCProductEntries WHERE productEntryId = ?",
3977 new int[] { java.sql.Types.BIGINT });
3978 }
3979
3980 protected void clear(long productEntryId) throws SystemException {
3981 ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense>[] scLicenseListeners =
3982 scLicensePersistence.getListeners();
3983
3984 List<com.liferay.portlet.softwarecatalog.model.SCLicense> scLicenses =
3985 null;
3986
3987 if ((listeners.length > 0) || (scLicenseListeners.length > 0)) {
3988 scLicenses = getSCLicenses(productEntryId);
3989
3990 for (com.liferay.portlet.softwarecatalog.model.SCLicense scLicense : scLicenses) {
3991 for (ModelListener<SCProductEntry> listener : listeners) {
3992 listener.onBeforeRemoveAssociation(productEntryId,
3993 com.liferay.portlet.softwarecatalog.model.SCLicense.class.getName(),
3994 scLicense.getPrimaryKey());
3995 }
3996
3997 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense> listener : scLicenseListeners) {
3998 listener.onBeforeRemoveAssociation(scLicense.getPrimaryKey(),
3999 SCProductEntry.class.getName(), productEntryId);
4000 }
4001 }
4002 }
4003
4004 _sqlUpdate.update(new Object[] { new Long(productEntryId) });
4005
4006 if ((listeners.length > 0) || (scLicenseListeners.length > 0)) {
4007 for (com.liferay.portlet.softwarecatalog.model.SCLicense scLicense : scLicenses) {
4008 for (ModelListener<SCProductEntry> listener : listeners) {
4009 listener.onAfterRemoveAssociation(productEntryId,
4010 com.liferay.portlet.softwarecatalog.model.SCLicense.class.getName(),
4011 scLicense.getPrimaryKey());
4012 }
4013
4014 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense> listener : scLicenseListeners) {
4015 listener.onAfterRemoveAssociation(scLicense.getPrimaryKey(),
4016 SCProductEntry.class.getName(), productEntryId);
4017 }
4018 }
4019 }
4020 }
4021
4022 private SqlUpdate _sqlUpdate;
4023 }
4024
4025 protected class RemoveSCLicense {
4026 protected RemoveSCLicense() {
4027 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
4028 "DELETE FROM SCLicenses_SCProductEntries WHERE productEntryId = ? AND licenseId = ?",
4029 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
4030 }
4031
4032 protected void remove(long productEntryId, long licenseId)
4033 throws SystemException {
4034 if (containsSCLicense.contains(productEntryId, licenseId)) {
4035 ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense>[] scLicenseListeners =
4036 scLicensePersistence.getListeners();
4037
4038 for (ModelListener<SCProductEntry> listener : listeners) {
4039 listener.onBeforeRemoveAssociation(productEntryId,
4040 com.liferay.portlet.softwarecatalog.model.SCLicense.class.getName(),
4041 licenseId);
4042 }
4043
4044 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense> listener : scLicenseListeners) {
4045 listener.onBeforeRemoveAssociation(licenseId,
4046 SCProductEntry.class.getName(), productEntryId);
4047 }
4048
4049 _sqlUpdate.update(new Object[] {
4050 new Long(productEntryId), new Long(licenseId)
4051 });
4052
4053 for (ModelListener<SCProductEntry> listener : listeners) {
4054 listener.onAfterRemoveAssociation(productEntryId,
4055 com.liferay.portlet.softwarecatalog.model.SCLicense.class.getName(),
4056 licenseId);
4057 }
4058
4059 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense> listener : scLicenseListeners) {
4060 listener.onAfterRemoveAssociation(licenseId,
4061 SCProductEntry.class.getName(), productEntryId);
4062 }
4063 }
4064 }
4065
4066 private SqlUpdate _sqlUpdate;
4067 }
4068
4069 private static final String _SQL_SELECT_SCPRODUCTENTRY = "SELECT scProductEntry FROM SCProductEntry scProductEntry";
4070 private static final String _SQL_SELECT_SCPRODUCTENTRY_WHERE = "SELECT scProductEntry FROM SCProductEntry scProductEntry WHERE ";
4071 private static final String _SQL_COUNT_SCPRODUCTENTRY = "SELECT COUNT(scProductEntry) FROM SCProductEntry scProductEntry";
4072 private static final String _SQL_COUNT_SCPRODUCTENTRY_WHERE = "SELECT COUNT(scProductEntry) FROM SCProductEntry scProductEntry WHERE ";
4073 private static final String _SQL_GETSCLICENSES = "SELECT {SCLicense.*} FROM SCLicense INNER JOIN SCLicenses_SCProductEntries ON (SCLicenses_SCProductEntries.licenseId = SCLicense.licenseId) WHERE (SCLicenses_SCProductEntries.productEntryId = ?)";
4074 private static final String _SQL_GETSCLICENSESSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM SCLicenses_SCProductEntries WHERE productEntryId = ?";
4075 private static final String _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN = "scProductEntry.productEntryId";
4076 private static final String _FILTER_SQL_SELECT_SCPRODUCTENTRY_WHERE = "SELECT DISTINCT {scProductEntry.*} FROM SCProductEntry scProductEntry WHERE ";
4077 private static final String _FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_1 =
4078 "SELECT {SCProductEntry.*} FROM (SELECT DISTINCT scProductEntry.productEntryId FROM SCProductEntry scProductEntry WHERE ";
4079 private static final String _FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_2 =
4080 ") TEMP_TABLE INNER JOIN SCProductEntry ON TEMP_TABLE.productEntryId = SCProductEntry.productEntryId";
4081 private static final String _FILTER_SQL_COUNT_SCPRODUCTENTRY_WHERE = "SELECT COUNT(DISTINCT scProductEntry.productEntryId) AS COUNT_VALUE FROM SCProductEntry scProductEntry WHERE ";
4082 private static final String _FILTER_ENTITY_ALIAS = "scProductEntry";
4083 private static final String _FILTER_ENTITY_TABLE = "SCProductEntry";
4084 private static final String _ORDER_BY_ENTITY_ALIAS = "scProductEntry.";
4085 private static final String _ORDER_BY_ENTITY_TABLE = "SCProductEntry.";
4086 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No SCProductEntry exists with the primary key ";
4087 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No SCProductEntry exists with the key {";
4088 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
4089 private static Log _log = LogFactoryUtil.getLog(SCProductEntryPersistenceImpl.class);
4090 private static Set<String> _badColumnNames = SetUtil.fromArray(new String[] {
4091 "type"
4092 });
4093 private static SCProductEntry _nullSCProductEntry = new SCProductEntryImpl() {
4094 @Override
4095 public Object clone() {
4096 return this;
4097 }
4098
4099 @Override
4100 public CacheModel<SCProductEntry> toCacheModel() {
4101 return _nullSCProductEntryCacheModel;
4102 }
4103 };
4104
4105 private static CacheModel<SCProductEntry> _nullSCProductEntryCacheModel = new CacheModel<SCProductEntry>() {
4106 @Override
4107 public SCProductEntry toEntityModel() {
4108 return _nullSCProductEntry;
4109 }
4110 };
4111 }