001
014
015 package com.liferay.portlet.softwarecatalog.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.kernel.bean.BeanReference;
019 import com.liferay.portal.kernel.cache.CacheRegistryUtil;
020 import com.liferay.portal.kernel.dao.jdbc.MappingSqlQuery;
021 import com.liferay.portal.kernel.dao.jdbc.MappingSqlQueryFactoryUtil;
022 import com.liferay.portal.kernel.dao.jdbc.RowMapper;
023 import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
024 import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
025 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
026 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
027 import com.liferay.portal.kernel.dao.orm.FinderPath;
028 import com.liferay.portal.kernel.dao.orm.Query;
029 import com.liferay.portal.kernel.dao.orm.QueryPos;
030 import com.liferay.portal.kernel.dao.orm.QueryUtil;
031 import com.liferay.portal.kernel.dao.orm.SQLQuery;
032 import com.liferay.portal.kernel.dao.orm.Session;
033 import com.liferay.portal.kernel.exception.SystemException;
034 import com.liferay.portal.kernel.log.Log;
035 import com.liferay.portal.kernel.log.LogFactoryUtil;
036 import com.liferay.portal.kernel.util.GetterUtil;
037 import com.liferay.portal.kernel.util.InstanceFactory;
038 import com.liferay.portal.kernel.util.OrderByComparator;
039 import com.liferay.portal.kernel.util.SetUtil;
040 import com.liferay.portal.kernel.util.StringBundler;
041 import com.liferay.portal.kernel.util.StringPool;
042 import com.liferay.portal.kernel.util.StringUtil;
043 import com.liferay.portal.kernel.util.UnmodifiableList;
044 import com.liferay.portal.kernel.util.Validator;
045 import com.liferay.portal.model.CacheModel;
046 import com.liferay.portal.model.ModelListener;
047 import com.liferay.portal.security.permission.InlineSQLHelperUtil;
048 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
049
050 import com.liferay.portlet.softwarecatalog.NoSuchProductEntryException;
051 import com.liferay.portlet.softwarecatalog.model.SCProductEntry;
052 import com.liferay.portlet.softwarecatalog.model.impl.SCProductEntryImpl;
053 import com.liferay.portlet.softwarecatalog.model.impl.SCProductEntryModelImpl;
054
055 import java.io.Serializable;
056
057 import java.util.ArrayList;
058 import java.util.Collections;
059 import java.util.List;
060 import java.util.Set;
061
062
074 public class SCProductEntryPersistenceImpl extends BasePersistenceImpl<SCProductEntry>
075 implements SCProductEntryPersistence {
076
081 public static final String FINDER_CLASS_NAME_ENTITY = SCProductEntryImpl.class.getName();
082 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
083 ".List1";
084 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
085 ".List2";
086 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
087 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
088 SCProductEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
089 "findAll", new String[0]);
090 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
091 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
092 SCProductEntryImpl.class,
093 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
094 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
095 SCProductEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
096 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
097 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
098 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
099 SCProductEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
100 "findByGroupId",
101 new String[] {
102 Long.class.getName(),
103
104 Integer.class.getName(), Integer.class.getName(),
105 OrderByComparator.class.getName()
106 });
107 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID =
108 new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
109 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
110 SCProductEntryImpl.class,
111 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByGroupId",
112 new String[] { Long.class.getName() },
113 SCProductEntryModelImpl.GROUPID_COLUMN_BITMASK |
114 SCProductEntryModelImpl.MODIFIEDDATE_COLUMN_BITMASK |
115 SCProductEntryModelImpl.NAME_COLUMN_BITMASK);
116 public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
117 SCProductEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
118 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByGroupId",
119 new String[] { Long.class.getName() });
120
121
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 public List<SCProductEntry> findByGroupId(long groupId, int start, int end)
147 throws SystemException {
148 return findByGroupId(groupId, start, end, null);
149 }
150
151
165 public List<SCProductEntry> findByGroupId(long groupId, int start, int end,
166 OrderByComparator orderByComparator) throws SystemException {
167 boolean pagination = true;
168 FinderPath finderPath = null;
169 Object[] finderArgs = null;
170
171 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
172 (orderByComparator == null)) {
173 pagination = false;
174 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID;
175 finderArgs = new Object[] { groupId };
176 }
177 else {
178 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID;
179 finderArgs = new Object[] { groupId, start, end, orderByComparator };
180 }
181
182 List<SCProductEntry> list = (List<SCProductEntry>)FinderCacheUtil.getResult(finderPath,
183 finderArgs, this);
184
185 if ((list != null) && !list.isEmpty()) {
186 for (SCProductEntry scProductEntry : list) {
187 if ((groupId != scProductEntry.getGroupId())) {
188 list = null;
189
190 break;
191 }
192 }
193 }
194
195 if (list == null) {
196 StringBundler query = null;
197
198 if (orderByComparator != null) {
199 query = new StringBundler(3 +
200 (orderByComparator.getOrderByFields().length * 3));
201 }
202 else {
203 query = new StringBundler(3);
204 }
205
206 query.append(_SQL_SELECT_SCPRODUCTENTRY_WHERE);
207
208 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
209
210 if (orderByComparator != null) {
211 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
212 orderByComparator);
213 }
214 else
215 if (pagination) {
216 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
217 }
218
219 String sql = query.toString();
220
221 Session session = null;
222
223 try {
224 session = openSession();
225
226 Query q = session.createQuery(sql);
227
228 QueryPos qPos = QueryPos.getInstance(q);
229
230 qPos.add(groupId);
231
232 if (!pagination) {
233 list = (List<SCProductEntry>)QueryUtil.list(q,
234 getDialect(), start, end, false);
235
236 Collections.sort(list);
237
238 list = new UnmodifiableList<SCProductEntry>(list);
239 }
240 else {
241 list = (List<SCProductEntry>)QueryUtil.list(q,
242 getDialect(), start, end);
243 }
244
245 cacheResult(list);
246
247 FinderCacheUtil.putResult(finderPath, finderArgs, list);
248 }
249 catch (Exception e) {
250 FinderCacheUtil.removeResult(finderPath, finderArgs);
251
252 throw processException(e);
253 }
254 finally {
255 closeSession(session);
256 }
257 }
258
259 return list;
260 }
261
262
271 public SCProductEntry findByGroupId_First(long groupId,
272 OrderByComparator orderByComparator)
273 throws NoSuchProductEntryException, SystemException {
274 SCProductEntry scProductEntry = fetchByGroupId_First(groupId,
275 orderByComparator);
276
277 if (scProductEntry != null) {
278 return scProductEntry;
279 }
280
281 StringBundler msg = new StringBundler(4);
282
283 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
284
285 msg.append("groupId=");
286 msg.append(groupId);
287
288 msg.append(StringPool.CLOSE_CURLY_BRACE);
289
290 throw new NoSuchProductEntryException(msg.toString());
291 }
292
293
301 public SCProductEntry fetchByGroupId_First(long groupId,
302 OrderByComparator orderByComparator) throws SystemException {
303 List<SCProductEntry> list = findByGroupId(groupId, 0, 1,
304 orderByComparator);
305
306 if (!list.isEmpty()) {
307 return list.get(0);
308 }
309
310 return null;
311 }
312
313
322 public SCProductEntry findByGroupId_Last(long groupId,
323 OrderByComparator orderByComparator)
324 throws NoSuchProductEntryException, SystemException {
325 SCProductEntry scProductEntry = fetchByGroupId_Last(groupId,
326 orderByComparator);
327
328 if (scProductEntry != null) {
329 return scProductEntry;
330 }
331
332 StringBundler msg = new StringBundler(4);
333
334 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
335
336 msg.append("groupId=");
337 msg.append(groupId);
338
339 msg.append(StringPool.CLOSE_CURLY_BRACE);
340
341 throw new NoSuchProductEntryException(msg.toString());
342 }
343
344
352 public SCProductEntry fetchByGroupId_Last(long groupId,
353 OrderByComparator orderByComparator) throws SystemException {
354 int count = countByGroupId(groupId);
355
356 List<SCProductEntry> list = findByGroupId(groupId, count - 1, count,
357 orderByComparator);
358
359 if (!list.isEmpty()) {
360 return list.get(0);
361 }
362
363 return null;
364 }
365
366
376 public SCProductEntry[] findByGroupId_PrevAndNext(long productEntryId,
377 long groupId, OrderByComparator orderByComparator)
378 throws NoSuchProductEntryException, SystemException {
379 SCProductEntry scProductEntry = findByPrimaryKey(productEntryId);
380
381 Session session = null;
382
383 try {
384 session = openSession();
385
386 SCProductEntry[] array = new SCProductEntryImpl[3];
387
388 array[0] = getByGroupId_PrevAndNext(session, scProductEntry,
389 groupId, orderByComparator, true);
390
391 array[1] = scProductEntry;
392
393 array[2] = getByGroupId_PrevAndNext(session, scProductEntry,
394 groupId, orderByComparator, false);
395
396 return array;
397 }
398 catch (Exception e) {
399 throw processException(e);
400 }
401 finally {
402 closeSession(session);
403 }
404 }
405
406 protected SCProductEntry getByGroupId_PrevAndNext(Session session,
407 SCProductEntry scProductEntry, long groupId,
408 OrderByComparator orderByComparator, boolean previous) {
409 StringBundler query = null;
410
411 if (orderByComparator != null) {
412 query = new StringBundler(6 +
413 (orderByComparator.getOrderByFields().length * 6));
414 }
415 else {
416 query = new StringBundler(3);
417 }
418
419 query.append(_SQL_SELECT_SCPRODUCTENTRY_WHERE);
420
421 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
422
423 if (orderByComparator != null) {
424 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
425
426 if (orderByConditionFields.length > 0) {
427 query.append(WHERE_AND);
428 }
429
430 for (int i = 0; i < orderByConditionFields.length; i++) {
431 query.append(_ORDER_BY_ENTITY_ALIAS);
432 query.append(orderByConditionFields[i]);
433
434 if ((i + 1) < orderByConditionFields.length) {
435 if (orderByComparator.isAscending() ^ previous) {
436 query.append(WHERE_GREATER_THAN_HAS_NEXT);
437 }
438 else {
439 query.append(WHERE_LESSER_THAN_HAS_NEXT);
440 }
441 }
442 else {
443 if (orderByComparator.isAscending() ^ previous) {
444 query.append(WHERE_GREATER_THAN);
445 }
446 else {
447 query.append(WHERE_LESSER_THAN);
448 }
449 }
450 }
451
452 query.append(ORDER_BY_CLAUSE);
453
454 String[] orderByFields = orderByComparator.getOrderByFields();
455
456 for (int i = 0; i < orderByFields.length; i++) {
457 query.append(_ORDER_BY_ENTITY_ALIAS);
458 query.append(orderByFields[i]);
459
460 if ((i + 1) < orderByFields.length) {
461 if (orderByComparator.isAscending() ^ previous) {
462 query.append(ORDER_BY_ASC_HAS_NEXT);
463 }
464 else {
465 query.append(ORDER_BY_DESC_HAS_NEXT);
466 }
467 }
468 else {
469 if (orderByComparator.isAscending() ^ previous) {
470 query.append(ORDER_BY_ASC);
471 }
472 else {
473 query.append(ORDER_BY_DESC);
474 }
475 }
476 }
477 }
478 else {
479 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
480 }
481
482 String sql = query.toString();
483
484 Query q = session.createQuery(sql);
485
486 q.setFirstResult(0);
487 q.setMaxResults(2);
488
489 QueryPos qPos = QueryPos.getInstance(q);
490
491 qPos.add(groupId);
492
493 if (orderByComparator != null) {
494 Object[] values = orderByComparator.getOrderByConditionValues(scProductEntry);
495
496 for (Object value : values) {
497 qPos.add(value);
498 }
499 }
500
501 List<SCProductEntry> list = q.list();
502
503 if (list.size() == 2) {
504 return list.get(1);
505 }
506 else {
507 return null;
508 }
509 }
510
511
518 public List<SCProductEntry> filterFindByGroupId(long groupId)
519 throws SystemException {
520 return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
521 QueryUtil.ALL_POS, null);
522 }
523
524
537 public List<SCProductEntry> filterFindByGroupId(long groupId, int start,
538 int end) throws SystemException {
539 return filterFindByGroupId(groupId, start, end, null);
540 }
541
542
556 public List<SCProductEntry> filterFindByGroupId(long groupId, int start,
557 int end, OrderByComparator orderByComparator) throws SystemException {
558 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
559 return findByGroupId(groupId, start, end, orderByComparator);
560 }
561
562 StringBundler query = null;
563
564 if (orderByComparator != null) {
565 query = new StringBundler(3 +
566 (orderByComparator.getOrderByFields().length * 3));
567 }
568 else {
569 query = new StringBundler(3);
570 }
571
572 if (getDB().isSupportsInlineDistinct()) {
573 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_WHERE);
574 }
575 else {
576 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_1);
577 }
578
579 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
580
581 if (!getDB().isSupportsInlineDistinct()) {
582 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_2);
583 }
584
585 if (orderByComparator != null) {
586 if (getDB().isSupportsInlineDistinct()) {
587 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
588 orderByComparator);
589 }
590 else {
591 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
592 orderByComparator);
593 }
594 }
595 else {
596 if (getDB().isSupportsInlineDistinct()) {
597 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
598 }
599 else {
600 query.append(SCProductEntryModelImpl.ORDER_BY_SQL);
601 }
602 }
603
604 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
605 SCProductEntry.class.getName(),
606 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
607
608 Session session = null;
609
610 try {
611 session = openSession();
612
613 SQLQuery q = session.createSQLQuery(sql);
614
615 if (getDB().isSupportsInlineDistinct()) {
616 q.addEntity(_FILTER_ENTITY_ALIAS, SCProductEntryImpl.class);
617 }
618 else {
619 q.addEntity(_FILTER_ENTITY_TABLE, SCProductEntryImpl.class);
620 }
621
622 QueryPos qPos = QueryPos.getInstance(q);
623
624 qPos.add(groupId);
625
626 return (List<SCProductEntry>)QueryUtil.list(q, getDialect(), start,
627 end);
628 }
629 catch (Exception e) {
630 throw processException(e);
631 }
632 finally {
633 closeSession(session);
634 }
635 }
636
637
647 public SCProductEntry[] filterFindByGroupId_PrevAndNext(
648 long productEntryId, long groupId, OrderByComparator orderByComparator)
649 throws NoSuchProductEntryException, SystemException {
650 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
651 return findByGroupId_PrevAndNext(productEntryId, groupId,
652 orderByComparator);
653 }
654
655 SCProductEntry scProductEntry = findByPrimaryKey(productEntryId);
656
657 Session session = null;
658
659 try {
660 session = openSession();
661
662 SCProductEntry[] array = new SCProductEntryImpl[3];
663
664 array[0] = filterGetByGroupId_PrevAndNext(session, scProductEntry,
665 groupId, orderByComparator, true);
666
667 array[1] = scProductEntry;
668
669 array[2] = filterGetByGroupId_PrevAndNext(session, scProductEntry,
670 groupId, orderByComparator, false);
671
672 return array;
673 }
674 catch (Exception e) {
675 throw processException(e);
676 }
677 finally {
678 closeSession(session);
679 }
680 }
681
682 protected SCProductEntry filterGetByGroupId_PrevAndNext(Session session,
683 SCProductEntry scProductEntry, long groupId,
684 OrderByComparator orderByComparator, boolean previous) {
685 StringBundler query = null;
686
687 if (orderByComparator != null) {
688 query = new StringBundler(6 +
689 (orderByComparator.getOrderByFields().length * 6));
690 }
691 else {
692 query = new StringBundler(3);
693 }
694
695 if (getDB().isSupportsInlineDistinct()) {
696 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_WHERE);
697 }
698 else {
699 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_1);
700 }
701
702 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
703
704 if (!getDB().isSupportsInlineDistinct()) {
705 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_2);
706 }
707
708 if (orderByComparator != null) {
709 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
710
711 if (orderByConditionFields.length > 0) {
712 query.append(WHERE_AND);
713 }
714
715 for (int i = 0; i < orderByConditionFields.length; i++) {
716 if (getDB().isSupportsInlineDistinct()) {
717 query.append(_ORDER_BY_ENTITY_ALIAS);
718 }
719 else {
720 query.append(_ORDER_BY_ENTITY_TABLE);
721 }
722
723 query.append(orderByConditionFields[i]);
724
725 if ((i + 1) < orderByConditionFields.length) {
726 if (orderByComparator.isAscending() ^ previous) {
727 query.append(WHERE_GREATER_THAN_HAS_NEXT);
728 }
729 else {
730 query.append(WHERE_LESSER_THAN_HAS_NEXT);
731 }
732 }
733 else {
734 if (orderByComparator.isAscending() ^ previous) {
735 query.append(WHERE_GREATER_THAN);
736 }
737 else {
738 query.append(WHERE_LESSER_THAN);
739 }
740 }
741 }
742
743 query.append(ORDER_BY_CLAUSE);
744
745 String[] orderByFields = orderByComparator.getOrderByFields();
746
747 for (int i = 0; i < orderByFields.length; i++) {
748 if (getDB().isSupportsInlineDistinct()) {
749 query.append(_ORDER_BY_ENTITY_ALIAS);
750 }
751 else {
752 query.append(_ORDER_BY_ENTITY_TABLE);
753 }
754
755 query.append(orderByFields[i]);
756
757 if ((i + 1) < orderByFields.length) {
758 if (orderByComparator.isAscending() ^ previous) {
759 query.append(ORDER_BY_ASC_HAS_NEXT);
760 }
761 else {
762 query.append(ORDER_BY_DESC_HAS_NEXT);
763 }
764 }
765 else {
766 if (orderByComparator.isAscending() ^ previous) {
767 query.append(ORDER_BY_ASC);
768 }
769 else {
770 query.append(ORDER_BY_DESC);
771 }
772 }
773 }
774 }
775 else {
776 if (getDB().isSupportsInlineDistinct()) {
777 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
778 }
779 else {
780 query.append(SCProductEntryModelImpl.ORDER_BY_SQL);
781 }
782 }
783
784 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
785 SCProductEntry.class.getName(),
786 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
787
788 SQLQuery q = session.createSQLQuery(sql);
789
790 q.setFirstResult(0);
791 q.setMaxResults(2);
792
793 if (getDB().isSupportsInlineDistinct()) {
794 q.addEntity(_FILTER_ENTITY_ALIAS, SCProductEntryImpl.class);
795 }
796 else {
797 q.addEntity(_FILTER_ENTITY_TABLE, SCProductEntryImpl.class);
798 }
799
800 QueryPos qPos = QueryPos.getInstance(q);
801
802 qPos.add(groupId);
803
804 if (orderByComparator != null) {
805 Object[] values = orderByComparator.getOrderByConditionValues(scProductEntry);
806
807 for (Object value : values) {
808 qPos.add(value);
809 }
810 }
811
812 List<SCProductEntry> list = q.list();
813
814 if (list.size() == 2) {
815 return list.get(1);
816 }
817 else {
818 return null;
819 }
820 }
821
822
828 public void removeByGroupId(long groupId) throws SystemException {
829 for (SCProductEntry scProductEntry : findByGroupId(groupId,
830 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
831 remove(scProductEntry);
832 }
833 }
834
835
842 public int countByGroupId(long groupId) throws SystemException {
843 FinderPath finderPath = FINDER_PATH_COUNT_BY_GROUPID;
844
845 Object[] finderArgs = new Object[] { groupId };
846
847 Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
848 this);
849
850 if (count == null) {
851 StringBundler query = new StringBundler(2);
852
853 query.append(_SQL_COUNT_SCPRODUCTENTRY_WHERE);
854
855 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
856
857 String sql = query.toString();
858
859 Session session = null;
860
861 try {
862 session = openSession();
863
864 Query q = session.createQuery(sql);
865
866 QueryPos qPos = QueryPos.getInstance(q);
867
868 qPos.add(groupId);
869
870 count = (Long)q.uniqueResult();
871
872 FinderCacheUtil.putResult(finderPath, finderArgs, count);
873 }
874 catch (Exception e) {
875 FinderCacheUtil.removeResult(finderPath, finderArgs);
876
877 throw processException(e);
878 }
879 finally {
880 closeSession(session);
881 }
882 }
883
884 return count.intValue();
885 }
886
887
894 public int filterCountByGroupId(long groupId) throws SystemException {
895 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
896 return countByGroupId(groupId);
897 }
898
899 StringBundler query = new StringBundler(2);
900
901 query.append(_FILTER_SQL_COUNT_SCPRODUCTENTRY_WHERE);
902
903 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
904
905 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
906 SCProductEntry.class.getName(),
907 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
908
909 Session session = null;
910
911 try {
912 session = openSession();
913
914 SQLQuery q = session.createSQLQuery(sql);
915
916 q.addScalar(COUNT_COLUMN_NAME,
917 com.liferay.portal.kernel.dao.orm.Type.LONG);
918
919 QueryPos qPos = QueryPos.getInstance(q);
920
921 qPos.add(groupId);
922
923 Long count = (Long)q.uniqueResult();
924
925 return count.intValue();
926 }
927 catch (Exception e) {
928 throw processException(e);
929 }
930 finally {
931 closeSession(session);
932 }
933 }
934
935 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "scProductEntry.groupId = ?";
936 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID =
937 new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
938 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
939 SCProductEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
940 "findByCompanyId",
941 new String[] {
942 Long.class.getName(),
943
944 Integer.class.getName(), Integer.class.getName(),
945 OrderByComparator.class.getName()
946 });
947 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID =
948 new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
949 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
950 SCProductEntryImpl.class,
951 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByCompanyId",
952 new String[] { Long.class.getName() },
953 SCProductEntryModelImpl.COMPANYID_COLUMN_BITMASK |
954 SCProductEntryModelImpl.MODIFIEDDATE_COLUMN_BITMASK |
955 SCProductEntryModelImpl.NAME_COLUMN_BITMASK);
956 public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
957 SCProductEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
958 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByCompanyId",
959 new String[] { Long.class.getName() });
960
961
968 public List<SCProductEntry> findByCompanyId(long companyId)
969 throws SystemException {
970 return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
971 null);
972 }
973
974
987 public List<SCProductEntry> findByCompanyId(long companyId, int start,
988 int end) throws SystemException {
989 return findByCompanyId(companyId, start, end, null);
990 }
991
992
1006 public List<SCProductEntry> findByCompanyId(long companyId, int start,
1007 int end, OrderByComparator orderByComparator) throws SystemException {
1008 boolean pagination = true;
1009 FinderPath finderPath = null;
1010 Object[] finderArgs = null;
1011
1012 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1013 (orderByComparator == null)) {
1014 pagination = false;
1015 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID;
1016 finderArgs = new Object[] { companyId };
1017 }
1018 else {
1019 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID;
1020 finderArgs = new Object[] { companyId, start, end, orderByComparator };
1021 }
1022
1023 List<SCProductEntry> list = (List<SCProductEntry>)FinderCacheUtil.getResult(finderPath,
1024 finderArgs, this);
1025
1026 if ((list != null) && !list.isEmpty()) {
1027 for (SCProductEntry scProductEntry : list) {
1028 if ((companyId != scProductEntry.getCompanyId())) {
1029 list = null;
1030
1031 break;
1032 }
1033 }
1034 }
1035
1036 if (list == null) {
1037 StringBundler query = null;
1038
1039 if (orderByComparator != null) {
1040 query = new StringBundler(3 +
1041 (orderByComparator.getOrderByFields().length * 3));
1042 }
1043 else {
1044 query = new StringBundler(3);
1045 }
1046
1047 query.append(_SQL_SELECT_SCPRODUCTENTRY_WHERE);
1048
1049 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1050
1051 if (orderByComparator != null) {
1052 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1053 orderByComparator);
1054 }
1055 else
1056 if (pagination) {
1057 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
1058 }
1059
1060 String sql = query.toString();
1061
1062 Session session = null;
1063
1064 try {
1065 session = openSession();
1066
1067 Query q = session.createQuery(sql);
1068
1069 QueryPos qPos = QueryPos.getInstance(q);
1070
1071 qPos.add(companyId);
1072
1073 if (!pagination) {
1074 list = (List<SCProductEntry>)QueryUtil.list(q,
1075 getDialect(), start, end, false);
1076
1077 Collections.sort(list);
1078
1079 list = new UnmodifiableList<SCProductEntry>(list);
1080 }
1081 else {
1082 list = (List<SCProductEntry>)QueryUtil.list(q,
1083 getDialect(), start, end);
1084 }
1085
1086 cacheResult(list);
1087
1088 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1089 }
1090 catch (Exception e) {
1091 FinderCacheUtil.removeResult(finderPath, finderArgs);
1092
1093 throw processException(e);
1094 }
1095 finally {
1096 closeSession(session);
1097 }
1098 }
1099
1100 return list;
1101 }
1102
1103
1112 public SCProductEntry findByCompanyId_First(long companyId,
1113 OrderByComparator orderByComparator)
1114 throws NoSuchProductEntryException, SystemException {
1115 SCProductEntry scProductEntry = fetchByCompanyId_First(companyId,
1116 orderByComparator);
1117
1118 if (scProductEntry != null) {
1119 return scProductEntry;
1120 }
1121
1122 StringBundler msg = new StringBundler(4);
1123
1124 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1125
1126 msg.append("companyId=");
1127 msg.append(companyId);
1128
1129 msg.append(StringPool.CLOSE_CURLY_BRACE);
1130
1131 throw new NoSuchProductEntryException(msg.toString());
1132 }
1133
1134
1142 public SCProductEntry fetchByCompanyId_First(long companyId,
1143 OrderByComparator orderByComparator) throws SystemException {
1144 List<SCProductEntry> list = findByCompanyId(companyId, 0, 1,
1145 orderByComparator);
1146
1147 if (!list.isEmpty()) {
1148 return list.get(0);
1149 }
1150
1151 return null;
1152 }
1153
1154
1163 public SCProductEntry findByCompanyId_Last(long companyId,
1164 OrderByComparator orderByComparator)
1165 throws NoSuchProductEntryException, SystemException {
1166 SCProductEntry scProductEntry = fetchByCompanyId_Last(companyId,
1167 orderByComparator);
1168
1169 if (scProductEntry != null) {
1170 return scProductEntry;
1171 }
1172
1173 StringBundler msg = new StringBundler(4);
1174
1175 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1176
1177 msg.append("companyId=");
1178 msg.append(companyId);
1179
1180 msg.append(StringPool.CLOSE_CURLY_BRACE);
1181
1182 throw new NoSuchProductEntryException(msg.toString());
1183 }
1184
1185
1193 public SCProductEntry fetchByCompanyId_Last(long companyId,
1194 OrderByComparator orderByComparator) throws SystemException {
1195 int count = countByCompanyId(companyId);
1196
1197 List<SCProductEntry> list = findByCompanyId(companyId, count - 1,
1198 count, orderByComparator);
1199
1200 if (!list.isEmpty()) {
1201 return list.get(0);
1202 }
1203
1204 return null;
1205 }
1206
1207
1217 public SCProductEntry[] findByCompanyId_PrevAndNext(long productEntryId,
1218 long companyId, OrderByComparator orderByComparator)
1219 throws NoSuchProductEntryException, SystemException {
1220 SCProductEntry scProductEntry = findByPrimaryKey(productEntryId);
1221
1222 Session session = null;
1223
1224 try {
1225 session = openSession();
1226
1227 SCProductEntry[] array = new SCProductEntryImpl[3];
1228
1229 array[0] = getByCompanyId_PrevAndNext(session, scProductEntry,
1230 companyId, orderByComparator, true);
1231
1232 array[1] = scProductEntry;
1233
1234 array[2] = getByCompanyId_PrevAndNext(session, scProductEntry,
1235 companyId, orderByComparator, false);
1236
1237 return array;
1238 }
1239 catch (Exception e) {
1240 throw processException(e);
1241 }
1242 finally {
1243 closeSession(session);
1244 }
1245 }
1246
1247 protected SCProductEntry getByCompanyId_PrevAndNext(Session session,
1248 SCProductEntry scProductEntry, long companyId,
1249 OrderByComparator orderByComparator, boolean previous) {
1250 StringBundler query = null;
1251
1252 if (orderByComparator != null) {
1253 query = new StringBundler(6 +
1254 (orderByComparator.getOrderByFields().length * 6));
1255 }
1256 else {
1257 query = new StringBundler(3);
1258 }
1259
1260 query.append(_SQL_SELECT_SCPRODUCTENTRY_WHERE);
1261
1262 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1263
1264 if (orderByComparator != null) {
1265 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1266
1267 if (orderByConditionFields.length > 0) {
1268 query.append(WHERE_AND);
1269 }
1270
1271 for (int i = 0; i < orderByConditionFields.length; i++) {
1272 query.append(_ORDER_BY_ENTITY_ALIAS);
1273 query.append(orderByConditionFields[i]);
1274
1275 if ((i + 1) < orderByConditionFields.length) {
1276 if (orderByComparator.isAscending() ^ previous) {
1277 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1278 }
1279 else {
1280 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1281 }
1282 }
1283 else {
1284 if (orderByComparator.isAscending() ^ previous) {
1285 query.append(WHERE_GREATER_THAN);
1286 }
1287 else {
1288 query.append(WHERE_LESSER_THAN);
1289 }
1290 }
1291 }
1292
1293 query.append(ORDER_BY_CLAUSE);
1294
1295 String[] orderByFields = orderByComparator.getOrderByFields();
1296
1297 for (int i = 0; i < orderByFields.length; i++) {
1298 query.append(_ORDER_BY_ENTITY_ALIAS);
1299 query.append(orderByFields[i]);
1300
1301 if ((i + 1) < orderByFields.length) {
1302 if (orderByComparator.isAscending() ^ previous) {
1303 query.append(ORDER_BY_ASC_HAS_NEXT);
1304 }
1305 else {
1306 query.append(ORDER_BY_DESC_HAS_NEXT);
1307 }
1308 }
1309 else {
1310 if (orderByComparator.isAscending() ^ previous) {
1311 query.append(ORDER_BY_ASC);
1312 }
1313 else {
1314 query.append(ORDER_BY_DESC);
1315 }
1316 }
1317 }
1318 }
1319 else {
1320 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
1321 }
1322
1323 String sql = query.toString();
1324
1325 Query q = session.createQuery(sql);
1326
1327 q.setFirstResult(0);
1328 q.setMaxResults(2);
1329
1330 QueryPos qPos = QueryPos.getInstance(q);
1331
1332 qPos.add(companyId);
1333
1334 if (orderByComparator != null) {
1335 Object[] values = orderByComparator.getOrderByConditionValues(scProductEntry);
1336
1337 for (Object value : values) {
1338 qPos.add(value);
1339 }
1340 }
1341
1342 List<SCProductEntry> list = q.list();
1343
1344 if (list.size() == 2) {
1345 return list.get(1);
1346 }
1347 else {
1348 return null;
1349 }
1350 }
1351
1352
1358 public void removeByCompanyId(long companyId) throws SystemException {
1359 for (SCProductEntry scProductEntry : findByCompanyId(companyId,
1360 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
1361 remove(scProductEntry);
1362 }
1363 }
1364
1365
1372 public int countByCompanyId(long companyId) throws SystemException {
1373 FinderPath finderPath = FINDER_PATH_COUNT_BY_COMPANYID;
1374
1375 Object[] finderArgs = new Object[] { companyId };
1376
1377 Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
1378 this);
1379
1380 if (count == null) {
1381 StringBundler query = new StringBundler(2);
1382
1383 query.append(_SQL_COUNT_SCPRODUCTENTRY_WHERE);
1384
1385 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1386
1387 String sql = query.toString();
1388
1389 Session session = null;
1390
1391 try {
1392 session = openSession();
1393
1394 Query q = session.createQuery(sql);
1395
1396 QueryPos qPos = QueryPos.getInstance(q);
1397
1398 qPos.add(companyId);
1399
1400 count = (Long)q.uniqueResult();
1401
1402 FinderCacheUtil.putResult(finderPath, finderArgs, count);
1403 }
1404 catch (Exception e) {
1405 FinderCacheUtil.removeResult(finderPath, finderArgs);
1406
1407 throw processException(e);
1408 }
1409 finally {
1410 closeSession(session);
1411 }
1412 }
1413
1414 return count.intValue();
1415 }
1416
1417 private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "scProductEntry.companyId = ?";
1418 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_U = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
1419 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
1420 SCProductEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
1421 "findByG_U",
1422 new String[] {
1423 Long.class.getName(), Long.class.getName(),
1424
1425 Integer.class.getName(), Integer.class.getName(),
1426 OrderByComparator.class.getName()
1427 });
1428 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
1429 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
1430 SCProductEntryImpl.class,
1431 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_U",
1432 new String[] { Long.class.getName(), Long.class.getName() },
1433 SCProductEntryModelImpl.GROUPID_COLUMN_BITMASK |
1434 SCProductEntryModelImpl.USERID_COLUMN_BITMASK |
1435 SCProductEntryModelImpl.MODIFIEDDATE_COLUMN_BITMASK |
1436 SCProductEntryModelImpl.NAME_COLUMN_BITMASK);
1437 public static final FinderPath FINDER_PATH_COUNT_BY_G_U = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
1438 SCProductEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
1439 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_U",
1440 new String[] { Long.class.getName(), Long.class.getName() });
1441
1442
1450 public List<SCProductEntry> findByG_U(long groupId, long userId)
1451 throws SystemException {
1452 return findByG_U(groupId, userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1453 null);
1454 }
1455
1456
1470 public List<SCProductEntry> findByG_U(long groupId, long userId, int start,
1471 int end) throws SystemException {
1472 return findByG_U(groupId, userId, start, end, null);
1473 }
1474
1475
1490 public List<SCProductEntry> findByG_U(long groupId, long userId, int start,
1491 int end, OrderByComparator orderByComparator) throws SystemException {
1492 boolean pagination = true;
1493 FinderPath finderPath = null;
1494 Object[] finderArgs = null;
1495
1496 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1497 (orderByComparator == null)) {
1498 pagination = false;
1499 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U;
1500 finderArgs = new Object[] { groupId, userId };
1501 }
1502 else {
1503 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_U;
1504 finderArgs = new Object[] {
1505 groupId, userId,
1506
1507 start, end, orderByComparator
1508 };
1509 }
1510
1511 List<SCProductEntry> list = (List<SCProductEntry>)FinderCacheUtil.getResult(finderPath,
1512 finderArgs, this);
1513
1514 if ((list != null) && !list.isEmpty()) {
1515 for (SCProductEntry scProductEntry : list) {
1516 if ((groupId != scProductEntry.getGroupId()) ||
1517 (userId != scProductEntry.getUserId())) {
1518 list = null;
1519
1520 break;
1521 }
1522 }
1523 }
1524
1525 if (list == null) {
1526 StringBundler query = null;
1527
1528 if (orderByComparator != null) {
1529 query = new StringBundler(4 +
1530 (orderByComparator.getOrderByFields().length * 3));
1531 }
1532 else {
1533 query = new StringBundler(4);
1534 }
1535
1536 query.append(_SQL_SELECT_SCPRODUCTENTRY_WHERE);
1537
1538 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
1539
1540 query.append(_FINDER_COLUMN_G_U_USERID_2);
1541
1542 if (orderByComparator != null) {
1543 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1544 orderByComparator);
1545 }
1546 else
1547 if (pagination) {
1548 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
1549 }
1550
1551 String sql = query.toString();
1552
1553 Session session = null;
1554
1555 try {
1556 session = openSession();
1557
1558 Query q = session.createQuery(sql);
1559
1560 QueryPos qPos = QueryPos.getInstance(q);
1561
1562 qPos.add(groupId);
1563
1564 qPos.add(userId);
1565
1566 if (!pagination) {
1567 list = (List<SCProductEntry>)QueryUtil.list(q,
1568 getDialect(), start, end, false);
1569
1570 Collections.sort(list);
1571
1572 list = new UnmodifiableList<SCProductEntry>(list);
1573 }
1574 else {
1575 list = (List<SCProductEntry>)QueryUtil.list(q,
1576 getDialect(), start, end);
1577 }
1578
1579 cacheResult(list);
1580
1581 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1582 }
1583 catch (Exception e) {
1584 FinderCacheUtil.removeResult(finderPath, finderArgs);
1585
1586 throw processException(e);
1587 }
1588 finally {
1589 closeSession(session);
1590 }
1591 }
1592
1593 return list;
1594 }
1595
1596
1606 public SCProductEntry findByG_U_First(long groupId, long userId,
1607 OrderByComparator orderByComparator)
1608 throws NoSuchProductEntryException, SystemException {
1609 SCProductEntry scProductEntry = fetchByG_U_First(groupId, userId,
1610 orderByComparator);
1611
1612 if (scProductEntry != null) {
1613 return scProductEntry;
1614 }
1615
1616 StringBundler msg = new StringBundler(6);
1617
1618 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1619
1620 msg.append("groupId=");
1621 msg.append(groupId);
1622
1623 msg.append(", userId=");
1624 msg.append(userId);
1625
1626 msg.append(StringPool.CLOSE_CURLY_BRACE);
1627
1628 throw new NoSuchProductEntryException(msg.toString());
1629 }
1630
1631
1640 public SCProductEntry fetchByG_U_First(long groupId, long userId,
1641 OrderByComparator orderByComparator) throws SystemException {
1642 List<SCProductEntry> list = findByG_U(groupId, userId, 0, 1,
1643 orderByComparator);
1644
1645 if (!list.isEmpty()) {
1646 return list.get(0);
1647 }
1648
1649 return null;
1650 }
1651
1652
1662 public SCProductEntry findByG_U_Last(long groupId, long userId,
1663 OrderByComparator orderByComparator)
1664 throws NoSuchProductEntryException, SystemException {
1665 SCProductEntry scProductEntry = fetchByG_U_Last(groupId, userId,
1666 orderByComparator);
1667
1668 if (scProductEntry != null) {
1669 return scProductEntry;
1670 }
1671
1672 StringBundler msg = new StringBundler(6);
1673
1674 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1675
1676 msg.append("groupId=");
1677 msg.append(groupId);
1678
1679 msg.append(", userId=");
1680 msg.append(userId);
1681
1682 msg.append(StringPool.CLOSE_CURLY_BRACE);
1683
1684 throw new NoSuchProductEntryException(msg.toString());
1685 }
1686
1687
1696 public SCProductEntry fetchByG_U_Last(long groupId, long userId,
1697 OrderByComparator orderByComparator) throws SystemException {
1698 int count = countByG_U(groupId, userId);
1699
1700 List<SCProductEntry> list = findByG_U(groupId, userId, count - 1,
1701 count, orderByComparator);
1702
1703 if (!list.isEmpty()) {
1704 return list.get(0);
1705 }
1706
1707 return null;
1708 }
1709
1710
1721 public SCProductEntry[] findByG_U_PrevAndNext(long productEntryId,
1722 long groupId, long userId, OrderByComparator orderByComparator)
1723 throws NoSuchProductEntryException, SystemException {
1724 SCProductEntry scProductEntry = findByPrimaryKey(productEntryId);
1725
1726 Session session = null;
1727
1728 try {
1729 session = openSession();
1730
1731 SCProductEntry[] array = new SCProductEntryImpl[3];
1732
1733 array[0] = getByG_U_PrevAndNext(session, scProductEntry, groupId,
1734 userId, orderByComparator, true);
1735
1736 array[1] = scProductEntry;
1737
1738 array[2] = getByG_U_PrevAndNext(session, scProductEntry, groupId,
1739 userId, orderByComparator, false);
1740
1741 return array;
1742 }
1743 catch (Exception e) {
1744 throw processException(e);
1745 }
1746 finally {
1747 closeSession(session);
1748 }
1749 }
1750
1751 protected SCProductEntry getByG_U_PrevAndNext(Session session,
1752 SCProductEntry scProductEntry, long groupId, long userId,
1753 OrderByComparator orderByComparator, boolean previous) {
1754 StringBundler query = null;
1755
1756 if (orderByComparator != null) {
1757 query = new StringBundler(6 +
1758 (orderByComparator.getOrderByFields().length * 6));
1759 }
1760 else {
1761 query = new StringBundler(3);
1762 }
1763
1764 query.append(_SQL_SELECT_SCPRODUCTENTRY_WHERE);
1765
1766 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
1767
1768 query.append(_FINDER_COLUMN_G_U_USERID_2);
1769
1770 if (orderByComparator != null) {
1771 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1772
1773 if (orderByConditionFields.length > 0) {
1774 query.append(WHERE_AND);
1775 }
1776
1777 for (int i = 0; i < orderByConditionFields.length; i++) {
1778 query.append(_ORDER_BY_ENTITY_ALIAS);
1779 query.append(orderByConditionFields[i]);
1780
1781 if ((i + 1) < orderByConditionFields.length) {
1782 if (orderByComparator.isAscending() ^ previous) {
1783 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1784 }
1785 else {
1786 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1787 }
1788 }
1789 else {
1790 if (orderByComparator.isAscending() ^ previous) {
1791 query.append(WHERE_GREATER_THAN);
1792 }
1793 else {
1794 query.append(WHERE_LESSER_THAN);
1795 }
1796 }
1797 }
1798
1799 query.append(ORDER_BY_CLAUSE);
1800
1801 String[] orderByFields = orderByComparator.getOrderByFields();
1802
1803 for (int i = 0; i < orderByFields.length; i++) {
1804 query.append(_ORDER_BY_ENTITY_ALIAS);
1805 query.append(orderByFields[i]);
1806
1807 if ((i + 1) < orderByFields.length) {
1808 if (orderByComparator.isAscending() ^ previous) {
1809 query.append(ORDER_BY_ASC_HAS_NEXT);
1810 }
1811 else {
1812 query.append(ORDER_BY_DESC_HAS_NEXT);
1813 }
1814 }
1815 else {
1816 if (orderByComparator.isAscending() ^ previous) {
1817 query.append(ORDER_BY_ASC);
1818 }
1819 else {
1820 query.append(ORDER_BY_DESC);
1821 }
1822 }
1823 }
1824 }
1825 else {
1826 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
1827 }
1828
1829 String sql = query.toString();
1830
1831 Query q = session.createQuery(sql);
1832
1833 q.setFirstResult(0);
1834 q.setMaxResults(2);
1835
1836 QueryPos qPos = QueryPos.getInstance(q);
1837
1838 qPos.add(groupId);
1839
1840 qPos.add(userId);
1841
1842 if (orderByComparator != null) {
1843 Object[] values = orderByComparator.getOrderByConditionValues(scProductEntry);
1844
1845 for (Object value : values) {
1846 qPos.add(value);
1847 }
1848 }
1849
1850 List<SCProductEntry> list = q.list();
1851
1852 if (list.size() == 2) {
1853 return list.get(1);
1854 }
1855 else {
1856 return null;
1857 }
1858 }
1859
1860
1868 public List<SCProductEntry> filterFindByG_U(long groupId, long userId)
1869 throws SystemException {
1870 return filterFindByG_U(groupId, userId, QueryUtil.ALL_POS,
1871 QueryUtil.ALL_POS, null);
1872 }
1873
1874
1888 public List<SCProductEntry> filterFindByG_U(long groupId, long userId,
1889 int start, int end) throws SystemException {
1890 return filterFindByG_U(groupId, userId, start, end, null);
1891 }
1892
1893
1908 public List<SCProductEntry> filterFindByG_U(long groupId, long userId,
1909 int start, int end, OrderByComparator orderByComparator)
1910 throws SystemException {
1911 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1912 return findByG_U(groupId, userId, start, end, orderByComparator);
1913 }
1914
1915 StringBundler query = null;
1916
1917 if (orderByComparator != null) {
1918 query = new StringBundler(4 +
1919 (orderByComparator.getOrderByFields().length * 3));
1920 }
1921 else {
1922 query = new StringBundler(4);
1923 }
1924
1925 if (getDB().isSupportsInlineDistinct()) {
1926 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_WHERE);
1927 }
1928 else {
1929 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_1);
1930 }
1931
1932 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
1933
1934 query.append(_FINDER_COLUMN_G_U_USERID_2);
1935
1936 if (!getDB().isSupportsInlineDistinct()) {
1937 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_2);
1938 }
1939
1940 if (orderByComparator != null) {
1941 if (getDB().isSupportsInlineDistinct()) {
1942 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1943 orderByComparator);
1944 }
1945 else {
1946 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1947 orderByComparator);
1948 }
1949 }
1950 else {
1951 if (getDB().isSupportsInlineDistinct()) {
1952 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
1953 }
1954 else {
1955 query.append(SCProductEntryModelImpl.ORDER_BY_SQL);
1956 }
1957 }
1958
1959 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1960 SCProductEntry.class.getName(),
1961 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
1962
1963 Session session = null;
1964
1965 try {
1966 session = openSession();
1967
1968 SQLQuery q = session.createSQLQuery(sql);
1969
1970 if (getDB().isSupportsInlineDistinct()) {
1971 q.addEntity(_FILTER_ENTITY_ALIAS, SCProductEntryImpl.class);
1972 }
1973 else {
1974 q.addEntity(_FILTER_ENTITY_TABLE, SCProductEntryImpl.class);
1975 }
1976
1977 QueryPos qPos = QueryPos.getInstance(q);
1978
1979 qPos.add(groupId);
1980
1981 qPos.add(userId);
1982
1983 return (List<SCProductEntry>)QueryUtil.list(q, getDialect(), start,
1984 end);
1985 }
1986 catch (Exception e) {
1987 throw processException(e);
1988 }
1989 finally {
1990 closeSession(session);
1991 }
1992 }
1993
1994
2005 public SCProductEntry[] filterFindByG_U_PrevAndNext(long productEntryId,
2006 long groupId, long userId, OrderByComparator orderByComparator)
2007 throws NoSuchProductEntryException, SystemException {
2008 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2009 return findByG_U_PrevAndNext(productEntryId, groupId, userId,
2010 orderByComparator);
2011 }
2012
2013 SCProductEntry scProductEntry = findByPrimaryKey(productEntryId);
2014
2015 Session session = null;
2016
2017 try {
2018 session = openSession();
2019
2020 SCProductEntry[] array = new SCProductEntryImpl[3];
2021
2022 array[0] = filterGetByG_U_PrevAndNext(session, scProductEntry,
2023 groupId, userId, orderByComparator, true);
2024
2025 array[1] = scProductEntry;
2026
2027 array[2] = filterGetByG_U_PrevAndNext(session, scProductEntry,
2028 groupId, userId, orderByComparator, false);
2029
2030 return array;
2031 }
2032 catch (Exception e) {
2033 throw processException(e);
2034 }
2035 finally {
2036 closeSession(session);
2037 }
2038 }
2039
2040 protected SCProductEntry filterGetByG_U_PrevAndNext(Session session,
2041 SCProductEntry scProductEntry, long groupId, long userId,
2042 OrderByComparator orderByComparator, boolean previous) {
2043 StringBundler query = null;
2044
2045 if (orderByComparator != null) {
2046 query = new StringBundler(6 +
2047 (orderByComparator.getOrderByFields().length * 6));
2048 }
2049 else {
2050 query = new StringBundler(3);
2051 }
2052
2053 if (getDB().isSupportsInlineDistinct()) {
2054 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_WHERE);
2055 }
2056 else {
2057 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_1);
2058 }
2059
2060 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
2061
2062 query.append(_FINDER_COLUMN_G_U_USERID_2);
2063
2064 if (!getDB().isSupportsInlineDistinct()) {
2065 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_2);
2066 }
2067
2068 if (orderByComparator != null) {
2069 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2070
2071 if (orderByConditionFields.length > 0) {
2072 query.append(WHERE_AND);
2073 }
2074
2075 for (int i = 0; i < orderByConditionFields.length; i++) {
2076 if (getDB().isSupportsInlineDistinct()) {
2077 query.append(_ORDER_BY_ENTITY_ALIAS);
2078 }
2079 else {
2080 query.append(_ORDER_BY_ENTITY_TABLE);
2081 }
2082
2083 query.append(orderByConditionFields[i]);
2084
2085 if ((i + 1) < orderByConditionFields.length) {
2086 if (orderByComparator.isAscending() ^ previous) {
2087 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2088 }
2089 else {
2090 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2091 }
2092 }
2093 else {
2094 if (orderByComparator.isAscending() ^ previous) {
2095 query.append(WHERE_GREATER_THAN);
2096 }
2097 else {
2098 query.append(WHERE_LESSER_THAN);
2099 }
2100 }
2101 }
2102
2103 query.append(ORDER_BY_CLAUSE);
2104
2105 String[] orderByFields = orderByComparator.getOrderByFields();
2106
2107 for (int i = 0; i < orderByFields.length; i++) {
2108 if (getDB().isSupportsInlineDistinct()) {
2109 query.append(_ORDER_BY_ENTITY_ALIAS);
2110 }
2111 else {
2112 query.append(_ORDER_BY_ENTITY_TABLE);
2113 }
2114
2115 query.append(orderByFields[i]);
2116
2117 if ((i + 1) < orderByFields.length) {
2118 if (orderByComparator.isAscending() ^ previous) {
2119 query.append(ORDER_BY_ASC_HAS_NEXT);
2120 }
2121 else {
2122 query.append(ORDER_BY_DESC_HAS_NEXT);
2123 }
2124 }
2125 else {
2126 if (orderByComparator.isAscending() ^ previous) {
2127 query.append(ORDER_BY_ASC);
2128 }
2129 else {
2130 query.append(ORDER_BY_DESC);
2131 }
2132 }
2133 }
2134 }
2135 else {
2136 if (getDB().isSupportsInlineDistinct()) {
2137 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
2138 }
2139 else {
2140 query.append(SCProductEntryModelImpl.ORDER_BY_SQL);
2141 }
2142 }
2143
2144 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2145 SCProductEntry.class.getName(),
2146 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
2147
2148 SQLQuery q = session.createSQLQuery(sql);
2149
2150 q.setFirstResult(0);
2151 q.setMaxResults(2);
2152
2153 if (getDB().isSupportsInlineDistinct()) {
2154 q.addEntity(_FILTER_ENTITY_ALIAS, SCProductEntryImpl.class);
2155 }
2156 else {
2157 q.addEntity(_FILTER_ENTITY_TABLE, SCProductEntryImpl.class);
2158 }
2159
2160 QueryPos qPos = QueryPos.getInstance(q);
2161
2162 qPos.add(groupId);
2163
2164 qPos.add(userId);
2165
2166 if (orderByComparator != null) {
2167 Object[] values = orderByComparator.getOrderByConditionValues(scProductEntry);
2168
2169 for (Object value : values) {
2170 qPos.add(value);
2171 }
2172 }
2173
2174 List<SCProductEntry> list = q.list();
2175
2176 if (list.size() == 2) {
2177 return list.get(1);
2178 }
2179 else {
2180 return null;
2181 }
2182 }
2183
2184
2191 public void removeByG_U(long groupId, long userId)
2192 throws SystemException {
2193 for (SCProductEntry scProductEntry : findByG_U(groupId, userId,
2194 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
2195 remove(scProductEntry);
2196 }
2197 }
2198
2199
2207 public int countByG_U(long groupId, long userId) throws SystemException {
2208 FinderPath finderPath = FINDER_PATH_COUNT_BY_G_U;
2209
2210 Object[] finderArgs = new Object[] { groupId, userId };
2211
2212 Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
2213 this);
2214
2215 if (count == null) {
2216 StringBundler query = new StringBundler(3);
2217
2218 query.append(_SQL_COUNT_SCPRODUCTENTRY_WHERE);
2219
2220 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
2221
2222 query.append(_FINDER_COLUMN_G_U_USERID_2);
2223
2224 String sql = query.toString();
2225
2226 Session session = null;
2227
2228 try {
2229 session = openSession();
2230
2231 Query q = session.createQuery(sql);
2232
2233 QueryPos qPos = QueryPos.getInstance(q);
2234
2235 qPos.add(groupId);
2236
2237 qPos.add(userId);
2238
2239 count = (Long)q.uniqueResult();
2240
2241 FinderCacheUtil.putResult(finderPath, finderArgs, count);
2242 }
2243 catch (Exception e) {
2244 FinderCacheUtil.removeResult(finderPath, finderArgs);
2245
2246 throw processException(e);
2247 }
2248 finally {
2249 closeSession(session);
2250 }
2251 }
2252
2253 return count.intValue();
2254 }
2255
2256
2264 public int filterCountByG_U(long groupId, long userId)
2265 throws SystemException {
2266 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2267 return countByG_U(groupId, userId);
2268 }
2269
2270 StringBundler query = new StringBundler(3);
2271
2272 query.append(_FILTER_SQL_COUNT_SCPRODUCTENTRY_WHERE);
2273
2274 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
2275
2276 query.append(_FINDER_COLUMN_G_U_USERID_2);
2277
2278 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2279 SCProductEntry.class.getName(),
2280 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
2281
2282 Session session = null;
2283
2284 try {
2285 session = openSession();
2286
2287 SQLQuery q = session.createSQLQuery(sql);
2288
2289 q.addScalar(COUNT_COLUMN_NAME,
2290 com.liferay.portal.kernel.dao.orm.Type.LONG);
2291
2292 QueryPos qPos = QueryPos.getInstance(q);
2293
2294 qPos.add(groupId);
2295
2296 qPos.add(userId);
2297
2298 Long count = (Long)q.uniqueResult();
2299
2300 return count.intValue();
2301 }
2302 catch (Exception e) {
2303 throw processException(e);
2304 }
2305 finally {
2306 closeSession(session);
2307 }
2308 }
2309
2310 private static final String _FINDER_COLUMN_G_U_GROUPID_2 = "scProductEntry.groupId = ? AND ";
2311 private static final String _FINDER_COLUMN_G_U_USERID_2 = "scProductEntry.userId = ?";
2312 public static final FinderPath FINDER_PATH_FETCH_BY_RG_RA = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
2313 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
2314 SCProductEntryImpl.class, FINDER_CLASS_NAME_ENTITY, "fetchByRG_RA",
2315 new String[] { String.class.getName(), String.class.getName() },
2316 SCProductEntryModelImpl.REPOGROUPID_COLUMN_BITMASK |
2317 SCProductEntryModelImpl.REPOARTIFACTID_COLUMN_BITMASK);
2318 public static final FinderPath FINDER_PATH_COUNT_BY_RG_RA = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
2319 SCProductEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
2320 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByRG_RA",
2321 new String[] { String.class.getName(), String.class.getName() });
2322
2323
2332 public SCProductEntry findByRG_RA(String repoGroupId, String repoArtifactId)
2333 throws NoSuchProductEntryException, SystemException {
2334 SCProductEntry scProductEntry = fetchByRG_RA(repoGroupId, repoArtifactId);
2335
2336 if (scProductEntry == null) {
2337 StringBundler msg = new StringBundler(6);
2338
2339 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2340
2341 msg.append("repoGroupId=");
2342 msg.append(repoGroupId);
2343
2344 msg.append(", repoArtifactId=");
2345 msg.append(repoArtifactId);
2346
2347 msg.append(StringPool.CLOSE_CURLY_BRACE);
2348
2349 if (_log.isWarnEnabled()) {
2350 _log.warn(msg.toString());
2351 }
2352
2353 throw new NoSuchProductEntryException(msg.toString());
2354 }
2355
2356 return scProductEntry;
2357 }
2358
2359
2367 public SCProductEntry fetchByRG_RA(String repoGroupId, String repoArtifactId)
2368 throws SystemException {
2369 return fetchByRG_RA(repoGroupId, repoArtifactId, true);
2370 }
2371
2372
2381 public SCProductEntry fetchByRG_RA(String repoGroupId,
2382 String repoArtifactId, boolean retrieveFromCache)
2383 throws SystemException {
2384 Object[] finderArgs = new Object[] { repoGroupId, repoArtifactId };
2385
2386 Object result = null;
2387
2388 if (retrieveFromCache) {
2389 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_RG_RA,
2390 finderArgs, this);
2391 }
2392
2393 if (result instanceof SCProductEntry) {
2394 SCProductEntry scProductEntry = (SCProductEntry)result;
2395
2396 if (!Validator.equals(repoGroupId, scProductEntry.getRepoGroupId()) ||
2397 !Validator.equals(repoArtifactId,
2398 scProductEntry.getRepoArtifactId())) {
2399 result = null;
2400 }
2401 }
2402
2403 if (result == null) {
2404 StringBundler query = new StringBundler(4);
2405
2406 query.append(_SQL_SELECT_SCPRODUCTENTRY_WHERE);
2407
2408 if (repoGroupId == null) {
2409 query.append(_FINDER_COLUMN_RG_RA_REPOGROUPID_1);
2410 }
2411 else {
2412 if (repoGroupId.equals(StringPool.BLANK)) {
2413 query.append(_FINDER_COLUMN_RG_RA_REPOGROUPID_3);
2414 }
2415 else {
2416 query.append(_FINDER_COLUMN_RG_RA_REPOGROUPID_2);
2417 }
2418 }
2419
2420 if (repoArtifactId == null) {
2421 query.append(_FINDER_COLUMN_RG_RA_REPOARTIFACTID_1);
2422 }
2423 else {
2424 if (repoArtifactId.equals(StringPool.BLANK)) {
2425 query.append(_FINDER_COLUMN_RG_RA_REPOARTIFACTID_3);
2426 }
2427 else {
2428 query.append(_FINDER_COLUMN_RG_RA_REPOARTIFACTID_2);
2429 }
2430 }
2431
2432 String sql = query.toString();
2433
2434 Session session = null;
2435
2436 try {
2437 session = openSession();
2438
2439 Query q = session.createQuery(sql);
2440
2441 QueryPos qPos = QueryPos.getInstance(q);
2442
2443 if (repoGroupId != null) {
2444 qPos.add(repoGroupId);
2445 }
2446
2447 if (repoArtifactId != null) {
2448 qPos.add(repoArtifactId);
2449 }
2450
2451 List<SCProductEntry> list = q.list();
2452
2453 if (list.isEmpty()) {
2454 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_RG_RA,
2455 finderArgs, list);
2456 }
2457 else {
2458 if ((list.size() > 1) && _log.isWarnEnabled()) {
2459 _log.warn(
2460 "SCProductEntryPersistenceImpl.fetchByRG_RA(String, String, boolean) with parameters (" +
2461 StringUtil.merge(finderArgs) +
2462 ") 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.");
2463 }
2464
2465 SCProductEntry scProductEntry = list.get(0);
2466
2467 result = scProductEntry;
2468
2469 cacheResult(scProductEntry);
2470
2471 if ((scProductEntry.getRepoGroupId() == null) ||
2472 !scProductEntry.getRepoGroupId().equals(repoGroupId) ||
2473 (scProductEntry.getRepoArtifactId() == null) ||
2474 !scProductEntry.getRepoArtifactId()
2475 .equals(repoArtifactId)) {
2476 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_RG_RA,
2477 finderArgs, scProductEntry);
2478 }
2479 }
2480 }
2481 catch (Exception e) {
2482 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_RG_RA,
2483 finderArgs);
2484
2485 throw processException(e);
2486 }
2487 finally {
2488 closeSession(session);
2489 }
2490 }
2491
2492 if (result instanceof List<?>) {
2493 return null;
2494 }
2495 else {
2496 return (SCProductEntry)result;
2497 }
2498 }
2499
2500
2508 public SCProductEntry removeByRG_RA(String repoGroupId,
2509 String repoArtifactId)
2510 throws NoSuchProductEntryException, SystemException {
2511 SCProductEntry scProductEntry = findByRG_RA(repoGroupId, repoArtifactId);
2512
2513 return remove(scProductEntry);
2514 }
2515
2516
2524 public int countByRG_RA(String repoGroupId, String repoArtifactId)
2525 throws SystemException {
2526 FinderPath finderPath = FINDER_PATH_COUNT_BY_RG_RA;
2527
2528 Object[] finderArgs = new Object[] { repoGroupId, repoArtifactId };
2529
2530 Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
2531 this);
2532
2533 if (count == null) {
2534 StringBundler query = new StringBundler(3);
2535
2536 query.append(_SQL_COUNT_SCPRODUCTENTRY_WHERE);
2537
2538 if (repoGroupId == null) {
2539 query.append(_FINDER_COLUMN_RG_RA_REPOGROUPID_1);
2540 }
2541 else {
2542 if (repoGroupId.equals(StringPool.BLANK)) {
2543 query.append(_FINDER_COLUMN_RG_RA_REPOGROUPID_3);
2544 }
2545 else {
2546 query.append(_FINDER_COLUMN_RG_RA_REPOGROUPID_2);
2547 }
2548 }
2549
2550 if (repoArtifactId == null) {
2551 query.append(_FINDER_COLUMN_RG_RA_REPOARTIFACTID_1);
2552 }
2553 else {
2554 if (repoArtifactId.equals(StringPool.BLANK)) {
2555 query.append(_FINDER_COLUMN_RG_RA_REPOARTIFACTID_3);
2556 }
2557 else {
2558 query.append(_FINDER_COLUMN_RG_RA_REPOARTIFACTID_2);
2559 }
2560 }
2561
2562 String sql = query.toString();
2563
2564 Session session = null;
2565
2566 try {
2567 session = openSession();
2568
2569 Query q = session.createQuery(sql);
2570
2571 QueryPos qPos = QueryPos.getInstance(q);
2572
2573 if (repoGroupId != null) {
2574 qPos.add(repoGroupId);
2575 }
2576
2577 if (repoArtifactId != null) {
2578 qPos.add(repoArtifactId);
2579 }
2580
2581 count = (Long)q.uniqueResult();
2582
2583 FinderCacheUtil.putResult(finderPath, finderArgs, count);
2584 }
2585 catch (Exception e) {
2586 FinderCacheUtil.removeResult(finderPath, finderArgs);
2587
2588 throw processException(e);
2589 }
2590 finally {
2591 closeSession(session);
2592 }
2593 }
2594
2595 return count.intValue();
2596 }
2597
2598 private static final String _FINDER_COLUMN_RG_RA_REPOGROUPID_1 = "scProductEntry.repoGroupId IS NULL AND ";
2599 private static final String _FINDER_COLUMN_RG_RA_REPOGROUPID_2 = "lower(scProductEntry.repoGroupId) = lower(CAST_TEXT(?)) AND ";
2600 private static final String _FINDER_COLUMN_RG_RA_REPOGROUPID_3 = "(scProductEntry.repoGroupId IS NULL OR lower(scProductEntry.repoGroupId) = lower(CAST_TEXT(?))) AND ";
2601 private static final String _FINDER_COLUMN_RG_RA_REPOARTIFACTID_1 = "scProductEntry.repoArtifactId IS NULL";
2602 private static final String _FINDER_COLUMN_RG_RA_REPOARTIFACTID_2 = "lower(scProductEntry.repoArtifactId) = lower(CAST_TEXT(?))";
2603 private static final String _FINDER_COLUMN_RG_RA_REPOARTIFACTID_3 = "(scProductEntry.repoArtifactId IS NULL OR lower(scProductEntry.repoArtifactId) = lower(CAST_TEXT(?)))";
2604
2605
2610 public void cacheResult(SCProductEntry scProductEntry) {
2611 EntityCacheUtil.putResult(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
2612 SCProductEntryImpl.class, scProductEntry.getPrimaryKey(),
2613 scProductEntry);
2614
2615 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_RG_RA,
2616 new Object[] {
2617 scProductEntry.getRepoGroupId(),
2618
2619 scProductEntry.getRepoArtifactId()
2620 }, scProductEntry);
2621
2622 scProductEntry.resetOriginalValues();
2623 }
2624
2625
2630 public void cacheResult(List<SCProductEntry> scProductEntries) {
2631 for (SCProductEntry scProductEntry : scProductEntries) {
2632 if (EntityCacheUtil.getResult(
2633 SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
2634 SCProductEntryImpl.class, scProductEntry.getPrimaryKey()) == null) {
2635 cacheResult(scProductEntry);
2636 }
2637 else {
2638 scProductEntry.resetOriginalValues();
2639 }
2640 }
2641 }
2642
2643
2650 @Override
2651 public void clearCache() {
2652 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
2653 CacheRegistryUtil.clear(SCProductEntryImpl.class.getName());
2654 }
2655
2656 EntityCacheUtil.clearCache(SCProductEntryImpl.class.getName());
2657
2658 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
2659 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
2660 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2661 }
2662
2663
2670 @Override
2671 public void clearCache(SCProductEntry scProductEntry) {
2672 EntityCacheUtil.removeResult(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
2673 SCProductEntryImpl.class, scProductEntry.getPrimaryKey());
2674
2675 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
2676 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2677
2678 clearUniqueFindersCache(scProductEntry);
2679 }
2680
2681 @Override
2682 public void clearCache(List<SCProductEntry> scProductEntries) {
2683 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
2684 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2685
2686 for (SCProductEntry scProductEntry : scProductEntries) {
2687 EntityCacheUtil.removeResult(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
2688 SCProductEntryImpl.class, scProductEntry.getPrimaryKey());
2689
2690 clearUniqueFindersCache(scProductEntry);
2691 }
2692 }
2693
2694 protected void cacheUniqueFindersCache(SCProductEntry scProductEntry) {
2695 if (scProductEntry.isNew()) {
2696 Object[] args = new Object[] {
2697 scProductEntry.getRepoGroupId(),
2698
2699 scProductEntry.getRepoArtifactId()
2700 };
2701
2702 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_RG_RA, args,
2703 Long.valueOf(1));
2704 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_RG_RA, args,
2705 scProductEntry);
2706 }
2707 else {
2708 SCProductEntryModelImpl scProductEntryModelImpl = (SCProductEntryModelImpl)scProductEntry;
2709
2710 if ((scProductEntryModelImpl.getColumnBitmask() &
2711 FINDER_PATH_FETCH_BY_RG_RA.getColumnBitmask()) != 0) {
2712 Object[] args = new Object[] {
2713 scProductEntry.getRepoGroupId(),
2714
2715 scProductEntry.getRepoArtifactId()
2716 };
2717
2718 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_RG_RA, args,
2719 Long.valueOf(1));
2720 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_RG_RA, args,
2721 scProductEntry);
2722 }
2723 }
2724 }
2725
2726 protected void clearUniqueFindersCache(SCProductEntry scProductEntry) {
2727 SCProductEntryModelImpl scProductEntryModelImpl = (SCProductEntryModelImpl)scProductEntry;
2728
2729 Object[] args = new Object[] {
2730 scProductEntry.getRepoGroupId(),
2731
2732 scProductEntry.getRepoArtifactId()
2733 };
2734
2735 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_RG_RA, args);
2736 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_RG_RA, args);
2737
2738 if ((scProductEntryModelImpl.getColumnBitmask() &
2739 FINDER_PATH_FETCH_BY_RG_RA.getColumnBitmask()) != 0) {
2740 args = new Object[] {
2741 scProductEntryModelImpl.getOriginalRepoGroupId(),
2742
2743 scProductEntryModelImpl.getOriginalRepoArtifactId()
2744 };
2745
2746 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_RG_RA, args);
2747 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_RG_RA, args);
2748 }
2749 }
2750
2751
2757 public SCProductEntry create(long productEntryId) {
2758 SCProductEntry scProductEntry = new SCProductEntryImpl();
2759
2760 scProductEntry.setNew(true);
2761 scProductEntry.setPrimaryKey(productEntryId);
2762
2763 return scProductEntry;
2764 }
2765
2766
2774 public SCProductEntry remove(long productEntryId)
2775 throws NoSuchProductEntryException, SystemException {
2776 return remove(Long.valueOf(productEntryId));
2777 }
2778
2779
2787 @Override
2788 public SCProductEntry remove(Serializable primaryKey)
2789 throws NoSuchProductEntryException, SystemException {
2790 Session session = null;
2791
2792 try {
2793 session = openSession();
2794
2795 SCProductEntry scProductEntry = (SCProductEntry)session.get(SCProductEntryImpl.class,
2796 primaryKey);
2797
2798 if (scProductEntry == null) {
2799 if (_log.isWarnEnabled()) {
2800 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
2801 }
2802
2803 throw new NoSuchProductEntryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
2804 primaryKey);
2805 }
2806
2807 return remove(scProductEntry);
2808 }
2809 catch (NoSuchProductEntryException nsee) {
2810 throw nsee;
2811 }
2812 catch (Exception e) {
2813 throw processException(e);
2814 }
2815 finally {
2816 closeSession(session);
2817 }
2818 }
2819
2820 @Override
2821 protected SCProductEntry removeImpl(SCProductEntry scProductEntry)
2822 throws SystemException {
2823 scProductEntry = toUnwrappedModel(scProductEntry);
2824
2825 try {
2826 clearSCLicenses.clear(scProductEntry.getPrimaryKey());
2827 }
2828 catch (Exception e) {
2829 throw processException(e);
2830 }
2831 finally {
2832 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
2833 }
2834
2835 Session session = null;
2836
2837 try {
2838 session = openSession();
2839
2840 if (!session.contains(scProductEntry)) {
2841 scProductEntry = (SCProductEntry)session.get(SCProductEntryImpl.class,
2842 scProductEntry.getPrimaryKeyObj());
2843 }
2844
2845 if (scProductEntry != null) {
2846 session.delete(scProductEntry);
2847 }
2848 }
2849 catch (Exception e) {
2850 throw processException(e);
2851 }
2852 finally {
2853 closeSession(session);
2854 }
2855
2856 if (scProductEntry != null) {
2857 clearCache(scProductEntry);
2858 }
2859
2860 return scProductEntry;
2861 }
2862
2863 @Override
2864 public SCProductEntry updateImpl(
2865 com.liferay.portlet.softwarecatalog.model.SCProductEntry scProductEntry)
2866 throws SystemException {
2867 scProductEntry = toUnwrappedModel(scProductEntry);
2868
2869 boolean isNew = scProductEntry.isNew();
2870
2871 SCProductEntryModelImpl scProductEntryModelImpl = (SCProductEntryModelImpl)scProductEntry;
2872
2873 Session session = null;
2874
2875 try {
2876 session = openSession();
2877
2878 if (scProductEntry.isNew()) {
2879 session.save(scProductEntry);
2880
2881 scProductEntry.setNew(false);
2882 }
2883 else {
2884 session.merge(scProductEntry);
2885 }
2886 }
2887 catch (Exception e) {
2888 throw processException(e);
2889 }
2890 finally {
2891 closeSession(session);
2892 }
2893
2894 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
2895
2896 if (isNew || !SCProductEntryModelImpl.COLUMN_BITMASK_ENABLED) {
2897 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2898 }
2899
2900 else {
2901 if ((scProductEntryModelImpl.getColumnBitmask() &
2902 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID.getColumnBitmask()) != 0) {
2903 Object[] args = new Object[] {
2904 Long.valueOf(scProductEntryModelImpl.getOriginalGroupId())
2905 };
2906
2907 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
2908 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
2909 args);
2910
2911 args = new Object[] {
2912 Long.valueOf(scProductEntryModelImpl.getGroupId())
2913 };
2914
2915 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
2916 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
2917 args);
2918 }
2919
2920 if ((scProductEntryModelImpl.getColumnBitmask() &
2921 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID.getColumnBitmask()) != 0) {
2922 Object[] args = new Object[] {
2923 Long.valueOf(scProductEntryModelImpl.getOriginalCompanyId())
2924 };
2925
2926 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID,
2927 args);
2928 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
2929 args);
2930
2931 args = new Object[] {
2932 Long.valueOf(scProductEntryModelImpl.getCompanyId())
2933 };
2934
2935 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID,
2936 args);
2937 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
2938 args);
2939 }
2940
2941 if ((scProductEntryModelImpl.getColumnBitmask() &
2942 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U.getColumnBitmask()) != 0) {
2943 Object[] args = new Object[] {
2944 Long.valueOf(scProductEntryModelImpl.getOriginalGroupId()),
2945 Long.valueOf(scProductEntryModelImpl.getOriginalUserId())
2946 };
2947
2948 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_U, args);
2949 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U,
2950 args);
2951
2952 args = new Object[] {
2953 Long.valueOf(scProductEntryModelImpl.getGroupId()),
2954 Long.valueOf(scProductEntryModelImpl.getUserId())
2955 };
2956
2957 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_U, args);
2958 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U,
2959 args);
2960 }
2961 }
2962
2963 EntityCacheUtil.putResult(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
2964 SCProductEntryImpl.class, scProductEntry.getPrimaryKey(),
2965 scProductEntry);
2966
2967 clearUniqueFindersCache(scProductEntry);
2968 cacheUniqueFindersCache(scProductEntry);
2969
2970 return scProductEntry;
2971 }
2972
2973 protected SCProductEntry toUnwrappedModel(SCProductEntry scProductEntry) {
2974 if (scProductEntry instanceof SCProductEntryImpl) {
2975 return scProductEntry;
2976 }
2977
2978 SCProductEntryImpl scProductEntryImpl = new SCProductEntryImpl();
2979
2980 scProductEntryImpl.setNew(scProductEntry.isNew());
2981 scProductEntryImpl.setPrimaryKey(scProductEntry.getPrimaryKey());
2982
2983 scProductEntryImpl.setProductEntryId(scProductEntry.getProductEntryId());
2984 scProductEntryImpl.setGroupId(scProductEntry.getGroupId());
2985 scProductEntryImpl.setCompanyId(scProductEntry.getCompanyId());
2986 scProductEntryImpl.setUserId(scProductEntry.getUserId());
2987 scProductEntryImpl.setUserName(scProductEntry.getUserName());
2988 scProductEntryImpl.setCreateDate(scProductEntry.getCreateDate());
2989 scProductEntryImpl.setModifiedDate(scProductEntry.getModifiedDate());
2990 scProductEntryImpl.setName(scProductEntry.getName());
2991 scProductEntryImpl.setType(scProductEntry.getType());
2992 scProductEntryImpl.setTags(scProductEntry.getTags());
2993 scProductEntryImpl.setShortDescription(scProductEntry.getShortDescription());
2994 scProductEntryImpl.setLongDescription(scProductEntry.getLongDescription());
2995 scProductEntryImpl.setPageURL(scProductEntry.getPageURL());
2996 scProductEntryImpl.setAuthor(scProductEntry.getAuthor());
2997 scProductEntryImpl.setRepoGroupId(scProductEntry.getRepoGroupId());
2998 scProductEntryImpl.setRepoArtifactId(scProductEntry.getRepoArtifactId());
2999
3000 return scProductEntryImpl;
3001 }
3002
3003
3011 @Override
3012 public SCProductEntry findByPrimaryKey(Serializable primaryKey)
3013 throws NoSuchModelException, SystemException {
3014 return findByPrimaryKey(((Long)primaryKey).longValue());
3015 }
3016
3017
3025 public SCProductEntry findByPrimaryKey(long productEntryId)
3026 throws NoSuchProductEntryException, SystemException {
3027 SCProductEntry scProductEntry = fetchByPrimaryKey(productEntryId);
3028
3029 if (scProductEntry == null) {
3030 if (_log.isWarnEnabled()) {
3031 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + productEntryId);
3032 }
3033
3034 throw new NoSuchProductEntryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
3035 productEntryId);
3036 }
3037
3038 return scProductEntry;
3039 }
3040
3041
3048 @Override
3049 public SCProductEntry fetchByPrimaryKey(Serializable primaryKey)
3050 throws SystemException {
3051 return fetchByPrimaryKey(((Long)primaryKey).longValue());
3052 }
3053
3054
3061 public SCProductEntry fetchByPrimaryKey(long productEntryId)
3062 throws SystemException {
3063 SCProductEntry scProductEntry = (SCProductEntry)EntityCacheUtil.getResult(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
3064 SCProductEntryImpl.class, productEntryId);
3065
3066 if (scProductEntry == _nullSCProductEntry) {
3067 return null;
3068 }
3069
3070 if (scProductEntry == null) {
3071 Session session = null;
3072
3073 try {
3074 session = openSession();
3075
3076 scProductEntry = (SCProductEntry)session.get(SCProductEntryImpl.class,
3077 Long.valueOf(productEntryId));
3078
3079 if (scProductEntry != null) {
3080 cacheResult(scProductEntry);
3081 }
3082 else {
3083 EntityCacheUtil.putResult(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
3084 SCProductEntryImpl.class, productEntryId,
3085 _nullSCProductEntry);
3086 }
3087 }
3088 catch (Exception e) {
3089 EntityCacheUtil.removeResult(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
3090 SCProductEntryImpl.class, productEntryId);
3091
3092 throw processException(e);
3093 }
3094 finally {
3095 closeSession(session);
3096 }
3097 }
3098
3099 return scProductEntry;
3100 }
3101
3102
3108 public List<SCProductEntry> findAll() throws SystemException {
3109 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
3110 }
3111
3112
3124 public List<SCProductEntry> findAll(int start, int end)
3125 throws SystemException {
3126 return findAll(start, end, null);
3127 }
3128
3129
3142 public List<SCProductEntry> findAll(int start, int end,
3143 OrderByComparator orderByComparator) throws SystemException {
3144 boolean pagination = true;
3145 FinderPath finderPath = null;
3146 Object[] finderArgs = null;
3147
3148 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
3149 (orderByComparator == null)) {
3150 pagination = false;
3151 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
3152 finderArgs = FINDER_ARGS_EMPTY;
3153 }
3154 else {
3155 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
3156 finderArgs = new Object[] { start, end, orderByComparator };
3157 }
3158
3159 List<SCProductEntry> list = (List<SCProductEntry>)FinderCacheUtil.getResult(finderPath,
3160 finderArgs, this);
3161
3162 if (list == null) {
3163 StringBundler query = null;
3164 String sql = null;
3165
3166 if (orderByComparator != null) {
3167 query = new StringBundler(2 +
3168 (orderByComparator.getOrderByFields().length * 3));
3169
3170 query.append(_SQL_SELECT_SCPRODUCTENTRY);
3171
3172 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3173 orderByComparator);
3174
3175 sql = query.toString();
3176 }
3177 else {
3178 sql = _SQL_SELECT_SCPRODUCTENTRY;
3179
3180 if (pagination) {
3181 sql = sql.concat(SCProductEntryModelImpl.ORDER_BY_JPQL);
3182 }
3183 }
3184
3185 Session session = null;
3186
3187 try {
3188 session = openSession();
3189
3190 Query q = session.createQuery(sql);
3191
3192 if (!pagination) {
3193 list = (List<SCProductEntry>)QueryUtil.list(q,
3194 getDialect(), start, end, false);
3195
3196 Collections.sort(list);
3197
3198 list = new UnmodifiableList<SCProductEntry>(list);
3199 }
3200 else {
3201 list = (List<SCProductEntry>)QueryUtil.list(q,
3202 getDialect(), start, end);
3203 }
3204
3205 cacheResult(list);
3206
3207 FinderCacheUtil.putResult(finderPath, finderArgs, list);
3208 }
3209 catch (Exception e) {
3210 FinderCacheUtil.removeResult(finderPath, finderArgs);
3211
3212 throw processException(e);
3213 }
3214 finally {
3215 closeSession(session);
3216 }
3217 }
3218
3219 return list;
3220 }
3221
3222
3227 public void removeAll() throws SystemException {
3228 for (SCProductEntry scProductEntry : findAll()) {
3229 remove(scProductEntry);
3230 }
3231 }
3232
3233
3239 public int countAll() throws SystemException {
3240 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3241 FINDER_ARGS_EMPTY, this);
3242
3243 if (count == null) {
3244 Session session = null;
3245
3246 try {
3247 session = openSession();
3248
3249 Query q = session.createQuery(_SQL_COUNT_SCPRODUCTENTRY);
3250
3251 count = (Long)q.uniqueResult();
3252
3253 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
3254 FINDER_ARGS_EMPTY, count);
3255 }
3256 catch (Exception e) {
3257 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_ALL,
3258 FINDER_ARGS_EMPTY);
3259
3260 throw processException(e);
3261 }
3262 finally {
3263 closeSession(session);
3264 }
3265 }
3266
3267 return count.intValue();
3268 }
3269
3270
3277 public List<com.liferay.portlet.softwarecatalog.model.SCLicense> getSCLicenses(
3278 long pk) throws SystemException {
3279 return getSCLicenses(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
3280 }
3281
3282
3295 public List<com.liferay.portlet.softwarecatalog.model.SCLicense> getSCLicenses(
3296 long pk, int start, int end) throws SystemException {
3297 return getSCLicenses(pk, start, end, null);
3298 }
3299
3300 public static final FinderPath FINDER_PATH_GET_SCLICENSES = new FinderPath(com.liferay.portlet.softwarecatalog.model.impl.SCLicenseModelImpl.ENTITY_CACHE_ENABLED,
3301 SCProductEntryModelImpl.FINDER_CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES,
3302 com.liferay.portlet.softwarecatalog.model.impl.SCLicenseImpl.class,
3303 SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME,
3304 "getSCLicenses",
3305 new String[] {
3306 Long.class.getName(), Integer.class.getName(),
3307 Integer.class.getName(), OrderByComparator.class.getName()
3308 });
3309
3310 static {
3311 FINDER_PATH_GET_SCLICENSES.setCacheKeyGeneratorCacheName(null);
3312 }
3313
3314
3328 public List<com.liferay.portlet.softwarecatalog.model.SCLicense> getSCLicenses(
3329 long pk, int start, int end, OrderByComparator orderByComparator)
3330 throws SystemException {
3331 boolean pagination = true;
3332 Object[] finderArgs = null;
3333
3334 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
3335 (orderByComparator == null)) {
3336 pagination = false;
3337 finderArgs = new Object[] { pk };
3338 }
3339 else {
3340 finderArgs = new Object[] { pk, start, end, orderByComparator };
3341 }
3342
3343 List<com.liferay.portlet.softwarecatalog.model.SCLicense> list = (List<com.liferay.portlet.softwarecatalog.model.SCLicense>)FinderCacheUtil.getResult(FINDER_PATH_GET_SCLICENSES,
3344 finderArgs, this);
3345
3346 if (list == null) {
3347 Session session = null;
3348
3349 try {
3350 session = openSession();
3351
3352 String sql = null;
3353
3354 if (orderByComparator != null) {
3355 sql = _SQL_GETSCLICENSES.concat(ORDER_BY_CLAUSE)
3356 .concat(orderByComparator.getOrderBy());
3357 }
3358 else {
3359 sql = _SQL_GETSCLICENSES;
3360
3361 if (pagination) {
3362 sql = sql.concat(com.liferay.portlet.softwarecatalog.model.impl.SCLicenseModelImpl.ORDER_BY_SQL);
3363 }
3364 }
3365
3366 SQLQuery q = session.createSQLQuery(sql);
3367
3368 q.addEntity("SCLicense",
3369 com.liferay.portlet.softwarecatalog.model.impl.SCLicenseImpl.class);
3370
3371 QueryPos qPos = QueryPos.getInstance(q);
3372
3373 qPos.add(pk);
3374
3375 if (!pagination) {
3376 list = (List<com.liferay.portlet.softwarecatalog.model.SCLicense>)QueryUtil.list(q,
3377 getDialect(), start, end, false);
3378
3379 Collections.sort(list);
3380
3381 list = new UnmodifiableList<com.liferay.portlet.softwarecatalog.model.SCLicense>(list);
3382 }
3383 else {
3384 list = (List<com.liferay.portlet.softwarecatalog.model.SCLicense>)QueryUtil.list(q,
3385 getDialect(), start, end);
3386 }
3387
3388 scLicensePersistence.cacheResult(list);
3389
3390 FinderCacheUtil.putResult(FINDER_PATH_GET_SCLICENSES,
3391 finderArgs, list);
3392 }
3393 catch (Exception e) {
3394 FinderCacheUtil.removeResult(FINDER_PATH_GET_SCLICENSES,
3395 finderArgs);
3396
3397 throw processException(e);
3398 }
3399 finally {
3400 closeSession(session);
3401 }
3402 }
3403
3404 return list;
3405 }
3406
3407 public static final FinderPath FINDER_PATH_GET_SCLICENSES_SIZE = new FinderPath(com.liferay.portlet.softwarecatalog.model.impl.SCLicenseModelImpl.ENTITY_CACHE_ENABLED,
3408 SCProductEntryModelImpl.FINDER_CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES,
3409 Long.class,
3410 SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME,
3411 "getSCLicensesSize", new String[] { Long.class.getName() });
3412
3413 static {
3414 FINDER_PATH_GET_SCLICENSES_SIZE.setCacheKeyGeneratorCacheName(null);
3415 }
3416
3417
3424 public int getSCLicensesSize(long pk) throws SystemException {
3425 Object[] finderArgs = new Object[] { pk };
3426
3427 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_SCLICENSES_SIZE,
3428 finderArgs, this);
3429
3430 if (count == null) {
3431 Session session = null;
3432
3433 try {
3434 session = openSession();
3435
3436 SQLQuery q = session.createSQLQuery(_SQL_GETSCLICENSESSIZE);
3437
3438 q.addScalar(COUNT_COLUMN_NAME,
3439 com.liferay.portal.kernel.dao.orm.Type.LONG);
3440
3441 QueryPos qPos = QueryPos.getInstance(q);
3442
3443 qPos.add(pk);
3444
3445 count = (Long)q.uniqueResult();
3446
3447 FinderCacheUtil.putResult(FINDER_PATH_GET_SCLICENSES_SIZE,
3448 finderArgs, count);
3449 }
3450 catch (Exception e) {
3451 FinderCacheUtil.removeResult(FINDER_PATH_GET_SCLICENSES_SIZE,
3452 finderArgs);
3453
3454 throw processException(e);
3455 }
3456 finally {
3457 closeSession(session);
3458 }
3459 }
3460
3461 return count.intValue();
3462 }
3463
3464 public static final FinderPath FINDER_PATH_CONTAINS_SCLICENSE = new FinderPath(com.liferay.portlet.softwarecatalog.model.impl.SCLicenseModelImpl.ENTITY_CACHE_ENABLED,
3465 SCProductEntryModelImpl.FINDER_CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES,
3466 Boolean.class,
3467 SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME,
3468 "containsSCLicense",
3469 new String[] { Long.class.getName(), Long.class.getName() });
3470
3471
3479 public boolean containsSCLicense(long pk, long scLicensePK)
3480 throws SystemException {
3481 Object[] finderArgs = new Object[] { pk, scLicensePK };
3482
3483 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_SCLICENSE,
3484 finderArgs, this);
3485
3486 if (value == null) {
3487 try {
3488 value = Boolean.valueOf(containsSCLicense.contains(pk,
3489 scLicensePK));
3490
3491 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_SCLICENSE,
3492 finderArgs, value);
3493 }
3494 catch (Exception e) {
3495 FinderCacheUtil.removeResult(FINDER_PATH_CONTAINS_SCLICENSE,
3496 finderArgs);
3497
3498 throw processException(e);
3499 }
3500 }
3501
3502 return value.booleanValue();
3503 }
3504
3505
3512 public boolean containsSCLicenses(long pk) throws SystemException {
3513 if (getSCLicensesSize(pk) > 0) {
3514 return true;
3515 }
3516 else {
3517 return false;
3518 }
3519 }
3520
3521
3528 public void addSCLicense(long pk, long scLicensePK)
3529 throws SystemException {
3530 try {
3531 addSCLicense.add(pk, scLicensePK);
3532 }
3533 catch (Exception e) {
3534 throw processException(e);
3535 }
3536 finally {
3537 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3538 }
3539 }
3540
3541
3548 public void addSCLicense(long pk,
3549 com.liferay.portlet.softwarecatalog.model.SCLicense scLicense)
3550 throws SystemException {
3551 try {
3552 addSCLicense.add(pk, scLicense.getPrimaryKey());
3553 }
3554 catch (Exception e) {
3555 throw processException(e);
3556 }
3557 finally {
3558 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3559 }
3560 }
3561
3562
3569 public void addSCLicenses(long pk, long[] scLicensePKs)
3570 throws SystemException {
3571 try {
3572 for (long scLicensePK : scLicensePKs) {
3573 addSCLicense.add(pk, scLicensePK);
3574 }
3575 }
3576 catch (Exception e) {
3577 throw processException(e);
3578 }
3579 finally {
3580 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3581 }
3582 }
3583
3584
3591 public void addSCLicenses(long pk,
3592 List<com.liferay.portlet.softwarecatalog.model.SCLicense> scLicenses)
3593 throws SystemException {
3594 try {
3595 for (com.liferay.portlet.softwarecatalog.model.SCLicense scLicense : scLicenses) {
3596 addSCLicense.add(pk, scLicense.getPrimaryKey());
3597 }
3598 }
3599 catch (Exception e) {
3600 throw processException(e);
3601 }
3602 finally {
3603 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3604 }
3605 }
3606
3607
3613 public void clearSCLicenses(long pk) throws SystemException {
3614 try {
3615 clearSCLicenses.clear(pk);
3616 }
3617 catch (Exception e) {
3618 throw processException(e);
3619 }
3620 finally {
3621 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3622 }
3623 }
3624
3625
3632 public void removeSCLicense(long pk, long scLicensePK)
3633 throws SystemException {
3634 try {
3635 removeSCLicense.remove(pk, scLicensePK);
3636 }
3637 catch (Exception e) {
3638 throw processException(e);
3639 }
3640 finally {
3641 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3642 }
3643 }
3644
3645
3652 public void removeSCLicense(long pk,
3653 com.liferay.portlet.softwarecatalog.model.SCLicense scLicense)
3654 throws SystemException {
3655 try {
3656 removeSCLicense.remove(pk, scLicense.getPrimaryKey());
3657 }
3658 catch (Exception e) {
3659 throw processException(e);
3660 }
3661 finally {
3662 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3663 }
3664 }
3665
3666
3673 public void removeSCLicenses(long pk, long[] scLicensePKs)
3674 throws SystemException {
3675 try {
3676 for (long scLicensePK : scLicensePKs) {
3677 removeSCLicense.remove(pk, scLicensePK);
3678 }
3679 }
3680 catch (Exception e) {
3681 throw processException(e);
3682 }
3683 finally {
3684 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3685 }
3686 }
3687
3688
3695 public void removeSCLicenses(long pk,
3696 List<com.liferay.portlet.softwarecatalog.model.SCLicense> scLicenses)
3697 throws SystemException {
3698 try {
3699 for (com.liferay.portlet.softwarecatalog.model.SCLicense scLicense : scLicenses) {
3700 removeSCLicense.remove(pk, scLicense.getPrimaryKey());
3701 }
3702 }
3703 catch (Exception e) {
3704 throw processException(e);
3705 }
3706 finally {
3707 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3708 }
3709 }
3710
3711
3718 public void setSCLicenses(long pk, long[] scLicensePKs)
3719 throws SystemException {
3720 try {
3721 Set<Long> scLicensePKSet = SetUtil.fromArray(scLicensePKs);
3722
3723 List<com.liferay.portlet.softwarecatalog.model.SCLicense> scLicenses =
3724 getSCLicenses(pk);
3725
3726 for (com.liferay.portlet.softwarecatalog.model.SCLicense scLicense : scLicenses) {
3727 if (!scLicensePKSet.remove(scLicense.getPrimaryKey())) {
3728 removeSCLicense.remove(pk, scLicense.getPrimaryKey());
3729 }
3730 }
3731
3732 for (Long scLicensePK : scLicensePKSet) {
3733 addSCLicense.add(pk, scLicensePK);
3734 }
3735 }
3736 catch (Exception e) {
3737 throw processException(e);
3738 }
3739 finally {
3740 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3741 }
3742 }
3743
3744
3751 public void setSCLicenses(long pk,
3752 List<com.liferay.portlet.softwarecatalog.model.SCLicense> scLicenses)
3753 throws SystemException {
3754 try {
3755 long[] scLicensePKs = new long[scLicenses.size()];
3756
3757 for (int i = 0; i < scLicenses.size(); i++) {
3758 com.liferay.portlet.softwarecatalog.model.SCLicense scLicense = scLicenses.get(i);
3759
3760 scLicensePKs[i] = scLicense.getPrimaryKey();
3761 }
3762
3763 setSCLicenses(pk, scLicensePKs);
3764 }
3765 catch (Exception e) {
3766 throw processException(e);
3767 }
3768 finally {
3769 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3770 }
3771 }
3772
3773
3776 public void afterPropertiesSet() {
3777 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
3778 com.liferay.portal.util.PropsUtil.get(
3779 "value.object.listener.com.liferay.portlet.softwarecatalog.model.SCProductEntry")));
3780
3781 if (listenerClassNames.length > 0) {
3782 try {
3783 List<ModelListener<SCProductEntry>> listenersList = new ArrayList<ModelListener<SCProductEntry>>();
3784
3785 for (String listenerClassName : listenerClassNames) {
3786 listenersList.add((ModelListener<SCProductEntry>)InstanceFactory.newInstance(
3787 listenerClassName));
3788 }
3789
3790 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3791 }
3792 catch (Exception e) {
3793 _log.error(e);
3794 }
3795 }
3796
3797 containsSCLicense = new ContainsSCLicense();
3798
3799 addSCLicense = new AddSCLicense();
3800 clearSCLicenses = new ClearSCLicenses();
3801 removeSCLicense = new RemoveSCLicense();
3802 }
3803
3804 public void destroy() {
3805 EntityCacheUtil.removeCache(SCProductEntryImpl.class.getName());
3806 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
3807 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
3808 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
3809 }
3810
3811 @BeanReference(type = SCLicensePersistence.class)
3812 protected SCLicensePersistence scLicensePersistence;
3813 protected ContainsSCLicense containsSCLicense;
3814 protected AddSCLicense addSCLicense;
3815 protected ClearSCLicenses clearSCLicenses;
3816 protected RemoveSCLicense removeSCLicense;
3817
3818 protected class ContainsSCLicense {
3819 protected ContainsSCLicense() {
3820 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
3821 _SQL_CONTAINSSCLICENSE,
3822 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
3823 RowMapper.COUNT);
3824 }
3825
3826 protected boolean contains(long productEntryId, long licenseId) {
3827 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
3828 new Long(productEntryId), new Long(licenseId)
3829 });
3830
3831 if (results.size() > 0) {
3832 Integer count = results.get(0);
3833
3834 if (count.intValue() > 0) {
3835 return true;
3836 }
3837 }
3838
3839 return false;
3840 }
3841
3842 private MappingSqlQuery<Integer> _mappingSqlQuery;
3843 }
3844
3845 protected class AddSCLicense {
3846 protected AddSCLicense() {
3847 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
3848 "INSERT INTO SCLicenses_SCProductEntries (productEntryId, licenseId) VALUES (?, ?)",
3849 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
3850 }
3851
3852 protected void add(long productEntryId, long licenseId)
3853 throws SystemException {
3854 if (!containsSCLicense.contains(productEntryId, licenseId)) {
3855 ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense>[] scLicenseListeners =
3856 scLicensePersistence.getListeners();
3857
3858 for (ModelListener<SCProductEntry> listener : listeners) {
3859 listener.onBeforeAddAssociation(productEntryId,
3860 com.liferay.portlet.softwarecatalog.model.SCLicense.class.getName(),
3861 licenseId);
3862 }
3863
3864 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense> listener : scLicenseListeners) {
3865 listener.onBeforeAddAssociation(licenseId,
3866 SCProductEntry.class.getName(), productEntryId);
3867 }
3868
3869 _sqlUpdate.update(new Object[] {
3870 new Long(productEntryId), new Long(licenseId)
3871 });
3872
3873 for (ModelListener<SCProductEntry> listener : listeners) {
3874 listener.onAfterAddAssociation(productEntryId,
3875 com.liferay.portlet.softwarecatalog.model.SCLicense.class.getName(),
3876 licenseId);
3877 }
3878
3879 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense> listener : scLicenseListeners) {
3880 listener.onAfterAddAssociation(licenseId,
3881 SCProductEntry.class.getName(), productEntryId);
3882 }
3883 }
3884 }
3885
3886 private SqlUpdate _sqlUpdate;
3887 }
3888
3889 protected class ClearSCLicenses {
3890 protected ClearSCLicenses() {
3891 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
3892 "DELETE FROM SCLicenses_SCProductEntries WHERE productEntryId = ?",
3893 new int[] { java.sql.Types.BIGINT });
3894 }
3895
3896 protected void clear(long productEntryId) throws SystemException {
3897 ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense>[] scLicenseListeners =
3898 scLicensePersistence.getListeners();
3899
3900 List<com.liferay.portlet.softwarecatalog.model.SCLicense> scLicenses =
3901 null;
3902
3903 if ((listeners.length > 0) || (scLicenseListeners.length > 0)) {
3904 scLicenses = getSCLicenses(productEntryId);
3905
3906 for (com.liferay.portlet.softwarecatalog.model.SCLicense scLicense : scLicenses) {
3907 for (ModelListener<SCProductEntry> listener : listeners) {
3908 listener.onBeforeRemoveAssociation(productEntryId,
3909 com.liferay.portlet.softwarecatalog.model.SCLicense.class.getName(),
3910 scLicense.getPrimaryKey());
3911 }
3912
3913 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense> listener : scLicenseListeners) {
3914 listener.onBeforeRemoveAssociation(scLicense.getPrimaryKey(),
3915 SCProductEntry.class.getName(), productEntryId);
3916 }
3917 }
3918 }
3919
3920 _sqlUpdate.update(new Object[] { new Long(productEntryId) });
3921
3922 if ((listeners.length > 0) || (scLicenseListeners.length > 0)) {
3923 for (com.liferay.portlet.softwarecatalog.model.SCLicense scLicense : scLicenses) {
3924 for (ModelListener<SCProductEntry> listener : listeners) {
3925 listener.onAfterRemoveAssociation(productEntryId,
3926 com.liferay.portlet.softwarecatalog.model.SCLicense.class.getName(),
3927 scLicense.getPrimaryKey());
3928 }
3929
3930 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense> listener : scLicenseListeners) {
3931 listener.onAfterRemoveAssociation(scLicense.getPrimaryKey(),
3932 SCProductEntry.class.getName(), productEntryId);
3933 }
3934 }
3935 }
3936 }
3937
3938 private SqlUpdate _sqlUpdate;
3939 }
3940
3941 protected class RemoveSCLicense {
3942 protected RemoveSCLicense() {
3943 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
3944 "DELETE FROM SCLicenses_SCProductEntries WHERE productEntryId = ? AND licenseId = ?",
3945 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
3946 }
3947
3948 protected void remove(long productEntryId, long licenseId)
3949 throws SystemException {
3950 if (containsSCLicense.contains(productEntryId, licenseId)) {
3951 ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense>[] scLicenseListeners =
3952 scLicensePersistence.getListeners();
3953
3954 for (ModelListener<SCProductEntry> listener : listeners) {
3955 listener.onBeforeRemoveAssociation(productEntryId,
3956 com.liferay.portlet.softwarecatalog.model.SCLicense.class.getName(),
3957 licenseId);
3958 }
3959
3960 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense> listener : scLicenseListeners) {
3961 listener.onBeforeRemoveAssociation(licenseId,
3962 SCProductEntry.class.getName(), productEntryId);
3963 }
3964
3965 _sqlUpdate.update(new Object[] {
3966 new Long(productEntryId), new Long(licenseId)
3967 });
3968
3969 for (ModelListener<SCProductEntry> listener : listeners) {
3970 listener.onAfterRemoveAssociation(productEntryId,
3971 com.liferay.portlet.softwarecatalog.model.SCLicense.class.getName(),
3972 licenseId);
3973 }
3974
3975 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense> listener : scLicenseListeners) {
3976 listener.onAfterRemoveAssociation(licenseId,
3977 SCProductEntry.class.getName(), productEntryId);
3978 }
3979 }
3980 }
3981
3982 private SqlUpdate _sqlUpdate;
3983 }
3984
3985 private static final String _SQL_SELECT_SCPRODUCTENTRY = "SELECT scProductEntry FROM SCProductEntry scProductEntry";
3986 private static final String _SQL_SELECT_SCPRODUCTENTRY_WHERE = "SELECT scProductEntry FROM SCProductEntry scProductEntry WHERE ";
3987 private static final String _SQL_COUNT_SCPRODUCTENTRY = "SELECT COUNT(scProductEntry) FROM SCProductEntry scProductEntry";
3988 private static final String _SQL_COUNT_SCPRODUCTENTRY_WHERE = "SELECT COUNT(scProductEntry) FROM SCProductEntry scProductEntry WHERE ";
3989 private static final String _SQL_GETSCLICENSES = "SELECT {SCLicense.*} FROM SCLicense INNER JOIN SCLicenses_SCProductEntries ON (SCLicenses_SCProductEntries.licenseId = SCLicense.licenseId) WHERE (SCLicenses_SCProductEntries.productEntryId = ?)";
3990 private static final String _SQL_GETSCLICENSESSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM SCLicenses_SCProductEntries WHERE productEntryId = ?";
3991 private static final String _SQL_CONTAINSSCLICENSE = "SELECT COUNT(*) AS COUNT_VALUE FROM SCLicenses_SCProductEntries WHERE productEntryId = ? AND licenseId = ?";
3992 private static final String _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN = "scProductEntry.productEntryId";
3993 private static final String _FILTER_SQL_SELECT_SCPRODUCTENTRY_WHERE = "SELECT DISTINCT {scProductEntry.*} FROM SCProductEntry scProductEntry WHERE ";
3994 private static final String _FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_1 =
3995 "SELECT {SCProductEntry.*} FROM (SELECT DISTINCT scProductEntry.productEntryId FROM SCProductEntry scProductEntry WHERE ";
3996 private static final String _FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_2 =
3997 ") TEMP_TABLE INNER JOIN SCProductEntry ON TEMP_TABLE.productEntryId = SCProductEntry.productEntryId";
3998 private static final String _FILTER_SQL_COUNT_SCPRODUCTENTRY_WHERE = "SELECT COUNT(DISTINCT scProductEntry.productEntryId) AS COUNT_VALUE FROM SCProductEntry scProductEntry WHERE ";
3999 private static final String _FILTER_ENTITY_ALIAS = "scProductEntry";
4000 private static final String _FILTER_ENTITY_TABLE = "SCProductEntry";
4001 private static final String _ORDER_BY_ENTITY_ALIAS = "scProductEntry.";
4002 private static final String _ORDER_BY_ENTITY_TABLE = "SCProductEntry.";
4003 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No SCProductEntry exists with the primary key ";
4004 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No SCProductEntry exists with the key {";
4005 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
4006 private static Log _log = LogFactoryUtil.getLog(SCProductEntryPersistenceImpl.class);
4007 private static SCProductEntry _nullSCProductEntry = new SCProductEntryImpl() {
4008 @Override
4009 public Object clone() {
4010 return this;
4011 }
4012
4013 @Override
4014 public CacheModel<SCProductEntry> toCacheModel() {
4015 return _nullSCProductEntryCacheModel;
4016 }
4017 };
4018
4019 private static CacheModel<SCProductEntry> _nullSCProductEntryCacheModel = new CacheModel<SCProductEntry>() {
4020 public SCProductEntry toEntityModel() {
4021 return _nullSCProductEntry;
4022 }
4023 };
4024 }