001
014
015 package com.liferay.portlet.softwarecatalog.service.persistence;
016
017 import com.liferay.portal.kernel.bean.BeanReference;
018 import com.liferay.portal.kernel.cache.CacheRegistryUtil;
019 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
020 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
021 import com.liferay.portal.kernel.dao.orm.FinderPath;
022 import com.liferay.portal.kernel.dao.orm.Query;
023 import com.liferay.portal.kernel.dao.orm.QueryPos;
024 import com.liferay.portal.kernel.dao.orm.QueryUtil;
025 import com.liferay.portal.kernel.dao.orm.SQLQuery;
026 import com.liferay.portal.kernel.dao.orm.Session;
027 import com.liferay.portal.kernel.exception.SystemException;
028 import com.liferay.portal.kernel.log.Log;
029 import com.liferay.portal.kernel.log.LogFactoryUtil;
030 import com.liferay.portal.kernel.util.GetterUtil;
031 import com.liferay.portal.kernel.util.InstanceFactory;
032 import com.liferay.portal.kernel.util.OrderByComparator;
033 import com.liferay.portal.kernel.util.SetUtil;
034 import com.liferay.portal.kernel.util.StringBundler;
035 import com.liferay.portal.kernel.util.StringPool;
036 import com.liferay.portal.kernel.util.StringUtil;
037 import com.liferay.portal.kernel.util.UnmodifiableList;
038 import com.liferay.portal.model.CacheModel;
039 import com.liferay.portal.model.ModelListener;
040 import com.liferay.portal.security.permission.InlineSQLHelperUtil;
041 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
042 import com.liferay.portal.service.persistence.impl.TableMapper;
043 import com.liferay.portal.service.persistence.impl.TableMapperFactory;
044
045 import com.liferay.portlet.softwarecatalog.NoSuchLicenseException;
046 import com.liferay.portlet.softwarecatalog.model.SCLicense;
047 import com.liferay.portlet.softwarecatalog.model.impl.SCLicenseImpl;
048 import com.liferay.portlet.softwarecatalog.model.impl.SCLicenseModelImpl;
049
050 import java.io.Serializable;
051
052 import java.util.ArrayList;
053 import java.util.Collections;
054 import java.util.List;
055 import java.util.Set;
056
057
069 public class SCLicensePersistenceImpl extends BasePersistenceImpl<SCLicense>
070 implements SCLicensePersistence {
071
076 public static final String FINDER_CLASS_NAME_ENTITY = SCLicenseImpl.class.getName();
077 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
078 ".List1";
079 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
080 ".List2";
081 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(SCLicenseModelImpl.ENTITY_CACHE_ENABLED,
082 SCLicenseModelImpl.FINDER_CACHE_ENABLED, SCLicenseImpl.class,
083 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
084 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(SCLicenseModelImpl.ENTITY_CACHE_ENABLED,
085 SCLicenseModelImpl.FINDER_CACHE_ENABLED, SCLicenseImpl.class,
086 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
087 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(SCLicenseModelImpl.ENTITY_CACHE_ENABLED,
088 SCLicenseModelImpl.FINDER_CACHE_ENABLED, Long.class,
089 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
090 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_ACTIVE = new FinderPath(SCLicenseModelImpl.ENTITY_CACHE_ENABLED,
091 SCLicenseModelImpl.FINDER_CACHE_ENABLED, SCLicenseImpl.class,
092 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByActive",
093 new String[] {
094 Boolean.class.getName(),
095
096 Integer.class.getName(), Integer.class.getName(),
097 OrderByComparator.class.getName()
098 });
099 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ACTIVE =
100 new FinderPath(SCLicenseModelImpl.ENTITY_CACHE_ENABLED,
101 SCLicenseModelImpl.FINDER_CACHE_ENABLED, SCLicenseImpl.class,
102 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByActive",
103 new String[] { Boolean.class.getName() },
104 SCLicenseModelImpl.ACTIVE_COLUMN_BITMASK |
105 SCLicenseModelImpl.NAME_COLUMN_BITMASK);
106 public static final FinderPath FINDER_PATH_COUNT_BY_ACTIVE = new FinderPath(SCLicenseModelImpl.ENTITY_CACHE_ENABLED,
107 SCLicenseModelImpl.FINDER_CACHE_ENABLED, Long.class,
108 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByActive",
109 new String[] { Boolean.class.getName() });
110
111
118 @Override
119 public List<SCLicense> findByActive(boolean active)
120 throws SystemException {
121 return findByActive(active, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
122 }
123
124
137 @Override
138 public List<SCLicense> findByActive(boolean active, int start, int end)
139 throws SystemException {
140 return findByActive(active, start, end, null);
141 }
142
143
157 @Override
158 public List<SCLicense> findByActive(boolean active, int start, int end,
159 OrderByComparator orderByComparator) throws SystemException {
160 boolean pagination = true;
161 FinderPath finderPath = null;
162 Object[] finderArgs = null;
163
164 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
165 (orderByComparator == null)) {
166 pagination = false;
167 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ACTIVE;
168 finderArgs = new Object[] { active };
169 }
170 else {
171 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_ACTIVE;
172 finderArgs = new Object[] { active, start, end, orderByComparator };
173 }
174
175 List<SCLicense> list = (List<SCLicense>)FinderCacheUtil.getResult(finderPath,
176 finderArgs, this);
177
178 if ((list != null) && !list.isEmpty()) {
179 for (SCLicense scLicense : list) {
180 if ((active != scLicense.getActive())) {
181 list = null;
182
183 break;
184 }
185 }
186 }
187
188 if (list == null) {
189 StringBundler query = null;
190
191 if (orderByComparator != null) {
192 query = new StringBundler(3 +
193 (orderByComparator.getOrderByFields().length * 3));
194 }
195 else {
196 query = new StringBundler(3);
197 }
198
199 query.append(_SQL_SELECT_SCLICENSE_WHERE);
200
201 query.append(_FINDER_COLUMN_ACTIVE_ACTIVE_2);
202
203 if (orderByComparator != null) {
204 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
205 orderByComparator);
206 }
207 else
208 if (pagination) {
209 query.append(SCLicenseModelImpl.ORDER_BY_JPQL);
210 }
211
212 String sql = query.toString();
213
214 Session session = null;
215
216 try {
217 session = openSession();
218
219 Query q = session.createQuery(sql);
220
221 QueryPos qPos = QueryPos.getInstance(q);
222
223 qPos.add(active);
224
225 if (!pagination) {
226 list = (List<SCLicense>)QueryUtil.list(q, getDialect(),
227 start, end, false);
228
229 Collections.sort(list);
230
231 list = new UnmodifiableList<SCLicense>(list);
232 }
233 else {
234 list = (List<SCLicense>)QueryUtil.list(q, getDialect(),
235 start, end);
236 }
237
238 cacheResult(list);
239
240 FinderCacheUtil.putResult(finderPath, finderArgs, list);
241 }
242 catch (Exception e) {
243 FinderCacheUtil.removeResult(finderPath, finderArgs);
244
245 throw processException(e);
246 }
247 finally {
248 closeSession(session);
249 }
250 }
251
252 return list;
253 }
254
255
264 @Override
265 public SCLicense findByActive_First(boolean active,
266 OrderByComparator orderByComparator)
267 throws NoSuchLicenseException, SystemException {
268 SCLicense scLicense = fetchByActive_First(active, orderByComparator);
269
270 if (scLicense != null) {
271 return scLicense;
272 }
273
274 StringBundler msg = new StringBundler(4);
275
276 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
277
278 msg.append("active=");
279 msg.append(active);
280
281 msg.append(StringPool.CLOSE_CURLY_BRACE);
282
283 throw new NoSuchLicenseException(msg.toString());
284 }
285
286
294 @Override
295 public SCLicense fetchByActive_First(boolean active,
296 OrderByComparator orderByComparator) throws SystemException {
297 List<SCLicense> list = findByActive(active, 0, 1, orderByComparator);
298
299 if (!list.isEmpty()) {
300 return list.get(0);
301 }
302
303 return null;
304 }
305
306
315 @Override
316 public SCLicense findByActive_Last(boolean active,
317 OrderByComparator orderByComparator)
318 throws NoSuchLicenseException, SystemException {
319 SCLicense scLicense = fetchByActive_Last(active, orderByComparator);
320
321 if (scLicense != null) {
322 return scLicense;
323 }
324
325 StringBundler msg = new StringBundler(4);
326
327 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
328
329 msg.append("active=");
330 msg.append(active);
331
332 msg.append(StringPool.CLOSE_CURLY_BRACE);
333
334 throw new NoSuchLicenseException(msg.toString());
335 }
336
337
345 @Override
346 public SCLicense fetchByActive_Last(boolean active,
347 OrderByComparator orderByComparator) throws SystemException {
348 int count = countByActive(active);
349
350 if (count == 0) {
351 return null;
352 }
353
354 List<SCLicense> list = findByActive(active, count - 1, count,
355 orderByComparator);
356
357 if (!list.isEmpty()) {
358 return list.get(0);
359 }
360
361 return null;
362 }
363
364
374 @Override
375 public SCLicense[] findByActive_PrevAndNext(long licenseId, boolean active,
376 OrderByComparator orderByComparator)
377 throws NoSuchLicenseException, SystemException {
378 SCLicense scLicense = findByPrimaryKey(licenseId);
379
380 Session session = null;
381
382 try {
383 session = openSession();
384
385 SCLicense[] array = new SCLicenseImpl[3];
386
387 array[0] = getByActive_PrevAndNext(session, scLicense, active,
388 orderByComparator, true);
389
390 array[1] = scLicense;
391
392 array[2] = getByActive_PrevAndNext(session, scLicense, active,
393 orderByComparator, false);
394
395 return array;
396 }
397 catch (Exception e) {
398 throw processException(e);
399 }
400 finally {
401 closeSession(session);
402 }
403 }
404
405 protected SCLicense getByActive_PrevAndNext(Session session,
406 SCLicense scLicense, boolean active,
407 OrderByComparator orderByComparator, boolean previous) {
408 StringBundler query = null;
409
410 if (orderByComparator != null) {
411 query = new StringBundler(6 +
412 (orderByComparator.getOrderByFields().length * 6));
413 }
414 else {
415 query = new StringBundler(3);
416 }
417
418 query.append(_SQL_SELECT_SCLICENSE_WHERE);
419
420 query.append(_FINDER_COLUMN_ACTIVE_ACTIVE_2);
421
422 if (orderByComparator != null) {
423 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
424
425 if (orderByConditionFields.length > 0) {
426 query.append(WHERE_AND);
427 }
428
429 for (int i = 0; i < orderByConditionFields.length; i++) {
430 query.append(_ORDER_BY_ENTITY_ALIAS);
431 query.append(orderByConditionFields[i]);
432
433 if ((i + 1) < orderByConditionFields.length) {
434 if (orderByComparator.isAscending() ^ previous) {
435 query.append(WHERE_GREATER_THAN_HAS_NEXT);
436 }
437 else {
438 query.append(WHERE_LESSER_THAN_HAS_NEXT);
439 }
440 }
441 else {
442 if (orderByComparator.isAscending() ^ previous) {
443 query.append(WHERE_GREATER_THAN);
444 }
445 else {
446 query.append(WHERE_LESSER_THAN);
447 }
448 }
449 }
450
451 query.append(ORDER_BY_CLAUSE);
452
453 String[] orderByFields = orderByComparator.getOrderByFields();
454
455 for (int i = 0; i < orderByFields.length; i++) {
456 query.append(_ORDER_BY_ENTITY_ALIAS);
457 query.append(orderByFields[i]);
458
459 if ((i + 1) < orderByFields.length) {
460 if (orderByComparator.isAscending() ^ previous) {
461 query.append(ORDER_BY_ASC_HAS_NEXT);
462 }
463 else {
464 query.append(ORDER_BY_DESC_HAS_NEXT);
465 }
466 }
467 else {
468 if (orderByComparator.isAscending() ^ previous) {
469 query.append(ORDER_BY_ASC);
470 }
471 else {
472 query.append(ORDER_BY_DESC);
473 }
474 }
475 }
476 }
477 else {
478 query.append(SCLicenseModelImpl.ORDER_BY_JPQL);
479 }
480
481 String sql = query.toString();
482
483 Query q = session.createQuery(sql);
484
485 q.setFirstResult(0);
486 q.setMaxResults(2);
487
488 QueryPos qPos = QueryPos.getInstance(q);
489
490 qPos.add(active);
491
492 if (orderByComparator != null) {
493 Object[] values = orderByComparator.getOrderByConditionValues(scLicense);
494
495 for (Object value : values) {
496 qPos.add(value);
497 }
498 }
499
500 List<SCLicense> list = q.list();
501
502 if (list.size() == 2) {
503 return list.get(1);
504 }
505 else {
506 return null;
507 }
508 }
509
510
517 @Override
518 public List<SCLicense> filterFindByActive(boolean active)
519 throws SystemException {
520 return filterFindByActive(active, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
521 null);
522 }
523
524
537 @Override
538 public List<SCLicense> filterFindByActive(boolean active, int start, int end)
539 throws SystemException {
540 return filterFindByActive(active, start, end, null);
541 }
542
543
557 @Override
558 public List<SCLicense> filterFindByActive(boolean active, int start,
559 int end, OrderByComparator orderByComparator) throws SystemException {
560 if (!InlineSQLHelperUtil.isEnabled()) {
561 return findByActive(active, start, end, orderByComparator);
562 }
563
564 StringBundler query = null;
565
566 if (orderByComparator != null) {
567 query = new StringBundler(3 +
568 (orderByComparator.getOrderByFields().length * 3));
569 }
570 else {
571 query = new StringBundler(3);
572 }
573
574 if (getDB().isSupportsInlineDistinct()) {
575 query.append(_FILTER_SQL_SELECT_SCLICENSE_WHERE);
576 }
577 else {
578 query.append(_FILTER_SQL_SELECT_SCLICENSE_NO_INLINE_DISTINCT_WHERE_1);
579 }
580
581 query.append(_FINDER_COLUMN_ACTIVE_ACTIVE_2_SQL);
582
583 if (!getDB().isSupportsInlineDistinct()) {
584 query.append(_FILTER_SQL_SELECT_SCLICENSE_NO_INLINE_DISTINCT_WHERE_2);
585 }
586
587 if (orderByComparator != null) {
588 if (getDB().isSupportsInlineDistinct()) {
589 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
590 orderByComparator, true);
591 }
592 else {
593 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
594 orderByComparator, true);
595 }
596 }
597 else {
598 if (getDB().isSupportsInlineDistinct()) {
599 query.append(SCLicenseModelImpl.ORDER_BY_JPQL);
600 }
601 else {
602 query.append(SCLicenseModelImpl.ORDER_BY_SQL);
603 }
604 }
605
606 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
607 SCLicense.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
608
609 Session session = null;
610
611 try {
612 session = openSession();
613
614 SQLQuery q = session.createSQLQuery(sql);
615
616 if (getDB().isSupportsInlineDistinct()) {
617 q.addEntity(_FILTER_ENTITY_ALIAS, SCLicenseImpl.class);
618 }
619 else {
620 q.addEntity(_FILTER_ENTITY_TABLE, SCLicenseImpl.class);
621 }
622
623 QueryPos qPos = QueryPos.getInstance(q);
624
625 qPos.add(active);
626
627 return (List<SCLicense>)QueryUtil.list(q, getDialect(), start, end);
628 }
629 catch (Exception e) {
630 throw processException(e);
631 }
632 finally {
633 closeSession(session);
634 }
635 }
636
637
647 @Override
648 public SCLicense[] filterFindByActive_PrevAndNext(long licenseId,
649 boolean active, OrderByComparator orderByComparator)
650 throws NoSuchLicenseException, SystemException {
651 if (!InlineSQLHelperUtil.isEnabled()) {
652 return findByActive_PrevAndNext(licenseId, active, orderByComparator);
653 }
654
655 SCLicense scLicense = findByPrimaryKey(licenseId);
656
657 Session session = null;
658
659 try {
660 session = openSession();
661
662 SCLicense[] array = new SCLicenseImpl[3];
663
664 array[0] = filterGetByActive_PrevAndNext(session, scLicense,
665 active, orderByComparator, true);
666
667 array[1] = scLicense;
668
669 array[2] = filterGetByActive_PrevAndNext(session, scLicense,
670 active, 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 SCLicense filterGetByActive_PrevAndNext(Session session,
683 SCLicense scLicense, boolean active,
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_SCLICENSE_WHERE);
697 }
698 else {
699 query.append(_FILTER_SQL_SELECT_SCLICENSE_NO_INLINE_DISTINCT_WHERE_1);
700 }
701
702 query.append(_FINDER_COLUMN_ACTIVE_ACTIVE_2_SQL);
703
704 if (!getDB().isSupportsInlineDistinct()) {
705 query.append(_FILTER_SQL_SELECT_SCLICENSE_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(SCLicenseModelImpl.ORDER_BY_JPQL);
778 }
779 else {
780 query.append(SCLicenseModelImpl.ORDER_BY_SQL);
781 }
782 }
783
784 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
785 SCLicense.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
786
787 SQLQuery q = session.createSQLQuery(sql);
788
789 q.setFirstResult(0);
790 q.setMaxResults(2);
791
792 if (getDB().isSupportsInlineDistinct()) {
793 q.addEntity(_FILTER_ENTITY_ALIAS, SCLicenseImpl.class);
794 }
795 else {
796 q.addEntity(_FILTER_ENTITY_TABLE, SCLicenseImpl.class);
797 }
798
799 QueryPos qPos = QueryPos.getInstance(q);
800
801 qPos.add(active);
802
803 if (orderByComparator != null) {
804 Object[] values = orderByComparator.getOrderByConditionValues(scLicense);
805
806 for (Object value : values) {
807 qPos.add(value);
808 }
809 }
810
811 List<SCLicense> list = q.list();
812
813 if (list.size() == 2) {
814 return list.get(1);
815 }
816 else {
817 return null;
818 }
819 }
820
821
827 @Override
828 public void removeByActive(boolean active) throws SystemException {
829 for (SCLicense scLicense : findByActive(active, QueryUtil.ALL_POS,
830 QueryUtil.ALL_POS, null)) {
831 remove(scLicense);
832 }
833 }
834
835
842 @Override
843 public int countByActive(boolean active) throws SystemException {
844 FinderPath finderPath = FINDER_PATH_COUNT_BY_ACTIVE;
845
846 Object[] finderArgs = new Object[] { active };
847
848 Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
849 this);
850
851 if (count == null) {
852 StringBundler query = new StringBundler(2);
853
854 query.append(_SQL_COUNT_SCLICENSE_WHERE);
855
856 query.append(_FINDER_COLUMN_ACTIVE_ACTIVE_2);
857
858 String sql = query.toString();
859
860 Session session = null;
861
862 try {
863 session = openSession();
864
865 Query q = session.createQuery(sql);
866
867 QueryPos qPos = QueryPos.getInstance(q);
868
869 qPos.add(active);
870
871 count = (Long)q.uniqueResult();
872
873 FinderCacheUtil.putResult(finderPath, finderArgs, count);
874 }
875 catch (Exception e) {
876 FinderCacheUtil.removeResult(finderPath, finderArgs);
877
878 throw processException(e);
879 }
880 finally {
881 closeSession(session);
882 }
883 }
884
885 return count.intValue();
886 }
887
888
895 @Override
896 public int filterCountByActive(boolean active) throws SystemException {
897 if (!InlineSQLHelperUtil.isEnabled()) {
898 return countByActive(active);
899 }
900
901 StringBundler query = new StringBundler(2);
902
903 query.append(_FILTER_SQL_COUNT_SCLICENSE_WHERE);
904
905 query.append(_FINDER_COLUMN_ACTIVE_ACTIVE_2_SQL);
906
907 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
908 SCLicense.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
909
910 Session session = null;
911
912 try {
913 session = openSession();
914
915 SQLQuery q = session.createSQLQuery(sql);
916
917 q.addScalar(COUNT_COLUMN_NAME,
918 com.liferay.portal.kernel.dao.orm.Type.LONG);
919
920 QueryPos qPos = QueryPos.getInstance(q);
921
922 qPos.add(active);
923
924 Long count = (Long)q.uniqueResult();
925
926 return count.intValue();
927 }
928 catch (Exception e) {
929 throw processException(e);
930 }
931 finally {
932 closeSession(session);
933 }
934 }
935
936 private static final String _FINDER_COLUMN_ACTIVE_ACTIVE_2 = "scLicense.active = ?";
937 private static final String _FINDER_COLUMN_ACTIVE_ACTIVE_2_SQL = "scLicense.active_ = ?";
938 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_A_R = new FinderPath(SCLicenseModelImpl.ENTITY_CACHE_ENABLED,
939 SCLicenseModelImpl.FINDER_CACHE_ENABLED, SCLicenseImpl.class,
940 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByA_R",
941 new String[] {
942 Boolean.class.getName(), Boolean.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_A_R = new FinderPath(SCLicenseModelImpl.ENTITY_CACHE_ENABLED,
948 SCLicenseModelImpl.FINDER_CACHE_ENABLED, SCLicenseImpl.class,
949 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByA_R",
950 new String[] { Boolean.class.getName(), Boolean.class.getName() },
951 SCLicenseModelImpl.ACTIVE_COLUMN_BITMASK |
952 SCLicenseModelImpl.RECOMMENDED_COLUMN_BITMASK |
953 SCLicenseModelImpl.NAME_COLUMN_BITMASK);
954 public static final FinderPath FINDER_PATH_COUNT_BY_A_R = new FinderPath(SCLicenseModelImpl.ENTITY_CACHE_ENABLED,
955 SCLicenseModelImpl.FINDER_CACHE_ENABLED, Long.class,
956 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByA_R",
957 new String[] { Boolean.class.getName(), Boolean.class.getName() });
958
959
967 @Override
968 public List<SCLicense> findByA_R(boolean active, boolean recommended)
969 throws SystemException {
970 return findByA_R(active, recommended, QueryUtil.ALL_POS,
971 QueryUtil.ALL_POS, null);
972 }
973
974
988 @Override
989 public List<SCLicense> findByA_R(boolean active, boolean recommended,
990 int start, int end) throws SystemException {
991 return findByA_R(active, recommended, start, end, null);
992 }
993
994
1009 @Override
1010 public List<SCLicense> findByA_R(boolean active, boolean recommended,
1011 int start, int end, OrderByComparator orderByComparator)
1012 throws SystemException {
1013 boolean pagination = true;
1014 FinderPath finderPath = null;
1015 Object[] finderArgs = null;
1016
1017 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1018 (orderByComparator == null)) {
1019 pagination = false;
1020 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_A_R;
1021 finderArgs = new Object[] { active, recommended };
1022 }
1023 else {
1024 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_A_R;
1025 finderArgs = new Object[] {
1026 active, recommended,
1027
1028 start, end, orderByComparator
1029 };
1030 }
1031
1032 List<SCLicense> list = (List<SCLicense>)FinderCacheUtil.getResult(finderPath,
1033 finderArgs, this);
1034
1035 if ((list != null) && !list.isEmpty()) {
1036 for (SCLicense scLicense : list) {
1037 if ((active != scLicense.getActive()) ||
1038 (recommended != scLicense.getRecommended())) {
1039 list = null;
1040
1041 break;
1042 }
1043 }
1044 }
1045
1046 if (list == null) {
1047 StringBundler query = null;
1048
1049 if (orderByComparator != null) {
1050 query = new StringBundler(4 +
1051 (orderByComparator.getOrderByFields().length * 3));
1052 }
1053 else {
1054 query = new StringBundler(4);
1055 }
1056
1057 query.append(_SQL_SELECT_SCLICENSE_WHERE);
1058
1059 query.append(_FINDER_COLUMN_A_R_ACTIVE_2);
1060
1061 query.append(_FINDER_COLUMN_A_R_RECOMMENDED_2);
1062
1063 if (orderByComparator != null) {
1064 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1065 orderByComparator);
1066 }
1067 else
1068 if (pagination) {
1069 query.append(SCLicenseModelImpl.ORDER_BY_JPQL);
1070 }
1071
1072 String sql = query.toString();
1073
1074 Session session = null;
1075
1076 try {
1077 session = openSession();
1078
1079 Query q = session.createQuery(sql);
1080
1081 QueryPos qPos = QueryPos.getInstance(q);
1082
1083 qPos.add(active);
1084
1085 qPos.add(recommended);
1086
1087 if (!pagination) {
1088 list = (List<SCLicense>)QueryUtil.list(q, getDialect(),
1089 start, end, false);
1090
1091 Collections.sort(list);
1092
1093 list = new UnmodifiableList<SCLicense>(list);
1094 }
1095 else {
1096 list = (List<SCLicense>)QueryUtil.list(q, getDialect(),
1097 start, end);
1098 }
1099
1100 cacheResult(list);
1101
1102 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1103 }
1104 catch (Exception e) {
1105 FinderCacheUtil.removeResult(finderPath, finderArgs);
1106
1107 throw processException(e);
1108 }
1109 finally {
1110 closeSession(session);
1111 }
1112 }
1113
1114 return list;
1115 }
1116
1117
1127 @Override
1128 public SCLicense findByA_R_First(boolean active, boolean recommended,
1129 OrderByComparator orderByComparator)
1130 throws NoSuchLicenseException, SystemException {
1131 SCLicense scLicense = fetchByA_R_First(active, recommended,
1132 orderByComparator);
1133
1134 if (scLicense != null) {
1135 return scLicense;
1136 }
1137
1138 StringBundler msg = new StringBundler(6);
1139
1140 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1141
1142 msg.append("active=");
1143 msg.append(active);
1144
1145 msg.append(", recommended=");
1146 msg.append(recommended);
1147
1148 msg.append(StringPool.CLOSE_CURLY_BRACE);
1149
1150 throw new NoSuchLicenseException(msg.toString());
1151 }
1152
1153
1162 @Override
1163 public SCLicense fetchByA_R_First(boolean active, boolean recommended,
1164 OrderByComparator orderByComparator) throws SystemException {
1165 List<SCLicense> list = findByA_R(active, recommended, 0, 1,
1166 orderByComparator);
1167
1168 if (!list.isEmpty()) {
1169 return list.get(0);
1170 }
1171
1172 return null;
1173 }
1174
1175
1185 @Override
1186 public SCLicense findByA_R_Last(boolean active, boolean recommended,
1187 OrderByComparator orderByComparator)
1188 throws NoSuchLicenseException, SystemException {
1189 SCLicense scLicense = fetchByA_R_Last(active, recommended,
1190 orderByComparator);
1191
1192 if (scLicense != null) {
1193 return scLicense;
1194 }
1195
1196 StringBundler msg = new StringBundler(6);
1197
1198 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1199
1200 msg.append("active=");
1201 msg.append(active);
1202
1203 msg.append(", recommended=");
1204 msg.append(recommended);
1205
1206 msg.append(StringPool.CLOSE_CURLY_BRACE);
1207
1208 throw new NoSuchLicenseException(msg.toString());
1209 }
1210
1211
1220 @Override
1221 public SCLicense fetchByA_R_Last(boolean active, boolean recommended,
1222 OrderByComparator orderByComparator) throws SystemException {
1223 int count = countByA_R(active, recommended);
1224
1225 if (count == 0) {
1226 return null;
1227 }
1228
1229 List<SCLicense> list = findByA_R(active, recommended, count - 1, count,
1230 orderByComparator);
1231
1232 if (!list.isEmpty()) {
1233 return list.get(0);
1234 }
1235
1236 return null;
1237 }
1238
1239
1250 @Override
1251 public SCLicense[] findByA_R_PrevAndNext(long licenseId, boolean active,
1252 boolean recommended, OrderByComparator orderByComparator)
1253 throws NoSuchLicenseException, SystemException {
1254 SCLicense scLicense = findByPrimaryKey(licenseId);
1255
1256 Session session = null;
1257
1258 try {
1259 session = openSession();
1260
1261 SCLicense[] array = new SCLicenseImpl[3];
1262
1263 array[0] = getByA_R_PrevAndNext(session, scLicense, active,
1264 recommended, orderByComparator, true);
1265
1266 array[1] = scLicense;
1267
1268 array[2] = getByA_R_PrevAndNext(session, scLicense, active,
1269 recommended, orderByComparator, false);
1270
1271 return array;
1272 }
1273 catch (Exception e) {
1274 throw processException(e);
1275 }
1276 finally {
1277 closeSession(session);
1278 }
1279 }
1280
1281 protected SCLicense getByA_R_PrevAndNext(Session session,
1282 SCLicense scLicense, boolean active, boolean recommended,
1283 OrderByComparator orderByComparator, boolean previous) {
1284 StringBundler query = null;
1285
1286 if (orderByComparator != null) {
1287 query = new StringBundler(6 +
1288 (orderByComparator.getOrderByFields().length * 6));
1289 }
1290 else {
1291 query = new StringBundler(3);
1292 }
1293
1294 query.append(_SQL_SELECT_SCLICENSE_WHERE);
1295
1296 query.append(_FINDER_COLUMN_A_R_ACTIVE_2);
1297
1298 query.append(_FINDER_COLUMN_A_R_RECOMMENDED_2);
1299
1300 if (orderByComparator != null) {
1301 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1302
1303 if (orderByConditionFields.length > 0) {
1304 query.append(WHERE_AND);
1305 }
1306
1307 for (int i = 0; i < orderByConditionFields.length; i++) {
1308 query.append(_ORDER_BY_ENTITY_ALIAS);
1309 query.append(orderByConditionFields[i]);
1310
1311 if ((i + 1) < orderByConditionFields.length) {
1312 if (orderByComparator.isAscending() ^ previous) {
1313 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1314 }
1315 else {
1316 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1317 }
1318 }
1319 else {
1320 if (orderByComparator.isAscending() ^ previous) {
1321 query.append(WHERE_GREATER_THAN);
1322 }
1323 else {
1324 query.append(WHERE_LESSER_THAN);
1325 }
1326 }
1327 }
1328
1329 query.append(ORDER_BY_CLAUSE);
1330
1331 String[] orderByFields = orderByComparator.getOrderByFields();
1332
1333 for (int i = 0; i < orderByFields.length; i++) {
1334 query.append(_ORDER_BY_ENTITY_ALIAS);
1335 query.append(orderByFields[i]);
1336
1337 if ((i + 1) < orderByFields.length) {
1338 if (orderByComparator.isAscending() ^ previous) {
1339 query.append(ORDER_BY_ASC_HAS_NEXT);
1340 }
1341 else {
1342 query.append(ORDER_BY_DESC_HAS_NEXT);
1343 }
1344 }
1345 else {
1346 if (orderByComparator.isAscending() ^ previous) {
1347 query.append(ORDER_BY_ASC);
1348 }
1349 else {
1350 query.append(ORDER_BY_DESC);
1351 }
1352 }
1353 }
1354 }
1355 else {
1356 query.append(SCLicenseModelImpl.ORDER_BY_JPQL);
1357 }
1358
1359 String sql = query.toString();
1360
1361 Query q = session.createQuery(sql);
1362
1363 q.setFirstResult(0);
1364 q.setMaxResults(2);
1365
1366 QueryPos qPos = QueryPos.getInstance(q);
1367
1368 qPos.add(active);
1369
1370 qPos.add(recommended);
1371
1372 if (orderByComparator != null) {
1373 Object[] values = orderByComparator.getOrderByConditionValues(scLicense);
1374
1375 for (Object value : values) {
1376 qPos.add(value);
1377 }
1378 }
1379
1380 List<SCLicense> list = q.list();
1381
1382 if (list.size() == 2) {
1383 return list.get(1);
1384 }
1385 else {
1386 return null;
1387 }
1388 }
1389
1390
1398 @Override
1399 public List<SCLicense> filterFindByA_R(boolean active, boolean recommended)
1400 throws SystemException {
1401 return filterFindByA_R(active, recommended, QueryUtil.ALL_POS,
1402 QueryUtil.ALL_POS, null);
1403 }
1404
1405
1419 @Override
1420 public List<SCLicense> filterFindByA_R(boolean active, boolean recommended,
1421 int start, int end) throws SystemException {
1422 return filterFindByA_R(active, recommended, start, end, null);
1423 }
1424
1425
1440 @Override
1441 public List<SCLicense> filterFindByA_R(boolean active, boolean recommended,
1442 int start, int end, OrderByComparator orderByComparator)
1443 throws SystemException {
1444 if (!InlineSQLHelperUtil.isEnabled()) {
1445 return findByA_R(active, recommended, start, end, orderByComparator);
1446 }
1447
1448 StringBundler query = null;
1449
1450 if (orderByComparator != null) {
1451 query = new StringBundler(4 +
1452 (orderByComparator.getOrderByFields().length * 3));
1453 }
1454 else {
1455 query = new StringBundler(4);
1456 }
1457
1458 if (getDB().isSupportsInlineDistinct()) {
1459 query.append(_FILTER_SQL_SELECT_SCLICENSE_WHERE);
1460 }
1461 else {
1462 query.append(_FILTER_SQL_SELECT_SCLICENSE_NO_INLINE_DISTINCT_WHERE_1);
1463 }
1464
1465 query.append(_FINDER_COLUMN_A_R_ACTIVE_2_SQL);
1466
1467 query.append(_FINDER_COLUMN_A_R_RECOMMENDED_2);
1468
1469 if (!getDB().isSupportsInlineDistinct()) {
1470 query.append(_FILTER_SQL_SELECT_SCLICENSE_NO_INLINE_DISTINCT_WHERE_2);
1471 }
1472
1473 if (orderByComparator != null) {
1474 if (getDB().isSupportsInlineDistinct()) {
1475 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1476 orderByComparator, true);
1477 }
1478 else {
1479 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1480 orderByComparator, true);
1481 }
1482 }
1483 else {
1484 if (getDB().isSupportsInlineDistinct()) {
1485 query.append(SCLicenseModelImpl.ORDER_BY_JPQL);
1486 }
1487 else {
1488 query.append(SCLicenseModelImpl.ORDER_BY_SQL);
1489 }
1490 }
1491
1492 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1493 SCLicense.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
1494
1495 Session session = null;
1496
1497 try {
1498 session = openSession();
1499
1500 SQLQuery q = session.createSQLQuery(sql);
1501
1502 if (getDB().isSupportsInlineDistinct()) {
1503 q.addEntity(_FILTER_ENTITY_ALIAS, SCLicenseImpl.class);
1504 }
1505 else {
1506 q.addEntity(_FILTER_ENTITY_TABLE, SCLicenseImpl.class);
1507 }
1508
1509 QueryPos qPos = QueryPos.getInstance(q);
1510
1511 qPos.add(active);
1512
1513 qPos.add(recommended);
1514
1515 return (List<SCLicense>)QueryUtil.list(q, getDialect(), start, end);
1516 }
1517 catch (Exception e) {
1518 throw processException(e);
1519 }
1520 finally {
1521 closeSession(session);
1522 }
1523 }
1524
1525
1536 @Override
1537 public SCLicense[] filterFindByA_R_PrevAndNext(long licenseId,
1538 boolean active, boolean recommended, OrderByComparator orderByComparator)
1539 throws NoSuchLicenseException, SystemException {
1540 if (!InlineSQLHelperUtil.isEnabled()) {
1541 return findByA_R_PrevAndNext(licenseId, active, recommended,
1542 orderByComparator);
1543 }
1544
1545 SCLicense scLicense = findByPrimaryKey(licenseId);
1546
1547 Session session = null;
1548
1549 try {
1550 session = openSession();
1551
1552 SCLicense[] array = new SCLicenseImpl[3];
1553
1554 array[0] = filterGetByA_R_PrevAndNext(session, scLicense, active,
1555 recommended, orderByComparator, true);
1556
1557 array[1] = scLicense;
1558
1559 array[2] = filterGetByA_R_PrevAndNext(session, scLicense, active,
1560 recommended, orderByComparator, false);
1561
1562 return array;
1563 }
1564 catch (Exception e) {
1565 throw processException(e);
1566 }
1567 finally {
1568 closeSession(session);
1569 }
1570 }
1571
1572 protected SCLicense filterGetByA_R_PrevAndNext(Session session,
1573 SCLicense scLicense, boolean active, boolean recommended,
1574 OrderByComparator orderByComparator, boolean previous) {
1575 StringBundler query = null;
1576
1577 if (orderByComparator != null) {
1578 query = new StringBundler(6 +
1579 (orderByComparator.getOrderByFields().length * 6));
1580 }
1581 else {
1582 query = new StringBundler(3);
1583 }
1584
1585 if (getDB().isSupportsInlineDistinct()) {
1586 query.append(_FILTER_SQL_SELECT_SCLICENSE_WHERE);
1587 }
1588 else {
1589 query.append(_FILTER_SQL_SELECT_SCLICENSE_NO_INLINE_DISTINCT_WHERE_1);
1590 }
1591
1592 query.append(_FINDER_COLUMN_A_R_ACTIVE_2_SQL);
1593
1594 query.append(_FINDER_COLUMN_A_R_RECOMMENDED_2);
1595
1596 if (!getDB().isSupportsInlineDistinct()) {
1597 query.append(_FILTER_SQL_SELECT_SCLICENSE_NO_INLINE_DISTINCT_WHERE_2);
1598 }
1599
1600 if (orderByComparator != null) {
1601 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1602
1603 if (orderByConditionFields.length > 0) {
1604 query.append(WHERE_AND);
1605 }
1606
1607 for (int i = 0; i < orderByConditionFields.length; i++) {
1608 if (getDB().isSupportsInlineDistinct()) {
1609 query.append(_ORDER_BY_ENTITY_ALIAS);
1610 }
1611 else {
1612 query.append(_ORDER_BY_ENTITY_TABLE);
1613 }
1614
1615 query.append(orderByConditionFields[i]);
1616
1617 if ((i + 1) < orderByConditionFields.length) {
1618 if (orderByComparator.isAscending() ^ previous) {
1619 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1620 }
1621 else {
1622 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1623 }
1624 }
1625 else {
1626 if (orderByComparator.isAscending() ^ previous) {
1627 query.append(WHERE_GREATER_THAN);
1628 }
1629 else {
1630 query.append(WHERE_LESSER_THAN);
1631 }
1632 }
1633 }
1634
1635 query.append(ORDER_BY_CLAUSE);
1636
1637 String[] orderByFields = orderByComparator.getOrderByFields();
1638
1639 for (int i = 0; i < orderByFields.length; i++) {
1640 if (getDB().isSupportsInlineDistinct()) {
1641 query.append(_ORDER_BY_ENTITY_ALIAS);
1642 }
1643 else {
1644 query.append(_ORDER_BY_ENTITY_TABLE);
1645 }
1646
1647 query.append(orderByFields[i]);
1648
1649 if ((i + 1) < orderByFields.length) {
1650 if (orderByComparator.isAscending() ^ previous) {
1651 query.append(ORDER_BY_ASC_HAS_NEXT);
1652 }
1653 else {
1654 query.append(ORDER_BY_DESC_HAS_NEXT);
1655 }
1656 }
1657 else {
1658 if (orderByComparator.isAscending() ^ previous) {
1659 query.append(ORDER_BY_ASC);
1660 }
1661 else {
1662 query.append(ORDER_BY_DESC);
1663 }
1664 }
1665 }
1666 }
1667 else {
1668 if (getDB().isSupportsInlineDistinct()) {
1669 query.append(SCLicenseModelImpl.ORDER_BY_JPQL);
1670 }
1671 else {
1672 query.append(SCLicenseModelImpl.ORDER_BY_SQL);
1673 }
1674 }
1675
1676 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1677 SCLicense.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
1678
1679 SQLQuery q = session.createSQLQuery(sql);
1680
1681 q.setFirstResult(0);
1682 q.setMaxResults(2);
1683
1684 if (getDB().isSupportsInlineDistinct()) {
1685 q.addEntity(_FILTER_ENTITY_ALIAS, SCLicenseImpl.class);
1686 }
1687 else {
1688 q.addEntity(_FILTER_ENTITY_TABLE, SCLicenseImpl.class);
1689 }
1690
1691 QueryPos qPos = QueryPos.getInstance(q);
1692
1693 qPos.add(active);
1694
1695 qPos.add(recommended);
1696
1697 if (orderByComparator != null) {
1698 Object[] values = orderByComparator.getOrderByConditionValues(scLicense);
1699
1700 for (Object value : values) {
1701 qPos.add(value);
1702 }
1703 }
1704
1705 List<SCLicense> list = q.list();
1706
1707 if (list.size() == 2) {
1708 return list.get(1);
1709 }
1710 else {
1711 return null;
1712 }
1713 }
1714
1715
1722 @Override
1723 public void removeByA_R(boolean active, boolean recommended)
1724 throws SystemException {
1725 for (SCLicense scLicense : findByA_R(active, recommended,
1726 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
1727 remove(scLicense);
1728 }
1729 }
1730
1731
1739 @Override
1740 public int countByA_R(boolean active, boolean recommended)
1741 throws SystemException {
1742 FinderPath finderPath = FINDER_PATH_COUNT_BY_A_R;
1743
1744 Object[] finderArgs = new Object[] { active, recommended };
1745
1746 Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
1747 this);
1748
1749 if (count == null) {
1750 StringBundler query = new StringBundler(3);
1751
1752 query.append(_SQL_COUNT_SCLICENSE_WHERE);
1753
1754 query.append(_FINDER_COLUMN_A_R_ACTIVE_2);
1755
1756 query.append(_FINDER_COLUMN_A_R_RECOMMENDED_2);
1757
1758 String sql = query.toString();
1759
1760 Session session = null;
1761
1762 try {
1763 session = openSession();
1764
1765 Query q = session.createQuery(sql);
1766
1767 QueryPos qPos = QueryPos.getInstance(q);
1768
1769 qPos.add(active);
1770
1771 qPos.add(recommended);
1772
1773 count = (Long)q.uniqueResult();
1774
1775 FinderCacheUtil.putResult(finderPath, finderArgs, count);
1776 }
1777 catch (Exception e) {
1778 FinderCacheUtil.removeResult(finderPath, finderArgs);
1779
1780 throw processException(e);
1781 }
1782 finally {
1783 closeSession(session);
1784 }
1785 }
1786
1787 return count.intValue();
1788 }
1789
1790
1798 @Override
1799 public int filterCountByA_R(boolean active, boolean recommended)
1800 throws SystemException {
1801 if (!InlineSQLHelperUtil.isEnabled()) {
1802 return countByA_R(active, recommended);
1803 }
1804
1805 StringBundler query = new StringBundler(3);
1806
1807 query.append(_FILTER_SQL_COUNT_SCLICENSE_WHERE);
1808
1809 query.append(_FINDER_COLUMN_A_R_ACTIVE_2_SQL);
1810
1811 query.append(_FINDER_COLUMN_A_R_RECOMMENDED_2);
1812
1813 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1814 SCLicense.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
1815
1816 Session session = null;
1817
1818 try {
1819 session = openSession();
1820
1821 SQLQuery q = session.createSQLQuery(sql);
1822
1823 q.addScalar(COUNT_COLUMN_NAME,
1824 com.liferay.portal.kernel.dao.orm.Type.LONG);
1825
1826 QueryPos qPos = QueryPos.getInstance(q);
1827
1828 qPos.add(active);
1829
1830 qPos.add(recommended);
1831
1832 Long count = (Long)q.uniqueResult();
1833
1834 return count.intValue();
1835 }
1836 catch (Exception e) {
1837 throw processException(e);
1838 }
1839 finally {
1840 closeSession(session);
1841 }
1842 }
1843
1844 private static final String _FINDER_COLUMN_A_R_ACTIVE_2 = "scLicense.active = ? AND ";
1845 private static final String _FINDER_COLUMN_A_R_ACTIVE_2_SQL = "scLicense.active_ = ? AND ";
1846 private static final String _FINDER_COLUMN_A_R_RECOMMENDED_2 = "scLicense.recommended = ?";
1847
1848 public SCLicensePersistenceImpl() {
1849 setModelClass(SCLicense.class);
1850 }
1851
1852
1857 @Override
1858 public void cacheResult(SCLicense scLicense) {
1859 EntityCacheUtil.putResult(SCLicenseModelImpl.ENTITY_CACHE_ENABLED,
1860 SCLicenseImpl.class, scLicense.getPrimaryKey(), scLicense);
1861
1862 scLicense.resetOriginalValues();
1863 }
1864
1865
1870 @Override
1871 public void cacheResult(List<SCLicense> scLicenses) {
1872 for (SCLicense scLicense : scLicenses) {
1873 if (EntityCacheUtil.getResult(
1874 SCLicenseModelImpl.ENTITY_CACHE_ENABLED,
1875 SCLicenseImpl.class, scLicense.getPrimaryKey()) == null) {
1876 cacheResult(scLicense);
1877 }
1878 else {
1879 scLicense.resetOriginalValues();
1880 }
1881 }
1882 }
1883
1884
1891 @Override
1892 public void clearCache() {
1893 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
1894 CacheRegistryUtil.clear(SCLicenseImpl.class.getName());
1895 }
1896
1897 EntityCacheUtil.clearCache(SCLicenseImpl.class.getName());
1898
1899 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
1900 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1901 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1902 }
1903
1904
1911 @Override
1912 public void clearCache(SCLicense scLicense) {
1913 EntityCacheUtil.removeResult(SCLicenseModelImpl.ENTITY_CACHE_ENABLED,
1914 SCLicenseImpl.class, scLicense.getPrimaryKey());
1915
1916 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1917 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1918 }
1919
1920 @Override
1921 public void clearCache(List<SCLicense> scLicenses) {
1922 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1923 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1924
1925 for (SCLicense scLicense : scLicenses) {
1926 EntityCacheUtil.removeResult(SCLicenseModelImpl.ENTITY_CACHE_ENABLED,
1927 SCLicenseImpl.class, scLicense.getPrimaryKey());
1928 }
1929 }
1930
1931
1937 @Override
1938 public SCLicense create(long licenseId) {
1939 SCLicense scLicense = new SCLicenseImpl();
1940
1941 scLicense.setNew(true);
1942 scLicense.setPrimaryKey(licenseId);
1943
1944 return scLicense;
1945 }
1946
1947
1955 @Override
1956 public SCLicense remove(long licenseId)
1957 throws NoSuchLicenseException, SystemException {
1958 return remove((Serializable)licenseId);
1959 }
1960
1961
1969 @Override
1970 public SCLicense remove(Serializable primaryKey)
1971 throws NoSuchLicenseException, SystemException {
1972 Session session = null;
1973
1974 try {
1975 session = openSession();
1976
1977 SCLicense scLicense = (SCLicense)session.get(SCLicenseImpl.class,
1978 primaryKey);
1979
1980 if (scLicense == null) {
1981 if (_log.isWarnEnabled()) {
1982 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
1983 }
1984
1985 throw new NoSuchLicenseException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
1986 primaryKey);
1987 }
1988
1989 return remove(scLicense);
1990 }
1991 catch (NoSuchLicenseException nsee) {
1992 throw nsee;
1993 }
1994 catch (Exception e) {
1995 throw processException(e);
1996 }
1997 finally {
1998 closeSession(session);
1999 }
2000 }
2001
2002 @Override
2003 protected SCLicense removeImpl(SCLicense scLicense)
2004 throws SystemException {
2005 scLicense = toUnwrappedModel(scLicense);
2006
2007 scLicenseToSCProductEntryTableMapper.deleteLeftPrimaryKeyTableMappings(scLicense.getPrimaryKey());
2008
2009 Session session = null;
2010
2011 try {
2012 session = openSession();
2013
2014 if (!session.contains(scLicense)) {
2015 scLicense = (SCLicense)session.get(SCLicenseImpl.class,
2016 scLicense.getPrimaryKeyObj());
2017 }
2018
2019 if (scLicense != null) {
2020 session.delete(scLicense);
2021 }
2022 }
2023 catch (Exception e) {
2024 throw processException(e);
2025 }
2026 finally {
2027 closeSession(session);
2028 }
2029
2030 if (scLicense != null) {
2031 clearCache(scLicense);
2032 }
2033
2034 return scLicense;
2035 }
2036
2037 @Override
2038 public SCLicense updateImpl(
2039 com.liferay.portlet.softwarecatalog.model.SCLicense scLicense)
2040 throws SystemException {
2041 scLicense = toUnwrappedModel(scLicense);
2042
2043 boolean isNew = scLicense.isNew();
2044
2045 SCLicenseModelImpl scLicenseModelImpl = (SCLicenseModelImpl)scLicense;
2046
2047 Session session = null;
2048
2049 try {
2050 session = openSession();
2051
2052 if (scLicense.isNew()) {
2053 session.save(scLicense);
2054
2055 scLicense.setNew(false);
2056 }
2057 else {
2058 session.merge(scLicense);
2059 }
2060 }
2061 catch (Exception e) {
2062 throw processException(e);
2063 }
2064 finally {
2065 closeSession(session);
2066 }
2067
2068 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
2069
2070 if (isNew || !SCLicenseModelImpl.COLUMN_BITMASK_ENABLED) {
2071 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2072 }
2073
2074 else {
2075 if ((scLicenseModelImpl.getColumnBitmask() &
2076 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ACTIVE.getColumnBitmask()) != 0) {
2077 Object[] args = new Object[] {
2078 scLicenseModelImpl.getOriginalActive()
2079 };
2080
2081 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ACTIVE, args);
2082 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ACTIVE,
2083 args);
2084
2085 args = new Object[] { scLicenseModelImpl.getActive() };
2086
2087 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ACTIVE, args);
2088 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ACTIVE,
2089 args);
2090 }
2091
2092 if ((scLicenseModelImpl.getColumnBitmask() &
2093 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_A_R.getColumnBitmask()) != 0) {
2094 Object[] args = new Object[] {
2095 scLicenseModelImpl.getOriginalActive(),
2096 scLicenseModelImpl.getOriginalRecommended()
2097 };
2098
2099 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_A_R, args);
2100 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_A_R,
2101 args);
2102
2103 args = new Object[] {
2104 scLicenseModelImpl.getActive(),
2105 scLicenseModelImpl.getRecommended()
2106 };
2107
2108 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_A_R, args);
2109 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_A_R,
2110 args);
2111 }
2112 }
2113
2114 EntityCacheUtil.putResult(SCLicenseModelImpl.ENTITY_CACHE_ENABLED,
2115 SCLicenseImpl.class, scLicense.getPrimaryKey(), scLicense);
2116
2117 return scLicense;
2118 }
2119
2120 protected SCLicense toUnwrappedModel(SCLicense scLicense) {
2121 if (scLicense instanceof SCLicenseImpl) {
2122 return scLicense;
2123 }
2124
2125 SCLicenseImpl scLicenseImpl = new SCLicenseImpl();
2126
2127 scLicenseImpl.setNew(scLicense.isNew());
2128 scLicenseImpl.setPrimaryKey(scLicense.getPrimaryKey());
2129
2130 scLicenseImpl.setLicenseId(scLicense.getLicenseId());
2131 scLicenseImpl.setName(scLicense.getName());
2132 scLicenseImpl.setUrl(scLicense.getUrl());
2133 scLicenseImpl.setOpenSource(scLicense.isOpenSource());
2134 scLicenseImpl.setActive(scLicense.isActive());
2135 scLicenseImpl.setRecommended(scLicense.isRecommended());
2136
2137 return scLicenseImpl;
2138 }
2139
2140
2148 @Override
2149 public SCLicense findByPrimaryKey(Serializable primaryKey)
2150 throws NoSuchLicenseException, SystemException {
2151 SCLicense scLicense = fetchByPrimaryKey(primaryKey);
2152
2153 if (scLicense == null) {
2154 if (_log.isWarnEnabled()) {
2155 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
2156 }
2157
2158 throw new NoSuchLicenseException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
2159 primaryKey);
2160 }
2161
2162 return scLicense;
2163 }
2164
2165
2173 @Override
2174 public SCLicense findByPrimaryKey(long licenseId)
2175 throws NoSuchLicenseException, SystemException {
2176 return findByPrimaryKey((Serializable)licenseId);
2177 }
2178
2179
2186 @Override
2187 public SCLicense fetchByPrimaryKey(Serializable primaryKey)
2188 throws SystemException {
2189 SCLicense scLicense = (SCLicense)EntityCacheUtil.getResult(SCLicenseModelImpl.ENTITY_CACHE_ENABLED,
2190 SCLicenseImpl.class, primaryKey);
2191
2192 if (scLicense == _nullSCLicense) {
2193 return null;
2194 }
2195
2196 if (scLicense == null) {
2197 Session session = null;
2198
2199 try {
2200 session = openSession();
2201
2202 scLicense = (SCLicense)session.get(SCLicenseImpl.class,
2203 primaryKey);
2204
2205 if (scLicense != null) {
2206 cacheResult(scLicense);
2207 }
2208 else {
2209 EntityCacheUtil.putResult(SCLicenseModelImpl.ENTITY_CACHE_ENABLED,
2210 SCLicenseImpl.class, primaryKey, _nullSCLicense);
2211 }
2212 }
2213 catch (Exception e) {
2214 EntityCacheUtil.removeResult(SCLicenseModelImpl.ENTITY_CACHE_ENABLED,
2215 SCLicenseImpl.class, primaryKey);
2216
2217 throw processException(e);
2218 }
2219 finally {
2220 closeSession(session);
2221 }
2222 }
2223
2224 return scLicense;
2225 }
2226
2227
2234 @Override
2235 public SCLicense fetchByPrimaryKey(long licenseId)
2236 throws SystemException {
2237 return fetchByPrimaryKey((Serializable)licenseId);
2238 }
2239
2240
2246 @Override
2247 public List<SCLicense> findAll() throws SystemException {
2248 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2249 }
2250
2251
2263 @Override
2264 public List<SCLicense> findAll(int start, int end)
2265 throws SystemException {
2266 return findAll(start, end, null);
2267 }
2268
2269
2282 @Override
2283 public List<SCLicense> findAll(int start, int end,
2284 OrderByComparator orderByComparator) throws SystemException {
2285 boolean pagination = true;
2286 FinderPath finderPath = null;
2287 Object[] finderArgs = null;
2288
2289 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2290 (orderByComparator == null)) {
2291 pagination = false;
2292 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
2293 finderArgs = FINDER_ARGS_EMPTY;
2294 }
2295 else {
2296 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
2297 finderArgs = new Object[] { start, end, orderByComparator };
2298 }
2299
2300 List<SCLicense> list = (List<SCLicense>)FinderCacheUtil.getResult(finderPath,
2301 finderArgs, this);
2302
2303 if (list == null) {
2304 StringBundler query = null;
2305 String sql = null;
2306
2307 if (orderByComparator != null) {
2308 query = new StringBundler(2 +
2309 (orderByComparator.getOrderByFields().length * 3));
2310
2311 query.append(_SQL_SELECT_SCLICENSE);
2312
2313 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2314 orderByComparator);
2315
2316 sql = query.toString();
2317 }
2318 else {
2319 sql = _SQL_SELECT_SCLICENSE;
2320
2321 if (pagination) {
2322 sql = sql.concat(SCLicenseModelImpl.ORDER_BY_JPQL);
2323 }
2324 }
2325
2326 Session session = null;
2327
2328 try {
2329 session = openSession();
2330
2331 Query q = session.createQuery(sql);
2332
2333 if (!pagination) {
2334 list = (List<SCLicense>)QueryUtil.list(q, getDialect(),
2335 start, end, false);
2336
2337 Collections.sort(list);
2338
2339 list = new UnmodifiableList<SCLicense>(list);
2340 }
2341 else {
2342 list = (List<SCLicense>)QueryUtil.list(q, getDialect(),
2343 start, end);
2344 }
2345
2346 cacheResult(list);
2347
2348 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2349 }
2350 catch (Exception e) {
2351 FinderCacheUtil.removeResult(finderPath, finderArgs);
2352
2353 throw processException(e);
2354 }
2355 finally {
2356 closeSession(session);
2357 }
2358 }
2359
2360 return list;
2361 }
2362
2363
2368 @Override
2369 public void removeAll() throws SystemException {
2370 for (SCLicense scLicense : findAll()) {
2371 remove(scLicense);
2372 }
2373 }
2374
2375
2381 @Override
2382 public int countAll() throws SystemException {
2383 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2384 FINDER_ARGS_EMPTY, this);
2385
2386 if (count == null) {
2387 Session session = null;
2388
2389 try {
2390 session = openSession();
2391
2392 Query q = session.createQuery(_SQL_COUNT_SCLICENSE);
2393
2394 count = (Long)q.uniqueResult();
2395
2396 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
2397 FINDER_ARGS_EMPTY, count);
2398 }
2399 catch (Exception e) {
2400 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_ALL,
2401 FINDER_ARGS_EMPTY);
2402
2403 throw processException(e);
2404 }
2405 finally {
2406 closeSession(session);
2407 }
2408 }
2409
2410 return count.intValue();
2411 }
2412
2413
2420 @Override
2421 public List<com.liferay.portlet.softwarecatalog.model.SCProductEntry> getSCProductEntries(
2422 long pk) throws SystemException {
2423 return getSCProductEntries(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
2424 }
2425
2426
2439 @Override
2440 public List<com.liferay.portlet.softwarecatalog.model.SCProductEntry> getSCProductEntries(
2441 long pk, int start, int end) throws SystemException {
2442 return getSCProductEntries(pk, start, end, null);
2443 }
2444
2445
2459 @Override
2460 public List<com.liferay.portlet.softwarecatalog.model.SCProductEntry> getSCProductEntries(
2461 long pk, int start, int end, OrderByComparator orderByComparator)
2462 throws SystemException {
2463 return scLicenseToSCProductEntryTableMapper.getRightBaseModels(pk,
2464 start, end, orderByComparator);
2465 }
2466
2467
2474 @Override
2475 public int getSCProductEntriesSize(long pk) throws SystemException {
2476 long[] pks = scLicenseToSCProductEntryTableMapper.getRightPrimaryKeys(pk);
2477
2478 return pks.length;
2479 }
2480
2481
2489 @Override
2490 public boolean containsSCProductEntry(long pk, long scProductEntryPK)
2491 throws SystemException {
2492 return scLicenseToSCProductEntryTableMapper.containsTableMapping(pk,
2493 scProductEntryPK);
2494 }
2495
2496
2503 @Override
2504 public boolean containsSCProductEntries(long pk) throws SystemException {
2505 if (getSCProductEntriesSize(pk) > 0) {
2506 return true;
2507 }
2508 else {
2509 return false;
2510 }
2511 }
2512
2513
2520 @Override
2521 public void addSCProductEntry(long pk, long scProductEntryPK)
2522 throws SystemException {
2523 scLicenseToSCProductEntryTableMapper.addTableMapping(pk,
2524 scProductEntryPK);
2525 }
2526
2527
2534 @Override
2535 public void addSCProductEntry(long pk,
2536 com.liferay.portlet.softwarecatalog.model.SCProductEntry scProductEntry)
2537 throws SystemException {
2538 scLicenseToSCProductEntryTableMapper.addTableMapping(pk,
2539 scProductEntry.getPrimaryKey());
2540 }
2541
2542
2549 @Override
2550 public void addSCProductEntries(long pk, long[] scProductEntryPKs)
2551 throws SystemException {
2552 for (long scProductEntryPK : scProductEntryPKs) {
2553 scLicenseToSCProductEntryTableMapper.addTableMapping(pk,
2554 scProductEntryPK);
2555 }
2556 }
2557
2558
2565 @Override
2566 public void addSCProductEntries(long pk,
2567 List<com.liferay.portlet.softwarecatalog.model.SCProductEntry> scProductEntries)
2568 throws SystemException {
2569 for (com.liferay.portlet.softwarecatalog.model.SCProductEntry scProductEntry : scProductEntries) {
2570 scLicenseToSCProductEntryTableMapper.addTableMapping(pk,
2571 scProductEntry.getPrimaryKey());
2572 }
2573 }
2574
2575
2581 @Override
2582 public void clearSCProductEntries(long pk) throws SystemException {
2583 scLicenseToSCProductEntryTableMapper.deleteLeftPrimaryKeyTableMappings(pk);
2584 }
2585
2586
2593 @Override
2594 public void removeSCProductEntry(long pk, long scProductEntryPK)
2595 throws SystemException {
2596 scLicenseToSCProductEntryTableMapper.deleteTableMapping(pk,
2597 scProductEntryPK);
2598 }
2599
2600
2607 @Override
2608 public void removeSCProductEntry(long pk,
2609 com.liferay.portlet.softwarecatalog.model.SCProductEntry scProductEntry)
2610 throws SystemException {
2611 scLicenseToSCProductEntryTableMapper.deleteTableMapping(pk,
2612 scProductEntry.getPrimaryKey());
2613 }
2614
2615
2622 @Override
2623 public void removeSCProductEntries(long pk, long[] scProductEntryPKs)
2624 throws SystemException {
2625 for (long scProductEntryPK : scProductEntryPKs) {
2626 scLicenseToSCProductEntryTableMapper.deleteTableMapping(pk,
2627 scProductEntryPK);
2628 }
2629 }
2630
2631
2638 @Override
2639 public void removeSCProductEntries(long pk,
2640 List<com.liferay.portlet.softwarecatalog.model.SCProductEntry> scProductEntries)
2641 throws SystemException {
2642 for (com.liferay.portlet.softwarecatalog.model.SCProductEntry scProductEntry : scProductEntries) {
2643 scLicenseToSCProductEntryTableMapper.deleteTableMapping(pk,
2644 scProductEntry.getPrimaryKey());
2645 }
2646 }
2647
2648
2655 @Override
2656 public void setSCProductEntries(long pk, long[] scProductEntryPKs)
2657 throws SystemException {
2658 scLicenseToSCProductEntryTableMapper.deleteLeftPrimaryKeyTableMappings(pk);
2659
2660 for (Long scProductEntryPK : scProductEntryPKs) {
2661 scLicenseToSCProductEntryTableMapper.addTableMapping(pk,
2662 scProductEntryPK);
2663 }
2664 }
2665
2666
2673 @Override
2674 public void setSCProductEntries(long pk,
2675 List<com.liferay.portlet.softwarecatalog.model.SCProductEntry> scProductEntries)
2676 throws SystemException {
2677 try {
2678 long[] scProductEntryPKs = new long[scProductEntries.size()];
2679
2680 for (int i = 0; i < scProductEntries.size(); i++) {
2681 com.liferay.portlet.softwarecatalog.model.SCProductEntry scProductEntry =
2682 scProductEntries.get(i);
2683
2684 scProductEntryPKs[i] = scProductEntry.getPrimaryKey();
2685 }
2686
2687 setSCProductEntries(pk, scProductEntryPKs);
2688 }
2689 catch (Exception e) {
2690 throw processException(e);
2691 }
2692 finally {
2693 FinderCacheUtil.clearCache(SCLicenseModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
2694 }
2695 }
2696
2697 @Override
2698 protected Set<String> getBadColumnNames() {
2699 return _badColumnNames;
2700 }
2701
2702
2705 public void afterPropertiesSet() {
2706 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2707 com.liferay.portal.util.PropsUtil.get(
2708 "value.object.listener.com.liferay.portlet.softwarecatalog.model.SCLicense")));
2709
2710 if (listenerClassNames.length > 0) {
2711 try {
2712 List<ModelListener<SCLicense>> listenersList = new ArrayList<ModelListener<SCLicense>>();
2713
2714 for (String listenerClassName : listenerClassNames) {
2715 listenersList.add((ModelListener<SCLicense>)InstanceFactory.newInstance(
2716 getClassLoader(), listenerClassName));
2717 }
2718
2719 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2720 }
2721 catch (Exception e) {
2722 _log.error(e);
2723 }
2724 }
2725
2726 scLicenseToSCProductEntryTableMapper = TableMapperFactory.getTableMapper("SCLicenses_SCProductEntries",
2727 "licenseId", "productEntryId", this, scProductEntryPersistence);
2728 }
2729
2730 public void destroy() {
2731 EntityCacheUtil.removeCache(SCLicenseImpl.class.getName());
2732 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
2733 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
2734 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2735 }
2736
2737 @BeanReference(type = SCProductEntryPersistence.class)
2738 protected SCProductEntryPersistence scProductEntryPersistence;
2739 protected TableMapper<SCLicense, com.liferay.portlet.softwarecatalog.model.SCProductEntry> scLicenseToSCProductEntryTableMapper;
2740 private static final String _SQL_SELECT_SCLICENSE = "SELECT scLicense FROM SCLicense scLicense";
2741 private static final String _SQL_SELECT_SCLICENSE_WHERE = "SELECT scLicense FROM SCLicense scLicense WHERE ";
2742 private static final String _SQL_COUNT_SCLICENSE = "SELECT COUNT(scLicense) FROM SCLicense scLicense";
2743 private static final String _SQL_COUNT_SCLICENSE_WHERE = "SELECT COUNT(scLicense) FROM SCLicense scLicense WHERE ";
2744 private static final String _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN = "scLicense.licenseId";
2745 private static final String _FILTER_SQL_SELECT_SCLICENSE_WHERE = "SELECT DISTINCT {scLicense.*} FROM SCLicense scLicense WHERE ";
2746 private static final String _FILTER_SQL_SELECT_SCLICENSE_NO_INLINE_DISTINCT_WHERE_1 =
2747 "SELECT {SCLicense.*} FROM (SELECT DISTINCT scLicense.licenseId FROM SCLicense scLicense WHERE ";
2748 private static final String _FILTER_SQL_SELECT_SCLICENSE_NO_INLINE_DISTINCT_WHERE_2 =
2749 ") TEMP_TABLE INNER JOIN SCLicense ON TEMP_TABLE.licenseId = SCLicense.licenseId";
2750 private static final String _FILTER_SQL_COUNT_SCLICENSE_WHERE = "SELECT COUNT(DISTINCT scLicense.licenseId) AS COUNT_VALUE FROM SCLicense scLicense WHERE ";
2751 private static final String _FILTER_ENTITY_ALIAS = "scLicense";
2752 private static final String _FILTER_ENTITY_TABLE = "SCLicense";
2753 private static final String _ORDER_BY_ENTITY_ALIAS = "scLicense.";
2754 private static final String _ORDER_BY_ENTITY_TABLE = "SCLicense.";
2755 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No SCLicense exists with the primary key ";
2756 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No SCLicense exists with the key {";
2757 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
2758 private static Log _log = LogFactoryUtil.getLog(SCLicensePersistenceImpl.class);
2759 private static Set<String> _badColumnNames = SetUtil.fromArray(new String[] {
2760 "active"
2761 });
2762 private static SCLicense _nullSCLicense = new SCLicenseImpl() {
2763 @Override
2764 public Object clone() {
2765 return this;
2766 }
2767
2768 @Override
2769 public CacheModel<SCLicense> toCacheModel() {
2770 return _nullSCLicenseCacheModel;
2771 }
2772 };
2773
2774 private static CacheModel<SCLicense> _nullSCLicenseCacheModel = new CacheModel<SCLicense>() {
2775 @Override
2776 public SCLicense toEntityModel() {
2777 return _nullSCLicense;
2778 }
2779 };
2780 }