001
014
015 package com.liferay.portlet.softwarecatalog.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.kernel.annotation.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.model.ModelListener;
044 import com.liferay.portal.security.permission.InlineSQLHelperUtil;
045 import com.liferay.portal.service.persistence.BatchSessionUtil;
046 import com.liferay.portal.service.persistence.ResourcePersistence;
047 import com.liferay.portal.service.persistence.UserPersistence;
048 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
049
050 import com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException;
051 import com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion;
052 import com.liferay.portlet.softwarecatalog.model.impl.SCFrameworkVersionImpl;
053 import com.liferay.portlet.softwarecatalog.model.impl.SCFrameworkVersionModelImpl;
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
078 public class SCFrameworkVersionPersistenceImpl extends BasePersistenceImpl<SCFrameworkVersion>
079 implements SCFrameworkVersionPersistence {
080 public static final String FINDER_CLASS_NAME_ENTITY = SCFrameworkVersionImpl.class.getName();
081 public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
082 ".List";
083 public static final FinderPath FINDER_PATH_FIND_BY_GROUPID = new FinderPath(SCFrameworkVersionModelImpl.ENTITY_CACHE_ENABLED,
084 SCFrameworkVersionModelImpl.FINDER_CACHE_ENABLED,
085 FINDER_CLASS_NAME_LIST, "findByGroupId",
086 new String[] {
087 Long.class.getName(),
088
089 "java.lang.Integer", "java.lang.Integer",
090 "com.liferay.portal.kernel.util.OrderByComparator"
091 });
092 public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(SCFrameworkVersionModelImpl.ENTITY_CACHE_ENABLED,
093 SCFrameworkVersionModelImpl.FINDER_CACHE_ENABLED,
094 FINDER_CLASS_NAME_LIST, "countByGroupId",
095 new String[] { Long.class.getName() });
096 public static final FinderPath FINDER_PATH_FIND_BY_COMPANYID = new FinderPath(SCFrameworkVersionModelImpl.ENTITY_CACHE_ENABLED,
097 SCFrameworkVersionModelImpl.FINDER_CACHE_ENABLED,
098 FINDER_CLASS_NAME_LIST, "findByCompanyId",
099 new String[] {
100 Long.class.getName(),
101
102 "java.lang.Integer", "java.lang.Integer",
103 "com.liferay.portal.kernel.util.OrderByComparator"
104 });
105 public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(SCFrameworkVersionModelImpl.ENTITY_CACHE_ENABLED,
106 SCFrameworkVersionModelImpl.FINDER_CACHE_ENABLED,
107 FINDER_CLASS_NAME_LIST, "countByCompanyId",
108 new String[] { Long.class.getName() });
109 public static final FinderPath FINDER_PATH_FIND_BY_G_A = new FinderPath(SCFrameworkVersionModelImpl.ENTITY_CACHE_ENABLED,
110 SCFrameworkVersionModelImpl.FINDER_CACHE_ENABLED,
111 FINDER_CLASS_NAME_LIST, "findByG_A",
112 new String[] {
113 Long.class.getName(), Boolean.class.getName(),
114
115 "java.lang.Integer", "java.lang.Integer",
116 "com.liferay.portal.kernel.util.OrderByComparator"
117 });
118 public static final FinderPath FINDER_PATH_COUNT_BY_G_A = new FinderPath(SCFrameworkVersionModelImpl.ENTITY_CACHE_ENABLED,
119 SCFrameworkVersionModelImpl.FINDER_CACHE_ENABLED,
120 FINDER_CLASS_NAME_LIST, "countByG_A",
121 new String[] { Long.class.getName(), Boolean.class.getName() });
122 public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(SCFrameworkVersionModelImpl.ENTITY_CACHE_ENABLED,
123 SCFrameworkVersionModelImpl.FINDER_CACHE_ENABLED,
124 FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
125 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(SCFrameworkVersionModelImpl.ENTITY_CACHE_ENABLED,
126 SCFrameworkVersionModelImpl.FINDER_CACHE_ENABLED,
127 FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
128
129
134 public void cacheResult(SCFrameworkVersion scFrameworkVersion) {
135 EntityCacheUtil.putResult(SCFrameworkVersionModelImpl.ENTITY_CACHE_ENABLED,
136 SCFrameworkVersionImpl.class, scFrameworkVersion.getPrimaryKey(),
137 scFrameworkVersion);
138 }
139
140
145 public void cacheResult(List<SCFrameworkVersion> scFrameworkVersions) {
146 for (SCFrameworkVersion scFrameworkVersion : scFrameworkVersions) {
147 if (EntityCacheUtil.getResult(
148 SCFrameworkVersionModelImpl.ENTITY_CACHE_ENABLED,
149 SCFrameworkVersionImpl.class,
150 scFrameworkVersion.getPrimaryKey(), this) == null) {
151 cacheResult(scFrameworkVersion);
152 }
153 }
154 }
155
156
163 public void clearCache() {
164 CacheRegistryUtil.clear(SCFrameworkVersionImpl.class.getName());
165 EntityCacheUtil.clearCache(SCFrameworkVersionImpl.class.getName());
166 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
167 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
168 }
169
170
177 public void clearCache(SCFrameworkVersion scFrameworkVersion) {
178 EntityCacheUtil.removeResult(SCFrameworkVersionModelImpl.ENTITY_CACHE_ENABLED,
179 SCFrameworkVersionImpl.class, scFrameworkVersion.getPrimaryKey());
180 }
181
182
188 public SCFrameworkVersion create(long frameworkVersionId) {
189 SCFrameworkVersion scFrameworkVersion = new SCFrameworkVersionImpl();
190
191 scFrameworkVersion.setNew(true);
192 scFrameworkVersion.setPrimaryKey(frameworkVersionId);
193
194 return scFrameworkVersion;
195 }
196
197
205 public SCFrameworkVersion remove(Serializable primaryKey)
206 throws NoSuchModelException, SystemException {
207 return remove(((Long)primaryKey).longValue());
208 }
209
210
218 public SCFrameworkVersion remove(long frameworkVersionId)
219 throws NoSuchFrameworkVersionException, SystemException {
220 Session session = null;
221
222 try {
223 session = openSession();
224
225 SCFrameworkVersion scFrameworkVersion = (SCFrameworkVersion)session.get(SCFrameworkVersionImpl.class,
226 new Long(frameworkVersionId));
227
228 if (scFrameworkVersion == null) {
229 if (_log.isWarnEnabled()) {
230 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
231 frameworkVersionId);
232 }
233
234 throw new NoSuchFrameworkVersionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
235 frameworkVersionId);
236 }
237
238 return remove(scFrameworkVersion);
239 }
240 catch (NoSuchFrameworkVersionException nsee) {
241 throw nsee;
242 }
243 catch (Exception e) {
244 throw processException(e);
245 }
246 finally {
247 closeSession(session);
248 }
249 }
250
251 protected SCFrameworkVersion removeImpl(
252 SCFrameworkVersion scFrameworkVersion) throws SystemException {
253 scFrameworkVersion = toUnwrappedModel(scFrameworkVersion);
254
255 try {
256 clearSCProductVersions.clear(scFrameworkVersion.getPrimaryKey());
257 }
258 catch (Exception e) {
259 throw processException(e);
260 }
261 finally {
262 FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
263 }
264
265 Session session = null;
266
267 try {
268 session = openSession();
269
270 BatchSessionUtil.delete(session, scFrameworkVersion);
271 }
272 catch (Exception e) {
273 throw processException(e);
274 }
275 finally {
276 closeSession(session);
277 }
278
279 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
280
281 EntityCacheUtil.removeResult(SCFrameworkVersionModelImpl.ENTITY_CACHE_ENABLED,
282 SCFrameworkVersionImpl.class, scFrameworkVersion.getPrimaryKey());
283
284 return scFrameworkVersion;
285 }
286
287 public SCFrameworkVersion updateImpl(
288 com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion scFrameworkVersion,
289 boolean merge) throws SystemException {
290 scFrameworkVersion = toUnwrappedModel(scFrameworkVersion);
291
292 Session session = null;
293
294 try {
295 session = openSession();
296
297 BatchSessionUtil.update(session, scFrameworkVersion, merge);
298
299 scFrameworkVersion.setNew(false);
300 }
301 catch (Exception e) {
302 throw processException(e);
303 }
304 finally {
305 closeSession(session);
306 }
307
308 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
309
310 EntityCacheUtil.putResult(SCFrameworkVersionModelImpl.ENTITY_CACHE_ENABLED,
311 SCFrameworkVersionImpl.class, scFrameworkVersion.getPrimaryKey(),
312 scFrameworkVersion);
313
314 return scFrameworkVersion;
315 }
316
317 protected SCFrameworkVersion toUnwrappedModel(
318 SCFrameworkVersion scFrameworkVersion) {
319 if (scFrameworkVersion instanceof SCFrameworkVersionImpl) {
320 return scFrameworkVersion;
321 }
322
323 SCFrameworkVersionImpl scFrameworkVersionImpl = new SCFrameworkVersionImpl();
324
325 scFrameworkVersionImpl.setNew(scFrameworkVersion.isNew());
326 scFrameworkVersionImpl.setPrimaryKey(scFrameworkVersion.getPrimaryKey());
327
328 scFrameworkVersionImpl.setFrameworkVersionId(scFrameworkVersion.getFrameworkVersionId());
329 scFrameworkVersionImpl.setGroupId(scFrameworkVersion.getGroupId());
330 scFrameworkVersionImpl.setCompanyId(scFrameworkVersion.getCompanyId());
331 scFrameworkVersionImpl.setUserId(scFrameworkVersion.getUserId());
332 scFrameworkVersionImpl.setUserName(scFrameworkVersion.getUserName());
333 scFrameworkVersionImpl.setCreateDate(scFrameworkVersion.getCreateDate());
334 scFrameworkVersionImpl.setModifiedDate(scFrameworkVersion.getModifiedDate());
335 scFrameworkVersionImpl.setName(scFrameworkVersion.getName());
336 scFrameworkVersionImpl.setUrl(scFrameworkVersion.getUrl());
337 scFrameworkVersionImpl.setActive(scFrameworkVersion.isActive());
338 scFrameworkVersionImpl.setPriority(scFrameworkVersion.getPriority());
339
340 return scFrameworkVersionImpl;
341 }
342
343
351 public SCFrameworkVersion findByPrimaryKey(Serializable primaryKey)
352 throws NoSuchModelException, SystemException {
353 return findByPrimaryKey(((Long)primaryKey).longValue());
354 }
355
356
364 public SCFrameworkVersion findByPrimaryKey(long frameworkVersionId)
365 throws NoSuchFrameworkVersionException, SystemException {
366 SCFrameworkVersion scFrameworkVersion = fetchByPrimaryKey(frameworkVersionId);
367
368 if (scFrameworkVersion == null) {
369 if (_log.isWarnEnabled()) {
370 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
371 frameworkVersionId);
372 }
373
374 throw new NoSuchFrameworkVersionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
375 frameworkVersionId);
376 }
377
378 return scFrameworkVersion;
379 }
380
381
388 public SCFrameworkVersion fetchByPrimaryKey(Serializable primaryKey)
389 throws SystemException {
390 return fetchByPrimaryKey(((Long)primaryKey).longValue());
391 }
392
393
400 public SCFrameworkVersion fetchByPrimaryKey(long frameworkVersionId)
401 throws SystemException {
402 SCFrameworkVersion scFrameworkVersion = (SCFrameworkVersion)EntityCacheUtil.getResult(SCFrameworkVersionModelImpl.ENTITY_CACHE_ENABLED,
403 SCFrameworkVersionImpl.class, frameworkVersionId, this);
404
405 if (scFrameworkVersion == null) {
406 Session session = null;
407
408 try {
409 session = openSession();
410
411 scFrameworkVersion = (SCFrameworkVersion)session.get(SCFrameworkVersionImpl.class,
412 new Long(frameworkVersionId));
413 }
414 catch (Exception e) {
415 throw processException(e);
416 }
417 finally {
418 if (scFrameworkVersion != null) {
419 cacheResult(scFrameworkVersion);
420 }
421
422 closeSession(session);
423 }
424 }
425
426 return scFrameworkVersion;
427 }
428
429
436 public List<SCFrameworkVersion> findByGroupId(long groupId)
437 throws SystemException {
438 return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
439 }
440
441
454 public List<SCFrameworkVersion> findByGroupId(long groupId, int start,
455 int end) throws SystemException {
456 return findByGroupId(groupId, start, end, null);
457 }
458
459
473 public List<SCFrameworkVersion> findByGroupId(long groupId, int start,
474 int end, OrderByComparator orderByComparator) throws SystemException {
475 Object[] finderArgs = new Object[] {
476 groupId,
477
478 String.valueOf(start), String.valueOf(end),
479 String.valueOf(orderByComparator)
480 };
481
482 List<SCFrameworkVersion> list = (List<SCFrameworkVersion>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
483 finderArgs, this);
484
485 if (list == null) {
486 StringBundler query = null;
487
488 if (orderByComparator != null) {
489 query = new StringBundler(3 +
490 (orderByComparator.getOrderByFields().length * 3));
491 }
492 else {
493 query = new StringBundler(3);
494 }
495
496 query.append(_SQL_SELECT_SCFRAMEWORKVERSION_WHERE);
497
498 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
499
500 if (orderByComparator != null) {
501 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
502 orderByComparator);
503 }
504
505 else {
506 query.append(SCFrameworkVersionModelImpl.ORDER_BY_JPQL);
507 }
508
509 String sql = query.toString();
510
511 Session session = null;
512
513 try {
514 session = openSession();
515
516 Query q = session.createQuery(sql);
517
518 QueryPos qPos = QueryPos.getInstance(q);
519
520 qPos.add(groupId);
521
522 list = (List<SCFrameworkVersion>)QueryUtil.list(q,
523 getDialect(), start, end);
524 }
525 catch (Exception e) {
526 throw processException(e);
527 }
528 finally {
529 if (list == null) {
530 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_GROUPID,
531 finderArgs);
532 }
533 else {
534 cacheResult(list);
535
536 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
537 finderArgs, list);
538 }
539
540 closeSession(session);
541 }
542 }
543
544 return list;
545 }
546
547
560 public SCFrameworkVersion findByGroupId_First(long groupId,
561 OrderByComparator orderByComparator)
562 throws NoSuchFrameworkVersionException, SystemException {
563 List<SCFrameworkVersion> list = findByGroupId(groupId, 0, 1,
564 orderByComparator);
565
566 if (list.isEmpty()) {
567 StringBundler msg = new StringBundler(4);
568
569 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
570
571 msg.append("groupId=");
572 msg.append(groupId);
573
574 msg.append(StringPool.CLOSE_CURLY_BRACE);
575
576 throw new NoSuchFrameworkVersionException(msg.toString());
577 }
578 else {
579 return list.get(0);
580 }
581 }
582
583
596 public SCFrameworkVersion findByGroupId_Last(long groupId,
597 OrderByComparator orderByComparator)
598 throws NoSuchFrameworkVersionException, SystemException {
599 int count = countByGroupId(groupId);
600
601 List<SCFrameworkVersion> list = findByGroupId(groupId, count - 1,
602 count, orderByComparator);
603
604 if (list.isEmpty()) {
605 StringBundler msg = new StringBundler(4);
606
607 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
608
609 msg.append("groupId=");
610 msg.append(groupId);
611
612 msg.append(StringPool.CLOSE_CURLY_BRACE);
613
614 throw new NoSuchFrameworkVersionException(msg.toString());
615 }
616 else {
617 return list.get(0);
618 }
619 }
620
621
635 public SCFrameworkVersion[] findByGroupId_PrevAndNext(
636 long frameworkVersionId, long groupId,
637 OrderByComparator orderByComparator)
638 throws NoSuchFrameworkVersionException, SystemException {
639 SCFrameworkVersion scFrameworkVersion = findByPrimaryKey(frameworkVersionId);
640
641 Session session = null;
642
643 try {
644 session = openSession();
645
646 SCFrameworkVersion[] array = new SCFrameworkVersionImpl[3];
647
648 array[0] = getByGroupId_PrevAndNext(session, scFrameworkVersion,
649 groupId, orderByComparator, true);
650
651 array[1] = scFrameworkVersion;
652
653 array[2] = getByGroupId_PrevAndNext(session, scFrameworkVersion,
654 groupId, orderByComparator, false);
655
656 return array;
657 }
658 catch (Exception e) {
659 throw processException(e);
660 }
661 finally {
662 closeSession(session);
663 }
664 }
665
666 protected SCFrameworkVersion getByGroupId_PrevAndNext(Session session,
667 SCFrameworkVersion scFrameworkVersion, long groupId,
668 OrderByComparator orderByComparator, boolean previous) {
669 StringBundler query = null;
670
671 if (orderByComparator != null) {
672 query = new StringBundler(6 +
673 (orderByComparator.getOrderByFields().length * 6));
674 }
675 else {
676 query = new StringBundler(3);
677 }
678
679 query.append(_SQL_SELECT_SCFRAMEWORKVERSION_WHERE);
680
681 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
682
683 if (orderByComparator != null) {
684 String[] orderByFields = orderByComparator.getOrderByFields();
685
686 if (orderByFields.length > 0) {
687 query.append(WHERE_AND);
688 }
689
690 for (int i = 0; i < orderByFields.length; i++) {
691 query.append(_ORDER_BY_ENTITY_ALIAS);
692 query.append(orderByFields[i]);
693
694 if ((i + 1) < orderByFields.length) {
695 if (orderByComparator.isAscending() ^ previous) {
696 query.append(WHERE_GREATER_THAN_HAS_NEXT);
697 }
698 else {
699 query.append(WHERE_LESSER_THAN_HAS_NEXT);
700 }
701 }
702 else {
703 if (orderByComparator.isAscending() ^ previous) {
704 query.append(WHERE_GREATER_THAN);
705 }
706 else {
707 query.append(WHERE_LESSER_THAN);
708 }
709 }
710 }
711
712 query.append(ORDER_BY_CLAUSE);
713
714 for (int i = 0; i < orderByFields.length; i++) {
715 query.append(_ORDER_BY_ENTITY_ALIAS);
716 query.append(orderByFields[i]);
717
718 if ((i + 1) < orderByFields.length) {
719 if (orderByComparator.isAscending() ^ previous) {
720 query.append(ORDER_BY_ASC_HAS_NEXT);
721 }
722 else {
723 query.append(ORDER_BY_DESC_HAS_NEXT);
724 }
725 }
726 else {
727 if (orderByComparator.isAscending() ^ previous) {
728 query.append(ORDER_BY_ASC);
729 }
730 else {
731 query.append(ORDER_BY_DESC);
732 }
733 }
734 }
735 }
736
737 else {
738 query.append(SCFrameworkVersionModelImpl.ORDER_BY_JPQL);
739 }
740
741 String sql = query.toString();
742
743 Query q = session.createQuery(sql);
744
745 q.setFirstResult(0);
746 q.setMaxResults(2);
747
748 QueryPos qPos = QueryPos.getInstance(q);
749
750 qPos.add(groupId);
751
752 if (orderByComparator != null) {
753 Object[] values = orderByComparator.getOrderByValues(scFrameworkVersion);
754
755 for (Object value : values) {
756 qPos.add(value);
757 }
758 }
759
760 List<SCFrameworkVersion> list = q.list();
761
762 if (list.size() == 2) {
763 return list.get(1);
764 }
765 else {
766 return null;
767 }
768 }
769
770
777 public List<SCFrameworkVersion> filterFindByGroupId(long groupId)
778 throws SystemException {
779 return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
780 QueryUtil.ALL_POS, null);
781 }
782
783
796 public List<SCFrameworkVersion> filterFindByGroupId(long groupId,
797 int start, int end) throws SystemException {
798 return filterFindByGroupId(groupId, start, end, null);
799 }
800
801
815 public List<SCFrameworkVersion> filterFindByGroupId(long groupId,
816 int start, int end, OrderByComparator orderByComparator)
817 throws SystemException {
818 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
819 return findByGroupId(groupId, start, end, orderByComparator);
820 }
821
822 StringBundler query = null;
823
824 if (orderByComparator != null) {
825 query = new StringBundler(3 +
826 (orderByComparator.getOrderByFields().length * 3));
827 }
828 else {
829 query = new StringBundler(3);
830 }
831
832 if (getDB().isSupportsInlineDistinct()) {
833 query.append(_FILTER_SQL_SELECT_SCFRAMEWORKVERSION_WHERE);
834 }
835 else {
836 query.append(_FILTER_SQL_SELECT_SCFRAMEWORKVERSION_NO_INLINE_DISTINCT_WHERE_1);
837 }
838
839 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
840
841 if (!getDB().isSupportsInlineDistinct()) {
842 query.append(_FILTER_SQL_SELECT_SCFRAMEWORKVERSION_NO_INLINE_DISTINCT_WHERE_2);
843 }
844
845 if (orderByComparator != null) {
846 if (getDB().isSupportsInlineDistinct()) {
847 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
848 orderByComparator);
849 }
850 else {
851 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
852 orderByComparator);
853 }
854 }
855
856 else {
857 if (getDB().isSupportsInlineDistinct()) {
858 query.append(SCFrameworkVersionModelImpl.ORDER_BY_JPQL);
859 }
860 else {
861 query.append(SCFrameworkVersionModelImpl.ORDER_BY_SQL);
862 }
863 }
864
865 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
866 SCFrameworkVersion.class.getName(), _FILTER_COLUMN_PK,
867 _FILTER_COLUMN_USERID, groupId);
868
869 Session session = null;
870
871 try {
872 session = openSession();
873
874 SQLQuery q = session.createSQLQuery(sql);
875
876 if (getDB().isSupportsInlineDistinct()) {
877 q.addEntity(_FILTER_ENTITY_ALIAS, SCFrameworkVersionImpl.class);
878 }
879 else {
880 q.addEntity(_FILTER_ENTITY_TABLE, SCFrameworkVersionImpl.class);
881 }
882
883 QueryPos qPos = QueryPos.getInstance(q);
884
885 qPos.add(groupId);
886
887 return (List<SCFrameworkVersion>)QueryUtil.list(q, getDialect(),
888 start, end);
889 }
890 catch (Exception e) {
891 throw processException(e);
892 }
893 finally {
894 closeSession(session);
895 }
896 }
897
898
905 public List<SCFrameworkVersion> findByCompanyId(long companyId)
906 throws SystemException {
907 return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
908 null);
909 }
910
911
924 public List<SCFrameworkVersion> findByCompanyId(long companyId, int start,
925 int end) throws SystemException {
926 return findByCompanyId(companyId, start, end, null);
927 }
928
929
943 public List<SCFrameworkVersion> findByCompanyId(long companyId, int start,
944 int end, OrderByComparator orderByComparator) throws SystemException {
945 Object[] finderArgs = new Object[] {
946 companyId,
947
948 String.valueOf(start), String.valueOf(end),
949 String.valueOf(orderByComparator)
950 };
951
952 List<SCFrameworkVersion> list = (List<SCFrameworkVersion>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_COMPANYID,
953 finderArgs, this);
954
955 if (list == null) {
956 StringBundler query = null;
957
958 if (orderByComparator != null) {
959 query = new StringBundler(3 +
960 (orderByComparator.getOrderByFields().length * 3));
961 }
962 else {
963 query = new StringBundler(3);
964 }
965
966 query.append(_SQL_SELECT_SCFRAMEWORKVERSION_WHERE);
967
968 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
969
970 if (orderByComparator != null) {
971 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
972 orderByComparator);
973 }
974
975 else {
976 query.append(SCFrameworkVersionModelImpl.ORDER_BY_JPQL);
977 }
978
979 String sql = query.toString();
980
981 Session session = null;
982
983 try {
984 session = openSession();
985
986 Query q = session.createQuery(sql);
987
988 QueryPos qPos = QueryPos.getInstance(q);
989
990 qPos.add(companyId);
991
992 list = (List<SCFrameworkVersion>)QueryUtil.list(q,
993 getDialect(), start, end);
994 }
995 catch (Exception e) {
996 throw processException(e);
997 }
998 finally {
999 if (list == null) {
1000 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_COMPANYID,
1001 finderArgs);
1002 }
1003 else {
1004 cacheResult(list);
1005
1006 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_COMPANYID,
1007 finderArgs, list);
1008 }
1009
1010 closeSession(session);
1011 }
1012 }
1013
1014 return list;
1015 }
1016
1017
1030 public SCFrameworkVersion findByCompanyId_First(long companyId,
1031 OrderByComparator orderByComparator)
1032 throws NoSuchFrameworkVersionException, SystemException {
1033 List<SCFrameworkVersion> list = findByCompanyId(companyId, 0, 1,
1034 orderByComparator);
1035
1036 if (list.isEmpty()) {
1037 StringBundler msg = new StringBundler(4);
1038
1039 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1040
1041 msg.append("companyId=");
1042 msg.append(companyId);
1043
1044 msg.append(StringPool.CLOSE_CURLY_BRACE);
1045
1046 throw new NoSuchFrameworkVersionException(msg.toString());
1047 }
1048 else {
1049 return list.get(0);
1050 }
1051 }
1052
1053
1066 public SCFrameworkVersion findByCompanyId_Last(long companyId,
1067 OrderByComparator orderByComparator)
1068 throws NoSuchFrameworkVersionException, SystemException {
1069 int count = countByCompanyId(companyId);
1070
1071 List<SCFrameworkVersion> list = findByCompanyId(companyId, count - 1,
1072 count, orderByComparator);
1073
1074 if (list.isEmpty()) {
1075 StringBundler msg = new StringBundler(4);
1076
1077 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1078
1079 msg.append("companyId=");
1080 msg.append(companyId);
1081
1082 msg.append(StringPool.CLOSE_CURLY_BRACE);
1083
1084 throw new NoSuchFrameworkVersionException(msg.toString());
1085 }
1086 else {
1087 return list.get(0);
1088 }
1089 }
1090
1091
1105 public SCFrameworkVersion[] findByCompanyId_PrevAndNext(
1106 long frameworkVersionId, long companyId,
1107 OrderByComparator orderByComparator)
1108 throws NoSuchFrameworkVersionException, SystemException {
1109 SCFrameworkVersion scFrameworkVersion = findByPrimaryKey(frameworkVersionId);
1110
1111 Session session = null;
1112
1113 try {
1114 session = openSession();
1115
1116 SCFrameworkVersion[] array = new SCFrameworkVersionImpl[3];
1117
1118 array[0] = getByCompanyId_PrevAndNext(session, scFrameworkVersion,
1119 companyId, orderByComparator, true);
1120
1121 array[1] = scFrameworkVersion;
1122
1123 array[2] = getByCompanyId_PrevAndNext(session, scFrameworkVersion,
1124 companyId, orderByComparator, false);
1125
1126 return array;
1127 }
1128 catch (Exception e) {
1129 throw processException(e);
1130 }
1131 finally {
1132 closeSession(session);
1133 }
1134 }
1135
1136 protected SCFrameworkVersion getByCompanyId_PrevAndNext(Session session,
1137 SCFrameworkVersion scFrameworkVersion, long companyId,
1138 OrderByComparator orderByComparator, boolean previous) {
1139 StringBundler query = null;
1140
1141 if (orderByComparator != null) {
1142 query = new StringBundler(6 +
1143 (orderByComparator.getOrderByFields().length * 6));
1144 }
1145 else {
1146 query = new StringBundler(3);
1147 }
1148
1149 query.append(_SQL_SELECT_SCFRAMEWORKVERSION_WHERE);
1150
1151 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1152
1153 if (orderByComparator != null) {
1154 String[] orderByFields = orderByComparator.getOrderByFields();
1155
1156 if (orderByFields.length > 0) {
1157 query.append(WHERE_AND);
1158 }
1159
1160 for (int i = 0; i < orderByFields.length; i++) {
1161 query.append(_ORDER_BY_ENTITY_ALIAS);
1162 query.append(orderByFields[i]);
1163
1164 if ((i + 1) < orderByFields.length) {
1165 if (orderByComparator.isAscending() ^ previous) {
1166 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1167 }
1168 else {
1169 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1170 }
1171 }
1172 else {
1173 if (orderByComparator.isAscending() ^ previous) {
1174 query.append(WHERE_GREATER_THAN);
1175 }
1176 else {
1177 query.append(WHERE_LESSER_THAN);
1178 }
1179 }
1180 }
1181
1182 query.append(ORDER_BY_CLAUSE);
1183
1184 for (int i = 0; i < orderByFields.length; i++) {
1185 query.append(_ORDER_BY_ENTITY_ALIAS);
1186 query.append(orderByFields[i]);
1187
1188 if ((i + 1) < orderByFields.length) {
1189 if (orderByComparator.isAscending() ^ previous) {
1190 query.append(ORDER_BY_ASC_HAS_NEXT);
1191 }
1192 else {
1193 query.append(ORDER_BY_DESC_HAS_NEXT);
1194 }
1195 }
1196 else {
1197 if (orderByComparator.isAscending() ^ previous) {
1198 query.append(ORDER_BY_ASC);
1199 }
1200 else {
1201 query.append(ORDER_BY_DESC);
1202 }
1203 }
1204 }
1205 }
1206
1207 else {
1208 query.append(SCFrameworkVersionModelImpl.ORDER_BY_JPQL);
1209 }
1210
1211 String sql = query.toString();
1212
1213 Query q = session.createQuery(sql);
1214
1215 q.setFirstResult(0);
1216 q.setMaxResults(2);
1217
1218 QueryPos qPos = QueryPos.getInstance(q);
1219
1220 qPos.add(companyId);
1221
1222 if (orderByComparator != null) {
1223 Object[] values = orderByComparator.getOrderByValues(scFrameworkVersion);
1224
1225 for (Object value : values) {
1226 qPos.add(value);
1227 }
1228 }
1229
1230 List<SCFrameworkVersion> list = q.list();
1231
1232 if (list.size() == 2) {
1233 return list.get(1);
1234 }
1235 else {
1236 return null;
1237 }
1238 }
1239
1240
1248 public List<SCFrameworkVersion> findByG_A(long groupId, boolean active)
1249 throws SystemException {
1250 return findByG_A(groupId, active, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1251 null);
1252 }
1253
1254
1268 public List<SCFrameworkVersion> findByG_A(long groupId, boolean active,
1269 int start, int end) throws SystemException {
1270 return findByG_A(groupId, active, start, end, null);
1271 }
1272
1273
1288 public List<SCFrameworkVersion> findByG_A(long groupId, boolean active,
1289 int start, int end, OrderByComparator orderByComparator)
1290 throws SystemException {
1291 Object[] finderArgs = new Object[] {
1292 groupId, active,
1293
1294 String.valueOf(start), String.valueOf(end),
1295 String.valueOf(orderByComparator)
1296 };
1297
1298 List<SCFrameworkVersion> list = (List<SCFrameworkVersion>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_A,
1299 finderArgs, this);
1300
1301 if (list == null) {
1302 StringBundler query = null;
1303
1304 if (orderByComparator != null) {
1305 query = new StringBundler(4 +
1306 (orderByComparator.getOrderByFields().length * 3));
1307 }
1308 else {
1309 query = new StringBundler(4);
1310 }
1311
1312 query.append(_SQL_SELECT_SCFRAMEWORKVERSION_WHERE);
1313
1314 query.append(_FINDER_COLUMN_G_A_GROUPID_2);
1315
1316 query.append(_FINDER_COLUMN_G_A_ACTIVE_2);
1317
1318 if (orderByComparator != null) {
1319 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1320 orderByComparator);
1321 }
1322
1323 else {
1324 query.append(SCFrameworkVersionModelImpl.ORDER_BY_JPQL);
1325 }
1326
1327 String sql = query.toString();
1328
1329 Session session = null;
1330
1331 try {
1332 session = openSession();
1333
1334 Query q = session.createQuery(sql);
1335
1336 QueryPos qPos = QueryPos.getInstance(q);
1337
1338 qPos.add(groupId);
1339
1340 qPos.add(active);
1341
1342 list = (List<SCFrameworkVersion>)QueryUtil.list(q,
1343 getDialect(), start, end);
1344 }
1345 catch (Exception e) {
1346 throw processException(e);
1347 }
1348 finally {
1349 if (list == null) {
1350 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_G_A,
1351 finderArgs);
1352 }
1353 else {
1354 cacheResult(list);
1355
1356 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_A,
1357 finderArgs, list);
1358 }
1359
1360 closeSession(session);
1361 }
1362 }
1363
1364 return list;
1365 }
1366
1367
1381 public SCFrameworkVersion findByG_A_First(long groupId, boolean active,
1382 OrderByComparator orderByComparator)
1383 throws NoSuchFrameworkVersionException, SystemException {
1384 List<SCFrameworkVersion> list = findByG_A(groupId, active, 0, 1,
1385 orderByComparator);
1386
1387 if (list.isEmpty()) {
1388 StringBundler msg = new StringBundler(6);
1389
1390 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1391
1392 msg.append("groupId=");
1393 msg.append(groupId);
1394
1395 msg.append(", active=");
1396 msg.append(active);
1397
1398 msg.append(StringPool.CLOSE_CURLY_BRACE);
1399
1400 throw new NoSuchFrameworkVersionException(msg.toString());
1401 }
1402 else {
1403 return list.get(0);
1404 }
1405 }
1406
1407
1421 public SCFrameworkVersion findByG_A_Last(long groupId, boolean active,
1422 OrderByComparator orderByComparator)
1423 throws NoSuchFrameworkVersionException, SystemException {
1424 int count = countByG_A(groupId, active);
1425
1426 List<SCFrameworkVersion> list = findByG_A(groupId, active, count - 1,
1427 count, orderByComparator);
1428
1429 if (list.isEmpty()) {
1430 StringBundler msg = new StringBundler(6);
1431
1432 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1433
1434 msg.append("groupId=");
1435 msg.append(groupId);
1436
1437 msg.append(", active=");
1438 msg.append(active);
1439
1440 msg.append(StringPool.CLOSE_CURLY_BRACE);
1441
1442 throw new NoSuchFrameworkVersionException(msg.toString());
1443 }
1444 else {
1445 return list.get(0);
1446 }
1447 }
1448
1449
1464 public SCFrameworkVersion[] findByG_A_PrevAndNext(long frameworkVersionId,
1465 long groupId, boolean active, OrderByComparator orderByComparator)
1466 throws NoSuchFrameworkVersionException, SystemException {
1467 SCFrameworkVersion scFrameworkVersion = findByPrimaryKey(frameworkVersionId);
1468
1469 Session session = null;
1470
1471 try {
1472 session = openSession();
1473
1474 SCFrameworkVersion[] array = new SCFrameworkVersionImpl[3];
1475
1476 array[0] = getByG_A_PrevAndNext(session, scFrameworkVersion,
1477 groupId, active, orderByComparator, true);
1478
1479 array[1] = scFrameworkVersion;
1480
1481 array[2] = getByG_A_PrevAndNext(session, scFrameworkVersion,
1482 groupId, active, orderByComparator, false);
1483
1484 return array;
1485 }
1486 catch (Exception e) {
1487 throw processException(e);
1488 }
1489 finally {
1490 closeSession(session);
1491 }
1492 }
1493
1494 protected SCFrameworkVersion getByG_A_PrevAndNext(Session session,
1495 SCFrameworkVersion scFrameworkVersion, long groupId, boolean active,
1496 OrderByComparator orderByComparator, boolean previous) {
1497 StringBundler query = null;
1498
1499 if (orderByComparator != null) {
1500 query = new StringBundler(6 +
1501 (orderByComparator.getOrderByFields().length * 6));
1502 }
1503 else {
1504 query = new StringBundler(3);
1505 }
1506
1507 query.append(_SQL_SELECT_SCFRAMEWORKVERSION_WHERE);
1508
1509 query.append(_FINDER_COLUMN_G_A_GROUPID_2);
1510
1511 query.append(_FINDER_COLUMN_G_A_ACTIVE_2);
1512
1513 if (orderByComparator != null) {
1514 String[] orderByFields = orderByComparator.getOrderByFields();
1515
1516 if (orderByFields.length > 0) {
1517 query.append(WHERE_AND);
1518 }
1519
1520 for (int i = 0; i < orderByFields.length; i++) {
1521 query.append(_ORDER_BY_ENTITY_ALIAS);
1522 query.append(orderByFields[i]);
1523
1524 if ((i + 1) < orderByFields.length) {
1525 if (orderByComparator.isAscending() ^ previous) {
1526 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1527 }
1528 else {
1529 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1530 }
1531 }
1532 else {
1533 if (orderByComparator.isAscending() ^ previous) {
1534 query.append(WHERE_GREATER_THAN);
1535 }
1536 else {
1537 query.append(WHERE_LESSER_THAN);
1538 }
1539 }
1540 }
1541
1542 query.append(ORDER_BY_CLAUSE);
1543
1544 for (int i = 0; i < orderByFields.length; i++) {
1545 query.append(_ORDER_BY_ENTITY_ALIAS);
1546 query.append(orderByFields[i]);
1547
1548 if ((i + 1) < orderByFields.length) {
1549 if (orderByComparator.isAscending() ^ previous) {
1550 query.append(ORDER_BY_ASC_HAS_NEXT);
1551 }
1552 else {
1553 query.append(ORDER_BY_DESC_HAS_NEXT);
1554 }
1555 }
1556 else {
1557 if (orderByComparator.isAscending() ^ previous) {
1558 query.append(ORDER_BY_ASC);
1559 }
1560 else {
1561 query.append(ORDER_BY_DESC);
1562 }
1563 }
1564 }
1565 }
1566
1567 else {
1568 query.append(SCFrameworkVersionModelImpl.ORDER_BY_JPQL);
1569 }
1570
1571 String sql = query.toString();
1572
1573 Query q = session.createQuery(sql);
1574
1575 q.setFirstResult(0);
1576 q.setMaxResults(2);
1577
1578 QueryPos qPos = QueryPos.getInstance(q);
1579
1580 qPos.add(groupId);
1581
1582 qPos.add(active);
1583
1584 if (orderByComparator != null) {
1585 Object[] values = orderByComparator.getOrderByValues(scFrameworkVersion);
1586
1587 for (Object value : values) {
1588 qPos.add(value);
1589 }
1590 }
1591
1592 List<SCFrameworkVersion> list = q.list();
1593
1594 if (list.size() == 2) {
1595 return list.get(1);
1596 }
1597 else {
1598 return null;
1599 }
1600 }
1601
1602
1610 public List<SCFrameworkVersion> filterFindByG_A(long groupId, boolean active)
1611 throws SystemException {
1612 return filterFindByG_A(groupId, active, QueryUtil.ALL_POS,
1613 QueryUtil.ALL_POS, null);
1614 }
1615
1616
1630 public List<SCFrameworkVersion> filterFindByG_A(long groupId,
1631 boolean active, int start, int end) throws SystemException {
1632 return filterFindByG_A(groupId, active, start, end, null);
1633 }
1634
1635
1650 public List<SCFrameworkVersion> filterFindByG_A(long groupId,
1651 boolean active, int start, int end, OrderByComparator orderByComparator)
1652 throws SystemException {
1653 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1654 return findByG_A(groupId, active, start, end, orderByComparator);
1655 }
1656
1657 StringBundler query = null;
1658
1659 if (orderByComparator != null) {
1660 query = new StringBundler(4 +
1661 (orderByComparator.getOrderByFields().length * 3));
1662 }
1663 else {
1664 query = new StringBundler(4);
1665 }
1666
1667 if (getDB().isSupportsInlineDistinct()) {
1668 query.append(_FILTER_SQL_SELECT_SCFRAMEWORKVERSION_WHERE);
1669 }
1670 else {
1671 query.append(_FILTER_SQL_SELECT_SCFRAMEWORKVERSION_NO_INLINE_DISTINCT_WHERE_1);
1672 }
1673
1674 query.append(_FINDER_COLUMN_G_A_GROUPID_2);
1675
1676 query.append(_FINDER_COLUMN_G_A_ACTIVE_2);
1677
1678 if (!getDB().isSupportsInlineDistinct()) {
1679 query.append(_FILTER_SQL_SELECT_SCFRAMEWORKVERSION_NO_INLINE_DISTINCT_WHERE_2);
1680 }
1681
1682 if (orderByComparator != null) {
1683 if (getDB().isSupportsInlineDistinct()) {
1684 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1685 orderByComparator);
1686 }
1687 else {
1688 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1689 orderByComparator);
1690 }
1691 }
1692
1693 else {
1694 if (getDB().isSupportsInlineDistinct()) {
1695 query.append(SCFrameworkVersionModelImpl.ORDER_BY_JPQL);
1696 }
1697 else {
1698 query.append(SCFrameworkVersionModelImpl.ORDER_BY_SQL);
1699 }
1700 }
1701
1702 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1703 SCFrameworkVersion.class.getName(), _FILTER_COLUMN_PK,
1704 _FILTER_COLUMN_USERID, groupId);
1705
1706 Session session = null;
1707
1708 try {
1709 session = openSession();
1710
1711 SQLQuery q = session.createSQLQuery(sql);
1712
1713 if (getDB().isSupportsInlineDistinct()) {
1714 q.addEntity(_FILTER_ENTITY_ALIAS, SCFrameworkVersionImpl.class);
1715 }
1716 else {
1717 q.addEntity(_FILTER_ENTITY_TABLE, SCFrameworkVersionImpl.class);
1718 }
1719
1720 QueryPos qPos = QueryPos.getInstance(q);
1721
1722 qPos.add(groupId);
1723
1724 qPos.add(active);
1725
1726 return (List<SCFrameworkVersion>)QueryUtil.list(q, getDialect(),
1727 start, end);
1728 }
1729 catch (Exception e) {
1730 throw processException(e);
1731 }
1732 finally {
1733 closeSession(session);
1734 }
1735 }
1736
1737
1743 public List<SCFrameworkVersion> findAll() throws SystemException {
1744 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1745 }
1746
1747
1759 public List<SCFrameworkVersion> findAll(int start, int end)
1760 throws SystemException {
1761 return findAll(start, end, null);
1762 }
1763
1764
1777 public List<SCFrameworkVersion> findAll(int start, int end,
1778 OrderByComparator orderByComparator) throws SystemException {
1779 Object[] finderArgs = new Object[] {
1780 String.valueOf(start), String.valueOf(end),
1781 String.valueOf(orderByComparator)
1782 };
1783
1784 List<SCFrameworkVersion> list = (List<SCFrameworkVersion>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
1785 finderArgs, this);
1786
1787 if (list == null) {
1788 StringBundler query = null;
1789 String sql = null;
1790
1791 if (orderByComparator != null) {
1792 query = new StringBundler(2 +
1793 (orderByComparator.getOrderByFields().length * 3));
1794
1795 query.append(_SQL_SELECT_SCFRAMEWORKVERSION);
1796
1797 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1798 orderByComparator);
1799
1800 sql = query.toString();
1801 }
1802 else {
1803 sql = _SQL_SELECT_SCFRAMEWORKVERSION.concat(SCFrameworkVersionModelImpl.ORDER_BY_JPQL);
1804 }
1805
1806 Session session = null;
1807
1808 try {
1809 session = openSession();
1810
1811 Query q = session.createQuery(sql);
1812
1813 if (orderByComparator == null) {
1814 list = (List<SCFrameworkVersion>)QueryUtil.list(q,
1815 getDialect(), start, end, false);
1816
1817 Collections.sort(list);
1818 }
1819 else {
1820 list = (List<SCFrameworkVersion>)QueryUtil.list(q,
1821 getDialect(), start, end);
1822 }
1823 }
1824 catch (Exception e) {
1825 throw processException(e);
1826 }
1827 finally {
1828 if (list == null) {
1829 FinderCacheUtil.removeResult(FINDER_PATH_FIND_ALL,
1830 finderArgs);
1831 }
1832 else {
1833 cacheResult(list);
1834
1835 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs,
1836 list);
1837 }
1838
1839 closeSession(session);
1840 }
1841 }
1842
1843 return list;
1844 }
1845
1846
1852 public void removeByGroupId(long groupId) throws SystemException {
1853 for (SCFrameworkVersion scFrameworkVersion : findByGroupId(groupId)) {
1854 remove(scFrameworkVersion);
1855 }
1856 }
1857
1858
1864 public void removeByCompanyId(long companyId) throws SystemException {
1865 for (SCFrameworkVersion scFrameworkVersion : findByCompanyId(companyId)) {
1866 remove(scFrameworkVersion);
1867 }
1868 }
1869
1870
1877 public void removeByG_A(long groupId, boolean active)
1878 throws SystemException {
1879 for (SCFrameworkVersion scFrameworkVersion : findByG_A(groupId, active)) {
1880 remove(scFrameworkVersion);
1881 }
1882 }
1883
1884
1889 public void removeAll() throws SystemException {
1890 for (SCFrameworkVersion scFrameworkVersion : findAll()) {
1891 remove(scFrameworkVersion);
1892 }
1893 }
1894
1895
1902 public int countByGroupId(long groupId) throws SystemException {
1903 Object[] finderArgs = new Object[] { groupId };
1904
1905 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
1906 finderArgs, this);
1907
1908 if (count == null) {
1909 StringBundler query = new StringBundler(2);
1910
1911 query.append(_SQL_COUNT_SCFRAMEWORKVERSION_WHERE);
1912
1913 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1914
1915 String sql = query.toString();
1916
1917 Session session = null;
1918
1919 try {
1920 session = openSession();
1921
1922 Query q = session.createQuery(sql);
1923
1924 QueryPos qPos = QueryPos.getInstance(q);
1925
1926 qPos.add(groupId);
1927
1928 count = (Long)q.uniqueResult();
1929 }
1930 catch (Exception e) {
1931 throw processException(e);
1932 }
1933 finally {
1934 if (count == null) {
1935 count = Long.valueOf(0);
1936 }
1937
1938 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
1939 finderArgs, count);
1940
1941 closeSession(session);
1942 }
1943 }
1944
1945 return count.intValue();
1946 }
1947
1948
1955 public int filterCountByGroupId(long groupId) throws SystemException {
1956 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1957 return countByGroupId(groupId);
1958 }
1959
1960 StringBundler query = new StringBundler(2);
1961
1962 query.append(_FILTER_SQL_COUNT_SCFRAMEWORKVERSION_WHERE);
1963
1964 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1965
1966 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1967 SCFrameworkVersion.class.getName(), _FILTER_COLUMN_PK,
1968 _FILTER_COLUMN_USERID, groupId);
1969
1970 Session session = null;
1971
1972 try {
1973 session = openSession();
1974
1975 SQLQuery q = session.createSQLQuery(sql);
1976
1977 q.addScalar(COUNT_COLUMN_NAME,
1978 com.liferay.portal.kernel.dao.orm.Type.LONG);
1979
1980 QueryPos qPos = QueryPos.getInstance(q);
1981
1982 qPos.add(groupId);
1983
1984 Long count = (Long)q.uniqueResult();
1985
1986 return count.intValue();
1987 }
1988 catch (Exception e) {
1989 throw processException(e);
1990 }
1991 finally {
1992 closeSession(session);
1993 }
1994 }
1995
1996
2003 public int countByCompanyId(long companyId) throws SystemException {
2004 Object[] finderArgs = new Object[] { companyId };
2005
2006 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
2007 finderArgs, this);
2008
2009 if (count == null) {
2010 StringBundler query = new StringBundler(2);
2011
2012 query.append(_SQL_COUNT_SCFRAMEWORKVERSION_WHERE);
2013
2014 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
2015
2016 String sql = query.toString();
2017
2018 Session session = null;
2019
2020 try {
2021 session = openSession();
2022
2023 Query q = session.createQuery(sql);
2024
2025 QueryPos qPos = QueryPos.getInstance(q);
2026
2027 qPos.add(companyId);
2028
2029 count = (Long)q.uniqueResult();
2030 }
2031 catch (Exception e) {
2032 throw processException(e);
2033 }
2034 finally {
2035 if (count == null) {
2036 count = Long.valueOf(0);
2037 }
2038
2039 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
2040 finderArgs, count);
2041
2042 closeSession(session);
2043 }
2044 }
2045
2046 return count.intValue();
2047 }
2048
2049
2057 public int countByG_A(long groupId, boolean active)
2058 throws SystemException {
2059 Object[] finderArgs = new Object[] { groupId, active };
2060
2061 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_A,
2062 finderArgs, this);
2063
2064 if (count == null) {
2065 StringBundler query = new StringBundler(3);
2066
2067 query.append(_SQL_COUNT_SCFRAMEWORKVERSION_WHERE);
2068
2069 query.append(_FINDER_COLUMN_G_A_GROUPID_2);
2070
2071 query.append(_FINDER_COLUMN_G_A_ACTIVE_2);
2072
2073 String sql = query.toString();
2074
2075 Session session = null;
2076
2077 try {
2078 session = openSession();
2079
2080 Query q = session.createQuery(sql);
2081
2082 QueryPos qPos = QueryPos.getInstance(q);
2083
2084 qPos.add(groupId);
2085
2086 qPos.add(active);
2087
2088 count = (Long)q.uniqueResult();
2089 }
2090 catch (Exception e) {
2091 throw processException(e);
2092 }
2093 finally {
2094 if (count == null) {
2095 count = Long.valueOf(0);
2096 }
2097
2098 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_A, finderArgs,
2099 count);
2100
2101 closeSession(session);
2102 }
2103 }
2104
2105 return count.intValue();
2106 }
2107
2108
2116 public int filterCountByG_A(long groupId, boolean active)
2117 throws SystemException {
2118 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2119 return countByG_A(groupId, active);
2120 }
2121
2122 StringBundler query = new StringBundler(3);
2123
2124 query.append(_FILTER_SQL_COUNT_SCFRAMEWORKVERSION_WHERE);
2125
2126 query.append(_FINDER_COLUMN_G_A_GROUPID_2);
2127
2128 query.append(_FINDER_COLUMN_G_A_ACTIVE_2);
2129
2130 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2131 SCFrameworkVersion.class.getName(), _FILTER_COLUMN_PK,
2132 _FILTER_COLUMN_USERID, groupId);
2133
2134 Session session = null;
2135
2136 try {
2137 session = openSession();
2138
2139 SQLQuery q = session.createSQLQuery(sql);
2140
2141 q.addScalar(COUNT_COLUMN_NAME,
2142 com.liferay.portal.kernel.dao.orm.Type.LONG);
2143
2144 QueryPos qPos = QueryPos.getInstance(q);
2145
2146 qPos.add(groupId);
2147
2148 qPos.add(active);
2149
2150 Long count = (Long)q.uniqueResult();
2151
2152 return count.intValue();
2153 }
2154 catch (Exception e) {
2155 throw processException(e);
2156 }
2157 finally {
2158 closeSession(session);
2159 }
2160 }
2161
2162
2168 public int countAll() throws SystemException {
2169 Object[] finderArgs = new Object[0];
2170
2171 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2172 finderArgs, this);
2173
2174 if (count == null) {
2175 Session session = null;
2176
2177 try {
2178 session = openSession();
2179
2180 Query q = session.createQuery(_SQL_COUNT_SCFRAMEWORKVERSION);
2181
2182 count = (Long)q.uniqueResult();
2183 }
2184 catch (Exception e) {
2185 throw processException(e);
2186 }
2187 finally {
2188 if (count == null) {
2189 count = Long.valueOf(0);
2190 }
2191
2192 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
2193 count);
2194
2195 closeSession(session);
2196 }
2197 }
2198
2199 return count.intValue();
2200 }
2201
2202
2209 public List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> getSCProductVersions(
2210 long pk) throws SystemException {
2211 return getSCProductVersions(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
2212 }
2213
2214
2227 public List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> getSCProductVersions(
2228 long pk, int start, int end) throws SystemException {
2229 return getSCProductVersions(pk, start, end, null);
2230 }
2231
2232 public static final FinderPath FINDER_PATH_GET_SCPRODUCTVERSIONS = new FinderPath(com.liferay.portlet.softwarecatalog.model.impl.SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
2233 SCFrameworkVersionModelImpl.FINDER_CACHE_ENABLED_SCFRAMEWORKVERSI_SCPRODUCTVERS,
2234 SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME,
2235 "getSCProductVersions",
2236 new String[] {
2237 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
2238 "com.liferay.portal.kernel.util.OrderByComparator"
2239 });
2240
2241
2255 public List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> getSCProductVersions(
2256 long pk, int start, int end, OrderByComparator orderByComparator)
2257 throws SystemException {
2258 Object[] finderArgs = new Object[] {
2259 pk, String.valueOf(start), String.valueOf(end),
2260 String.valueOf(orderByComparator)
2261 };
2262
2263 List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> list = (List<com.liferay.portlet.softwarecatalog.model.SCProductVersion>)FinderCacheUtil.getResult(FINDER_PATH_GET_SCPRODUCTVERSIONS,
2264 finderArgs, this);
2265
2266 if (list == null) {
2267 Session session = null;
2268
2269 try {
2270 session = openSession();
2271
2272 String sql = null;
2273
2274 if (orderByComparator != null) {
2275 sql = _SQL_GETSCPRODUCTVERSIONS.concat(ORDER_BY_CLAUSE)
2276 .concat(orderByComparator.getOrderBy());
2277 }
2278 else {
2279 sql = _SQL_GETSCPRODUCTVERSIONS.concat(com.liferay.portlet.softwarecatalog.model.impl.SCProductVersionModelImpl.ORDER_BY_SQL);
2280 }
2281
2282 SQLQuery q = session.createSQLQuery(sql);
2283
2284 q.addEntity("SCProductVersion",
2285 com.liferay.portlet.softwarecatalog.model.impl.SCProductVersionImpl.class);
2286
2287 QueryPos qPos = QueryPos.getInstance(q);
2288
2289 qPos.add(pk);
2290
2291 list = (List<com.liferay.portlet.softwarecatalog.model.SCProductVersion>)QueryUtil.list(q,
2292 getDialect(), start, end);
2293 }
2294 catch (Exception e) {
2295 throw processException(e);
2296 }
2297 finally {
2298 if (list == null) {
2299 FinderCacheUtil.removeResult(FINDER_PATH_GET_SCPRODUCTVERSIONS,
2300 finderArgs);
2301 }
2302 else {
2303 scProductVersionPersistence.cacheResult(list);
2304
2305 FinderCacheUtil.putResult(FINDER_PATH_GET_SCPRODUCTVERSIONS,
2306 finderArgs, list);
2307 }
2308
2309 closeSession(session);
2310 }
2311 }
2312
2313 return list;
2314 }
2315
2316 public static final FinderPath FINDER_PATH_GET_SCPRODUCTVERSIONS_SIZE = new FinderPath(com.liferay.portlet.softwarecatalog.model.impl.SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
2317 SCFrameworkVersionModelImpl.FINDER_CACHE_ENABLED_SCFRAMEWORKVERSI_SCPRODUCTVERS,
2318 SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME,
2319 "getSCProductVersionsSize", new String[] { Long.class.getName() });
2320
2321
2328 public int getSCProductVersionsSize(long pk) throws SystemException {
2329 Object[] finderArgs = new Object[] { pk };
2330
2331 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_SCPRODUCTVERSIONS_SIZE,
2332 finderArgs, this);
2333
2334 if (count == null) {
2335 Session session = null;
2336
2337 try {
2338 session = openSession();
2339
2340 SQLQuery q = session.createSQLQuery(_SQL_GETSCPRODUCTVERSIONSSIZE);
2341
2342 q.addScalar(COUNT_COLUMN_NAME,
2343 com.liferay.portal.kernel.dao.orm.Type.LONG);
2344
2345 QueryPos qPos = QueryPos.getInstance(q);
2346
2347 qPos.add(pk);
2348
2349 count = (Long)q.uniqueResult();
2350 }
2351 catch (Exception e) {
2352 throw processException(e);
2353 }
2354 finally {
2355 if (count == null) {
2356 count = Long.valueOf(0);
2357 }
2358
2359 FinderCacheUtil.putResult(FINDER_PATH_GET_SCPRODUCTVERSIONS_SIZE,
2360 finderArgs, count);
2361
2362 closeSession(session);
2363 }
2364 }
2365
2366 return count.intValue();
2367 }
2368
2369 public static final FinderPath FINDER_PATH_CONTAINS_SCPRODUCTVERSION = new FinderPath(com.liferay.portlet.softwarecatalog.model.impl.SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
2370 SCFrameworkVersionModelImpl.FINDER_CACHE_ENABLED_SCFRAMEWORKVERSI_SCPRODUCTVERS,
2371 SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME,
2372 "containsSCProductVersion",
2373 new String[] { Long.class.getName(), Long.class.getName() });
2374
2375
2383 public boolean containsSCProductVersion(long pk, long scProductVersionPK)
2384 throws SystemException {
2385 Object[] finderArgs = new Object[] { pk, scProductVersionPK };
2386
2387 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_SCPRODUCTVERSION,
2388 finderArgs, this);
2389
2390 if (value == null) {
2391 try {
2392 value = Boolean.valueOf(containsSCProductVersion.contains(pk,
2393 scProductVersionPK));
2394 }
2395 catch (Exception e) {
2396 throw processException(e);
2397 }
2398 finally {
2399 if (value == null) {
2400 value = Boolean.FALSE;
2401 }
2402
2403 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_SCPRODUCTVERSION,
2404 finderArgs, value);
2405 }
2406 }
2407
2408 return value.booleanValue();
2409 }
2410
2411
2418 public boolean containsSCProductVersions(long pk) throws SystemException {
2419 if (getSCProductVersionsSize(pk) > 0) {
2420 return true;
2421 }
2422 else {
2423 return false;
2424 }
2425 }
2426
2427
2434 public void addSCProductVersion(long pk, long scProductVersionPK)
2435 throws SystemException {
2436 try {
2437 addSCProductVersion.add(pk, scProductVersionPK);
2438 }
2439 catch (Exception e) {
2440 throw processException(e);
2441 }
2442 finally {
2443 FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
2444 }
2445 }
2446
2447
2454 public void addSCProductVersion(long pk,
2455 com.liferay.portlet.softwarecatalog.model.SCProductVersion scProductVersion)
2456 throws SystemException {
2457 try {
2458 addSCProductVersion.add(pk, scProductVersion.getPrimaryKey());
2459 }
2460 catch (Exception e) {
2461 throw processException(e);
2462 }
2463 finally {
2464 FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
2465 }
2466 }
2467
2468
2475 public void addSCProductVersions(long pk, long[] scProductVersionPKs)
2476 throws SystemException {
2477 try {
2478 for (long scProductVersionPK : scProductVersionPKs) {
2479 addSCProductVersion.add(pk, scProductVersionPK);
2480 }
2481 }
2482 catch (Exception e) {
2483 throw processException(e);
2484 }
2485 finally {
2486 FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
2487 }
2488 }
2489
2490
2497 public void addSCProductVersions(long pk,
2498 List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> scProductVersions)
2499 throws SystemException {
2500 try {
2501 for (com.liferay.portlet.softwarecatalog.model.SCProductVersion scProductVersion : scProductVersions) {
2502 addSCProductVersion.add(pk, scProductVersion.getPrimaryKey());
2503 }
2504 }
2505 catch (Exception e) {
2506 throw processException(e);
2507 }
2508 finally {
2509 FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
2510 }
2511 }
2512
2513
2519 public void clearSCProductVersions(long pk) throws SystemException {
2520 try {
2521 clearSCProductVersions.clear(pk);
2522 }
2523 catch (Exception e) {
2524 throw processException(e);
2525 }
2526 finally {
2527 FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
2528 }
2529 }
2530
2531
2538 public void removeSCProductVersion(long pk, long scProductVersionPK)
2539 throws SystemException {
2540 try {
2541 removeSCProductVersion.remove(pk, scProductVersionPK);
2542 }
2543 catch (Exception e) {
2544 throw processException(e);
2545 }
2546 finally {
2547 FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
2548 }
2549 }
2550
2551
2558 public void removeSCProductVersion(long pk,
2559 com.liferay.portlet.softwarecatalog.model.SCProductVersion scProductVersion)
2560 throws SystemException {
2561 try {
2562 removeSCProductVersion.remove(pk, scProductVersion.getPrimaryKey());
2563 }
2564 catch (Exception e) {
2565 throw processException(e);
2566 }
2567 finally {
2568 FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
2569 }
2570 }
2571
2572
2579 public void removeSCProductVersions(long pk, long[] scProductVersionPKs)
2580 throws SystemException {
2581 try {
2582 for (long scProductVersionPK : scProductVersionPKs) {
2583 removeSCProductVersion.remove(pk, scProductVersionPK);
2584 }
2585 }
2586 catch (Exception e) {
2587 throw processException(e);
2588 }
2589 finally {
2590 FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
2591 }
2592 }
2593
2594
2601 public void removeSCProductVersions(long pk,
2602 List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> scProductVersions)
2603 throws SystemException {
2604 try {
2605 for (com.liferay.portlet.softwarecatalog.model.SCProductVersion scProductVersion : scProductVersions) {
2606 removeSCProductVersion.remove(pk,
2607 scProductVersion.getPrimaryKey());
2608 }
2609 }
2610 catch (Exception e) {
2611 throw processException(e);
2612 }
2613 finally {
2614 FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
2615 }
2616 }
2617
2618
2625 public void setSCProductVersions(long pk, long[] scProductVersionPKs)
2626 throws SystemException {
2627 try {
2628 Set<Long> scProductVersionPKSet = SetUtil.fromArray(scProductVersionPKs);
2629
2630 List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> scProductVersions =
2631 getSCProductVersions(pk);
2632
2633 for (com.liferay.portlet.softwarecatalog.model.SCProductVersion scProductVersion : scProductVersions) {
2634 if (!scProductVersionPKSet.remove(
2635 scProductVersion.getPrimaryKey())) {
2636 removeSCProductVersion.remove(pk,
2637 scProductVersion.getPrimaryKey());
2638 }
2639 }
2640
2641 for (Long scProductVersionPK : scProductVersionPKSet) {
2642 addSCProductVersion.add(pk, scProductVersionPK);
2643 }
2644 }
2645 catch (Exception e) {
2646 throw processException(e);
2647 }
2648 finally {
2649 FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
2650 }
2651 }
2652
2653
2660 public void setSCProductVersions(long pk,
2661 List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> scProductVersions)
2662 throws SystemException {
2663 try {
2664 long[] scProductVersionPKs = new long[scProductVersions.size()];
2665
2666 for (int i = 0; i < scProductVersions.size(); i++) {
2667 com.liferay.portlet.softwarecatalog.model.SCProductVersion scProductVersion =
2668 scProductVersions.get(i);
2669
2670 scProductVersionPKs[i] = scProductVersion.getPrimaryKey();
2671 }
2672
2673 setSCProductVersions(pk, scProductVersionPKs);
2674 }
2675 catch (Exception e) {
2676 throw processException(e);
2677 }
2678 finally {
2679 FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
2680 }
2681 }
2682
2683
2686 public void afterPropertiesSet() {
2687 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2688 com.liferay.portal.util.PropsUtil.get(
2689 "value.object.listener.com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion")));
2690
2691 if (listenerClassNames.length > 0) {
2692 try {
2693 List<ModelListener<SCFrameworkVersion>> listenersList = new ArrayList<ModelListener<SCFrameworkVersion>>();
2694
2695 for (String listenerClassName : listenerClassNames) {
2696 listenersList.add((ModelListener<SCFrameworkVersion>)InstanceFactory.newInstance(
2697 listenerClassName));
2698 }
2699
2700 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2701 }
2702 catch (Exception e) {
2703 _log.error(e);
2704 }
2705 }
2706
2707 containsSCProductVersion = new ContainsSCProductVersion(this);
2708
2709 addSCProductVersion = new AddSCProductVersion(this);
2710 clearSCProductVersions = new ClearSCProductVersions(this);
2711 removeSCProductVersion = new RemoveSCProductVersion(this);
2712 }
2713
2714 public void destroy() {
2715 EntityCacheUtil.removeCache(SCFrameworkVersionImpl.class.getName());
2716 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
2717 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST);
2718 }
2719
2720 @BeanReference(type = SCLicensePersistence.class)
2721 protected SCLicensePersistence scLicensePersistence;
2722 @BeanReference(type = SCFrameworkVersionPersistence.class)
2723 protected SCFrameworkVersionPersistence scFrameworkVersionPersistence;
2724 @BeanReference(type = SCProductEntryPersistence.class)
2725 protected SCProductEntryPersistence scProductEntryPersistence;
2726 @BeanReference(type = SCProductScreenshotPersistence.class)
2727 protected SCProductScreenshotPersistence scProductScreenshotPersistence;
2728 @BeanReference(type = SCProductVersionPersistence.class)
2729 protected SCProductVersionPersistence scProductVersionPersistence;
2730 @BeanReference(type = ResourcePersistence.class)
2731 protected ResourcePersistence resourcePersistence;
2732 @BeanReference(type = UserPersistence.class)
2733 protected UserPersistence userPersistence;
2734 protected ContainsSCProductVersion containsSCProductVersion;
2735 protected AddSCProductVersion addSCProductVersion;
2736 protected ClearSCProductVersions clearSCProductVersions;
2737 protected RemoveSCProductVersion removeSCProductVersion;
2738
2739 protected class ContainsSCProductVersion {
2740 protected ContainsSCProductVersion(
2741 SCFrameworkVersionPersistenceImpl persistenceImpl) {
2742 super();
2743
2744 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
2745 _SQL_CONTAINSSCPRODUCTVERSION,
2746 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
2747 RowMapper.COUNT);
2748 }
2749
2750 protected boolean contains(long frameworkVersionId,
2751 long productVersionId) {
2752 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
2753 new Long(frameworkVersionId), new Long(productVersionId)
2754 });
2755
2756 if (results.size() > 0) {
2757 Integer count = results.get(0);
2758
2759 if (count.intValue() > 0) {
2760 return true;
2761 }
2762 }
2763
2764 return false;
2765 }
2766
2767 private MappingSqlQuery<Integer> _mappingSqlQuery;
2768 }
2769
2770 protected class AddSCProductVersion {
2771 protected AddSCProductVersion(
2772 SCFrameworkVersionPersistenceImpl persistenceImpl) {
2773 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2774 "INSERT INTO SCFrameworkVersi_SCProductVers (frameworkVersionId, productVersionId) VALUES (?, ?)",
2775 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
2776 _persistenceImpl = persistenceImpl;
2777 }
2778
2779 protected void add(long frameworkVersionId, long productVersionId)
2780 throws SystemException {
2781 if (!_persistenceImpl.containsSCProductVersion.contains(
2782 frameworkVersionId, productVersionId)) {
2783 ModelListener<com.liferay.portlet.softwarecatalog.model.SCProductVersion>[] scProductVersionListeners =
2784 scProductVersionPersistence.getListeners();
2785
2786 for (ModelListener<SCFrameworkVersion> listener : listeners) {
2787 listener.onBeforeAddAssociation(frameworkVersionId,
2788 com.liferay.portlet.softwarecatalog.model.SCProductVersion.class.getName(),
2789 productVersionId);
2790 }
2791
2792 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCProductVersion> listener : scProductVersionListeners) {
2793 listener.onBeforeAddAssociation(productVersionId,
2794 SCFrameworkVersion.class.getName(), frameworkVersionId);
2795 }
2796
2797 _sqlUpdate.update(new Object[] {
2798 new Long(frameworkVersionId), new Long(productVersionId)
2799 });
2800
2801 for (ModelListener<SCFrameworkVersion> listener : listeners) {
2802 listener.onAfterAddAssociation(frameworkVersionId,
2803 com.liferay.portlet.softwarecatalog.model.SCProductVersion.class.getName(),
2804 productVersionId);
2805 }
2806
2807 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCProductVersion> listener : scProductVersionListeners) {
2808 listener.onAfterAddAssociation(productVersionId,
2809 SCFrameworkVersion.class.getName(), frameworkVersionId);
2810 }
2811 }
2812 }
2813
2814 private SqlUpdate _sqlUpdate;
2815 private SCFrameworkVersionPersistenceImpl _persistenceImpl;
2816 }
2817
2818 protected class ClearSCProductVersions {
2819 protected ClearSCProductVersions(
2820 SCFrameworkVersionPersistenceImpl persistenceImpl) {
2821 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2822 "DELETE FROM SCFrameworkVersi_SCProductVers WHERE frameworkVersionId = ?",
2823 new int[] { java.sql.Types.BIGINT });
2824 }
2825
2826 protected void clear(long frameworkVersionId) throws SystemException {
2827 ModelListener<com.liferay.portlet.softwarecatalog.model.SCProductVersion>[] scProductVersionListeners =
2828 scProductVersionPersistence.getListeners();
2829
2830 List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> scProductVersions =
2831 null;
2832
2833 if ((listeners.length > 0) ||
2834 (scProductVersionListeners.length > 0)) {
2835 scProductVersions = getSCProductVersions(frameworkVersionId);
2836
2837 for (com.liferay.portlet.softwarecatalog.model.SCProductVersion scProductVersion : scProductVersions) {
2838 for (ModelListener<SCFrameworkVersion> listener : listeners) {
2839 listener.onBeforeRemoveAssociation(frameworkVersionId,
2840 com.liferay.portlet.softwarecatalog.model.SCProductVersion.class.getName(),
2841 scProductVersion.getPrimaryKey());
2842 }
2843
2844 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCProductVersion> listener : scProductVersionListeners) {
2845 listener.onBeforeRemoveAssociation(scProductVersion.getPrimaryKey(),
2846 SCFrameworkVersion.class.getName(),
2847 frameworkVersionId);
2848 }
2849 }
2850 }
2851
2852 _sqlUpdate.update(new Object[] { new Long(frameworkVersionId) });
2853
2854 if ((listeners.length > 0) ||
2855 (scProductVersionListeners.length > 0)) {
2856 for (com.liferay.portlet.softwarecatalog.model.SCProductVersion scProductVersion : scProductVersions) {
2857 for (ModelListener<SCFrameworkVersion> listener : listeners) {
2858 listener.onAfterRemoveAssociation(frameworkVersionId,
2859 com.liferay.portlet.softwarecatalog.model.SCProductVersion.class.getName(),
2860 scProductVersion.getPrimaryKey());
2861 }
2862
2863 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCProductVersion> listener : scProductVersionListeners) {
2864 listener.onAfterRemoveAssociation(scProductVersion.getPrimaryKey(),
2865 SCFrameworkVersion.class.getName(),
2866 frameworkVersionId);
2867 }
2868 }
2869 }
2870 }
2871
2872 private SqlUpdate _sqlUpdate;
2873 }
2874
2875 protected class RemoveSCProductVersion {
2876 protected RemoveSCProductVersion(
2877 SCFrameworkVersionPersistenceImpl persistenceImpl) {
2878 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2879 "DELETE FROM SCFrameworkVersi_SCProductVers WHERE frameworkVersionId = ? AND productVersionId = ?",
2880 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
2881 _persistenceImpl = persistenceImpl;
2882 }
2883
2884 protected void remove(long frameworkVersionId, long productVersionId)
2885 throws SystemException {
2886 if (_persistenceImpl.containsSCProductVersion.contains(
2887 frameworkVersionId, productVersionId)) {
2888 ModelListener<com.liferay.portlet.softwarecatalog.model.SCProductVersion>[] scProductVersionListeners =
2889 scProductVersionPersistence.getListeners();
2890
2891 for (ModelListener<SCFrameworkVersion> listener : listeners) {
2892 listener.onBeforeRemoveAssociation(frameworkVersionId,
2893 com.liferay.portlet.softwarecatalog.model.SCProductVersion.class.getName(),
2894 productVersionId);
2895 }
2896
2897 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCProductVersion> listener : scProductVersionListeners) {
2898 listener.onBeforeRemoveAssociation(productVersionId,
2899 SCFrameworkVersion.class.getName(), frameworkVersionId);
2900 }
2901
2902 _sqlUpdate.update(new Object[] {
2903 new Long(frameworkVersionId), new Long(productVersionId)
2904 });
2905
2906 for (ModelListener<SCFrameworkVersion> listener : listeners) {
2907 listener.onAfterRemoveAssociation(frameworkVersionId,
2908 com.liferay.portlet.softwarecatalog.model.SCProductVersion.class.getName(),
2909 productVersionId);
2910 }
2911
2912 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCProductVersion> listener : scProductVersionListeners) {
2913 listener.onAfterRemoveAssociation(productVersionId,
2914 SCFrameworkVersion.class.getName(), frameworkVersionId);
2915 }
2916 }
2917 }
2918
2919 private SqlUpdate _sqlUpdate;
2920 private SCFrameworkVersionPersistenceImpl _persistenceImpl;
2921 }
2922
2923 private static final String _SQL_SELECT_SCFRAMEWORKVERSION = "SELECT scFrameworkVersion FROM SCFrameworkVersion scFrameworkVersion";
2924 private static final String _SQL_SELECT_SCFRAMEWORKVERSION_WHERE = "SELECT scFrameworkVersion FROM SCFrameworkVersion scFrameworkVersion WHERE ";
2925 private static final String _SQL_COUNT_SCFRAMEWORKVERSION = "SELECT COUNT(scFrameworkVersion) FROM SCFrameworkVersion scFrameworkVersion";
2926 private static final String _SQL_COUNT_SCFRAMEWORKVERSION_WHERE = "SELECT COUNT(scFrameworkVersion) FROM SCFrameworkVersion scFrameworkVersion WHERE ";
2927 private static final String _SQL_GETSCPRODUCTVERSIONS = "SELECT {SCProductVersion.*} FROM SCProductVersion INNER JOIN SCFrameworkVersi_SCProductVers ON (SCFrameworkVersi_SCProductVers.productVersionId = SCProductVersion.productVersionId) WHERE (SCFrameworkVersi_SCProductVers.frameworkVersionId = ?)";
2928 private static final String _SQL_GETSCPRODUCTVERSIONSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM SCFrameworkVersi_SCProductVers WHERE frameworkVersionId = ?";
2929 private static final String _SQL_CONTAINSSCPRODUCTVERSION = "SELECT COUNT(*) AS COUNT_VALUE FROM SCFrameworkVersi_SCProductVers WHERE frameworkVersionId = ? AND productVersionId = ?";
2930 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "scFrameworkVersion.groupId = ?";
2931 private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "scFrameworkVersion.companyId = ?";
2932 private static final String _FINDER_COLUMN_G_A_GROUPID_2 = "scFrameworkVersion.groupId = ? AND ";
2933 private static final String _FINDER_COLUMN_G_A_ACTIVE_2 = "scFrameworkVersion.active = ?";
2934 private static final String _FILTER_SQL_SELECT_SCFRAMEWORKVERSION_WHERE = "SELECT DISTINCT {scFrameworkVersion.*} FROM SCFrameworkVersion scFrameworkVersion WHERE ";
2935 private static final String _FILTER_SQL_SELECT_SCFRAMEWORKVERSION_NO_INLINE_DISTINCT_WHERE_1 =
2936 "SELECT {SCFrameworkVersion.*} FROM (SELECT DISTINCT scFrameworkVersion.frameworkVersionId FROM SCFrameworkVersion scFrameworkVersion WHERE ";
2937 private static final String _FILTER_SQL_SELECT_SCFRAMEWORKVERSION_NO_INLINE_DISTINCT_WHERE_2 =
2938 ") TEMP_TABLE INNER JOIN SCFrameworkVersion ON TEMP_TABLE.frameworkVersionId = SCFrameworkVersion.frameworkVersionId";
2939 private static final String _FILTER_SQL_COUNT_SCFRAMEWORKVERSION_WHERE = "SELECT COUNT(DISTINCT scFrameworkVersion.frameworkVersionId) AS COUNT_VALUE FROM SCFrameworkVersion scFrameworkVersion WHERE ";
2940 private static final String _FILTER_COLUMN_PK = "scFrameworkVersion.frameworkVersionId";
2941 private static final String _FILTER_COLUMN_USERID = "scFrameworkVersion.userId";
2942 private static final String _FILTER_ENTITY_ALIAS = "scFrameworkVersion";
2943 private static final String _FILTER_ENTITY_TABLE = "SCFrameworkVersion";
2944 private static final String _ORDER_BY_ENTITY_ALIAS = "scFrameworkVersion.";
2945 private static final String _ORDER_BY_ENTITY_TABLE = "SCFrameworkVersion.";
2946 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No SCFrameworkVersion exists with the primary key ";
2947 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No SCFrameworkVersion exists with the key {";
2948 private static Log _log = LogFactoryUtil.getLog(SCFrameworkVersionPersistenceImpl.class);
2949 }