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 Session session = null;
487
488 try {
489 session = openSession();
490
491 StringBundler query = null;
492
493 if (orderByComparator != null) {
494 query = new StringBundler(3 +
495 (orderByComparator.getOrderByFields().length * 3));
496 }
497 else {
498 query = new StringBundler(3);
499 }
500
501 query.append(_SQL_SELECT_SCFRAMEWORKVERSION_WHERE);
502
503 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
504
505 if (orderByComparator != null) {
506 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
507 orderByComparator);
508 }
509
510 else {
511 query.append(SCFrameworkVersionModelImpl.ORDER_BY_JPQL);
512 }
513
514 String sql = query.toString();
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 list = new ArrayList<SCFrameworkVersion>();
531 }
532
533 cacheResult(list);
534
535 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
536 finderArgs, list);
537
538 closeSession(session);
539 }
540 }
541
542 return list;
543 }
544
545
558 public SCFrameworkVersion findByGroupId_First(long groupId,
559 OrderByComparator orderByComparator)
560 throws NoSuchFrameworkVersionException, SystemException {
561 List<SCFrameworkVersion> list = findByGroupId(groupId, 0, 1,
562 orderByComparator);
563
564 if (list.isEmpty()) {
565 StringBundler msg = new StringBundler(4);
566
567 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
568
569 msg.append("groupId=");
570 msg.append(groupId);
571
572 msg.append(StringPool.CLOSE_CURLY_BRACE);
573
574 throw new NoSuchFrameworkVersionException(msg.toString());
575 }
576 else {
577 return list.get(0);
578 }
579 }
580
581
594 public SCFrameworkVersion findByGroupId_Last(long groupId,
595 OrderByComparator orderByComparator)
596 throws NoSuchFrameworkVersionException, SystemException {
597 int count = countByGroupId(groupId);
598
599 List<SCFrameworkVersion> list = findByGroupId(groupId, count - 1,
600 count, orderByComparator);
601
602 if (list.isEmpty()) {
603 StringBundler msg = new StringBundler(4);
604
605 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
606
607 msg.append("groupId=");
608 msg.append(groupId);
609
610 msg.append(StringPool.CLOSE_CURLY_BRACE);
611
612 throw new NoSuchFrameworkVersionException(msg.toString());
613 }
614 else {
615 return list.get(0);
616 }
617 }
618
619
633 public SCFrameworkVersion[] findByGroupId_PrevAndNext(
634 long frameworkVersionId, long groupId,
635 OrderByComparator orderByComparator)
636 throws NoSuchFrameworkVersionException, SystemException {
637 SCFrameworkVersion scFrameworkVersion = findByPrimaryKey(frameworkVersionId);
638
639 Session session = null;
640
641 try {
642 session = openSession();
643
644 SCFrameworkVersion[] array = new SCFrameworkVersionImpl[3];
645
646 array[0] = getByGroupId_PrevAndNext(session, scFrameworkVersion,
647 groupId, orderByComparator, true);
648
649 array[1] = scFrameworkVersion;
650
651 array[2] = getByGroupId_PrevAndNext(session, scFrameworkVersion,
652 groupId, orderByComparator, false);
653
654 return array;
655 }
656 catch (Exception e) {
657 throw processException(e);
658 }
659 finally {
660 closeSession(session);
661 }
662 }
663
664 protected SCFrameworkVersion getByGroupId_PrevAndNext(Session session,
665 SCFrameworkVersion scFrameworkVersion, long groupId,
666 OrderByComparator orderByComparator, boolean previous) {
667 StringBundler query = null;
668
669 if (orderByComparator != null) {
670 query = new StringBundler(6 +
671 (orderByComparator.getOrderByFields().length * 6));
672 }
673 else {
674 query = new StringBundler(3);
675 }
676
677 query.append(_SQL_SELECT_SCFRAMEWORKVERSION_WHERE);
678
679 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
680
681 if (orderByComparator != null) {
682 String[] orderByFields = orderByComparator.getOrderByFields();
683
684 if (orderByFields.length > 0) {
685 query.append(WHERE_AND);
686 }
687
688 for (int i = 0; i < orderByFields.length; i++) {
689 query.append(_ORDER_BY_ENTITY_ALIAS);
690 query.append(orderByFields[i]);
691
692 if ((i + 1) < orderByFields.length) {
693 if (orderByComparator.isAscending() ^ previous) {
694 query.append(WHERE_GREATER_THAN_HAS_NEXT);
695 }
696 else {
697 query.append(WHERE_LESSER_THAN_HAS_NEXT);
698 }
699 }
700 else {
701 if (orderByComparator.isAscending() ^ previous) {
702 query.append(WHERE_GREATER_THAN);
703 }
704 else {
705 query.append(WHERE_LESSER_THAN);
706 }
707 }
708 }
709
710 query.append(ORDER_BY_CLAUSE);
711
712 for (int i = 0; i < orderByFields.length; i++) {
713 query.append(_ORDER_BY_ENTITY_ALIAS);
714 query.append(orderByFields[i]);
715
716 if ((i + 1) < orderByFields.length) {
717 if (orderByComparator.isAscending() ^ previous) {
718 query.append(ORDER_BY_ASC_HAS_NEXT);
719 }
720 else {
721 query.append(ORDER_BY_DESC_HAS_NEXT);
722 }
723 }
724 else {
725 if (orderByComparator.isAscending() ^ previous) {
726 query.append(ORDER_BY_ASC);
727 }
728 else {
729 query.append(ORDER_BY_DESC);
730 }
731 }
732 }
733 }
734
735 else {
736 query.append(SCFrameworkVersionModelImpl.ORDER_BY_JPQL);
737 }
738
739 String sql = query.toString();
740
741 Query q = session.createQuery(sql);
742
743 q.setFirstResult(0);
744 q.setMaxResults(2);
745
746 QueryPos qPos = QueryPos.getInstance(q);
747
748 qPos.add(groupId);
749
750 if (orderByComparator != null) {
751 Object[] values = orderByComparator.getOrderByValues(scFrameworkVersion);
752
753 for (Object value : values) {
754 qPos.add(value);
755 }
756 }
757
758 List<SCFrameworkVersion> list = q.list();
759
760 if (list.size() == 2) {
761 return list.get(1);
762 }
763 else {
764 return null;
765 }
766 }
767
768
775 public List<SCFrameworkVersion> filterFindByGroupId(long groupId)
776 throws SystemException {
777 return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
778 QueryUtil.ALL_POS, null);
779 }
780
781
794 public List<SCFrameworkVersion> filterFindByGroupId(long groupId,
795 int start, int end) throws SystemException {
796 return filterFindByGroupId(groupId, start, end, null);
797 }
798
799
813 public List<SCFrameworkVersion> filterFindByGroupId(long groupId,
814 int start, int end, OrderByComparator orderByComparator)
815 throws SystemException {
816 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
817 return findByGroupId(groupId, start, end, orderByComparator);
818 }
819
820 Session session = null;
821
822 try {
823 session = openSession();
824
825 StringBundler query = null;
826
827 if (orderByComparator != null) {
828 query = new StringBundler(3 +
829 (orderByComparator.getOrderByFields().length * 3));
830 }
831 else {
832 query = new StringBundler(3);
833 }
834
835 if (getDB().isSupportsInlineDistinct()) {
836 query.append(_FILTER_SQL_SELECT_SCFRAMEWORKVERSION_WHERE);
837 }
838 else {
839 query.append(_FILTER_SQL_SELECT_SCFRAMEWORKVERSION_NO_INLINE_DISTINCT_WHERE);
840 }
841
842 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
843
844 if (orderByComparator != null) {
845 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
846 orderByComparator);
847 }
848
849 else {
850 query.append(SCFrameworkVersionModelImpl.ORDER_BY_JPQL);
851 }
852
853 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
854 SCFrameworkVersion.class.getName(), _FILTER_COLUMN_PK,
855 _FILTER_COLUMN_USERID, groupId);
856
857 SQLQuery q = session.createSQLQuery(sql);
858
859 q.addEntity(_FILTER_ENTITY_ALIAS, SCFrameworkVersionImpl.class);
860
861 QueryPos qPos = QueryPos.getInstance(q);
862
863 qPos.add(groupId);
864
865 return (List<SCFrameworkVersion>)QueryUtil.list(q, getDialect(),
866 start, end);
867 }
868 catch (Exception e) {
869 throw processException(e);
870 }
871 finally {
872 closeSession(session);
873 }
874 }
875
876
883 public List<SCFrameworkVersion> findByCompanyId(long companyId)
884 throws SystemException {
885 return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
886 null);
887 }
888
889
902 public List<SCFrameworkVersion> findByCompanyId(long companyId, int start,
903 int end) throws SystemException {
904 return findByCompanyId(companyId, start, end, null);
905 }
906
907
921 public List<SCFrameworkVersion> findByCompanyId(long companyId, int start,
922 int end, OrderByComparator orderByComparator) throws SystemException {
923 Object[] finderArgs = new Object[] {
924 companyId,
925
926 String.valueOf(start), String.valueOf(end),
927 String.valueOf(orderByComparator)
928 };
929
930 List<SCFrameworkVersion> list = (List<SCFrameworkVersion>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_COMPANYID,
931 finderArgs, this);
932
933 if (list == null) {
934 Session session = null;
935
936 try {
937 session = openSession();
938
939 StringBundler query = null;
940
941 if (orderByComparator != null) {
942 query = new StringBundler(3 +
943 (orderByComparator.getOrderByFields().length * 3));
944 }
945 else {
946 query = new StringBundler(3);
947 }
948
949 query.append(_SQL_SELECT_SCFRAMEWORKVERSION_WHERE);
950
951 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
952
953 if (orderByComparator != null) {
954 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
955 orderByComparator);
956 }
957
958 else {
959 query.append(SCFrameworkVersionModelImpl.ORDER_BY_JPQL);
960 }
961
962 String sql = query.toString();
963
964 Query q = session.createQuery(sql);
965
966 QueryPos qPos = QueryPos.getInstance(q);
967
968 qPos.add(companyId);
969
970 list = (List<SCFrameworkVersion>)QueryUtil.list(q,
971 getDialect(), start, end);
972 }
973 catch (Exception e) {
974 throw processException(e);
975 }
976 finally {
977 if (list == null) {
978 list = new ArrayList<SCFrameworkVersion>();
979 }
980
981 cacheResult(list);
982
983 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_COMPANYID,
984 finderArgs, list);
985
986 closeSession(session);
987 }
988 }
989
990 return list;
991 }
992
993
1006 public SCFrameworkVersion findByCompanyId_First(long companyId,
1007 OrderByComparator orderByComparator)
1008 throws NoSuchFrameworkVersionException, SystemException {
1009 List<SCFrameworkVersion> list = findByCompanyId(companyId, 0, 1,
1010 orderByComparator);
1011
1012 if (list.isEmpty()) {
1013 StringBundler msg = new StringBundler(4);
1014
1015 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1016
1017 msg.append("companyId=");
1018 msg.append(companyId);
1019
1020 msg.append(StringPool.CLOSE_CURLY_BRACE);
1021
1022 throw new NoSuchFrameworkVersionException(msg.toString());
1023 }
1024 else {
1025 return list.get(0);
1026 }
1027 }
1028
1029
1042 public SCFrameworkVersion findByCompanyId_Last(long companyId,
1043 OrderByComparator orderByComparator)
1044 throws NoSuchFrameworkVersionException, SystemException {
1045 int count = countByCompanyId(companyId);
1046
1047 List<SCFrameworkVersion> list = findByCompanyId(companyId, count - 1,
1048 count, orderByComparator);
1049
1050 if (list.isEmpty()) {
1051 StringBundler msg = new StringBundler(4);
1052
1053 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1054
1055 msg.append("companyId=");
1056 msg.append(companyId);
1057
1058 msg.append(StringPool.CLOSE_CURLY_BRACE);
1059
1060 throw new NoSuchFrameworkVersionException(msg.toString());
1061 }
1062 else {
1063 return list.get(0);
1064 }
1065 }
1066
1067
1081 public SCFrameworkVersion[] findByCompanyId_PrevAndNext(
1082 long frameworkVersionId, long companyId,
1083 OrderByComparator orderByComparator)
1084 throws NoSuchFrameworkVersionException, SystemException {
1085 SCFrameworkVersion scFrameworkVersion = findByPrimaryKey(frameworkVersionId);
1086
1087 Session session = null;
1088
1089 try {
1090 session = openSession();
1091
1092 SCFrameworkVersion[] array = new SCFrameworkVersionImpl[3];
1093
1094 array[0] = getByCompanyId_PrevAndNext(session, scFrameworkVersion,
1095 companyId, orderByComparator, true);
1096
1097 array[1] = scFrameworkVersion;
1098
1099 array[2] = getByCompanyId_PrevAndNext(session, scFrameworkVersion,
1100 companyId, orderByComparator, false);
1101
1102 return array;
1103 }
1104 catch (Exception e) {
1105 throw processException(e);
1106 }
1107 finally {
1108 closeSession(session);
1109 }
1110 }
1111
1112 protected SCFrameworkVersion getByCompanyId_PrevAndNext(Session session,
1113 SCFrameworkVersion scFrameworkVersion, long companyId,
1114 OrderByComparator orderByComparator, boolean previous) {
1115 StringBundler query = null;
1116
1117 if (orderByComparator != null) {
1118 query = new StringBundler(6 +
1119 (orderByComparator.getOrderByFields().length * 6));
1120 }
1121 else {
1122 query = new StringBundler(3);
1123 }
1124
1125 query.append(_SQL_SELECT_SCFRAMEWORKVERSION_WHERE);
1126
1127 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1128
1129 if (orderByComparator != null) {
1130 String[] orderByFields = orderByComparator.getOrderByFields();
1131
1132 if (orderByFields.length > 0) {
1133 query.append(WHERE_AND);
1134 }
1135
1136 for (int i = 0; i < orderByFields.length; i++) {
1137 query.append(_ORDER_BY_ENTITY_ALIAS);
1138 query.append(orderByFields[i]);
1139
1140 if ((i + 1) < orderByFields.length) {
1141 if (orderByComparator.isAscending() ^ previous) {
1142 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1143 }
1144 else {
1145 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1146 }
1147 }
1148 else {
1149 if (orderByComparator.isAscending() ^ previous) {
1150 query.append(WHERE_GREATER_THAN);
1151 }
1152 else {
1153 query.append(WHERE_LESSER_THAN);
1154 }
1155 }
1156 }
1157
1158 query.append(ORDER_BY_CLAUSE);
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(ORDER_BY_ASC_HAS_NEXT);
1167 }
1168 else {
1169 query.append(ORDER_BY_DESC_HAS_NEXT);
1170 }
1171 }
1172 else {
1173 if (orderByComparator.isAscending() ^ previous) {
1174 query.append(ORDER_BY_ASC);
1175 }
1176 else {
1177 query.append(ORDER_BY_DESC);
1178 }
1179 }
1180 }
1181 }
1182
1183 else {
1184 query.append(SCFrameworkVersionModelImpl.ORDER_BY_JPQL);
1185 }
1186
1187 String sql = query.toString();
1188
1189 Query q = session.createQuery(sql);
1190
1191 q.setFirstResult(0);
1192 q.setMaxResults(2);
1193
1194 QueryPos qPos = QueryPos.getInstance(q);
1195
1196 qPos.add(companyId);
1197
1198 if (orderByComparator != null) {
1199 Object[] values = orderByComparator.getOrderByValues(scFrameworkVersion);
1200
1201 for (Object value : values) {
1202 qPos.add(value);
1203 }
1204 }
1205
1206 List<SCFrameworkVersion> list = q.list();
1207
1208 if (list.size() == 2) {
1209 return list.get(1);
1210 }
1211 else {
1212 return null;
1213 }
1214 }
1215
1216
1224 public List<SCFrameworkVersion> findByG_A(long groupId, boolean active)
1225 throws SystemException {
1226 return findByG_A(groupId, active, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1227 null);
1228 }
1229
1230
1244 public List<SCFrameworkVersion> findByG_A(long groupId, boolean active,
1245 int start, int end) throws SystemException {
1246 return findByG_A(groupId, active, start, end, null);
1247 }
1248
1249
1264 public List<SCFrameworkVersion> findByG_A(long groupId, boolean active,
1265 int start, int end, OrderByComparator orderByComparator)
1266 throws SystemException {
1267 Object[] finderArgs = new Object[] {
1268 groupId, active,
1269
1270 String.valueOf(start), String.valueOf(end),
1271 String.valueOf(orderByComparator)
1272 };
1273
1274 List<SCFrameworkVersion> list = (List<SCFrameworkVersion>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_A,
1275 finderArgs, this);
1276
1277 if (list == null) {
1278 Session session = null;
1279
1280 try {
1281 session = openSession();
1282
1283 StringBundler query = null;
1284
1285 if (orderByComparator != null) {
1286 query = new StringBundler(4 +
1287 (orderByComparator.getOrderByFields().length * 3));
1288 }
1289 else {
1290 query = new StringBundler(4);
1291 }
1292
1293 query.append(_SQL_SELECT_SCFRAMEWORKVERSION_WHERE);
1294
1295 query.append(_FINDER_COLUMN_G_A_GROUPID_2);
1296
1297 query.append(_FINDER_COLUMN_G_A_ACTIVE_2);
1298
1299 if (orderByComparator != null) {
1300 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1301 orderByComparator);
1302 }
1303
1304 else {
1305 query.append(SCFrameworkVersionModelImpl.ORDER_BY_JPQL);
1306 }
1307
1308 String sql = query.toString();
1309
1310 Query q = session.createQuery(sql);
1311
1312 QueryPos qPos = QueryPos.getInstance(q);
1313
1314 qPos.add(groupId);
1315
1316 qPos.add(active);
1317
1318 list = (List<SCFrameworkVersion>)QueryUtil.list(q,
1319 getDialect(), start, end);
1320 }
1321 catch (Exception e) {
1322 throw processException(e);
1323 }
1324 finally {
1325 if (list == null) {
1326 list = new ArrayList<SCFrameworkVersion>();
1327 }
1328
1329 cacheResult(list);
1330
1331 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_A, finderArgs,
1332 list);
1333
1334 closeSession(session);
1335 }
1336 }
1337
1338 return list;
1339 }
1340
1341
1355 public SCFrameworkVersion findByG_A_First(long groupId, boolean active,
1356 OrderByComparator orderByComparator)
1357 throws NoSuchFrameworkVersionException, SystemException {
1358 List<SCFrameworkVersion> list = findByG_A(groupId, active, 0, 1,
1359 orderByComparator);
1360
1361 if (list.isEmpty()) {
1362 StringBundler msg = new StringBundler(6);
1363
1364 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1365
1366 msg.append("groupId=");
1367 msg.append(groupId);
1368
1369 msg.append(", active=");
1370 msg.append(active);
1371
1372 msg.append(StringPool.CLOSE_CURLY_BRACE);
1373
1374 throw new NoSuchFrameworkVersionException(msg.toString());
1375 }
1376 else {
1377 return list.get(0);
1378 }
1379 }
1380
1381
1395 public SCFrameworkVersion findByG_A_Last(long groupId, boolean active,
1396 OrderByComparator orderByComparator)
1397 throws NoSuchFrameworkVersionException, SystemException {
1398 int count = countByG_A(groupId, active);
1399
1400 List<SCFrameworkVersion> list = findByG_A(groupId, active, count - 1,
1401 count, orderByComparator);
1402
1403 if (list.isEmpty()) {
1404 StringBundler msg = new StringBundler(6);
1405
1406 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1407
1408 msg.append("groupId=");
1409 msg.append(groupId);
1410
1411 msg.append(", active=");
1412 msg.append(active);
1413
1414 msg.append(StringPool.CLOSE_CURLY_BRACE);
1415
1416 throw new NoSuchFrameworkVersionException(msg.toString());
1417 }
1418 else {
1419 return list.get(0);
1420 }
1421 }
1422
1423
1438 public SCFrameworkVersion[] findByG_A_PrevAndNext(long frameworkVersionId,
1439 long groupId, boolean active, OrderByComparator orderByComparator)
1440 throws NoSuchFrameworkVersionException, SystemException {
1441 SCFrameworkVersion scFrameworkVersion = findByPrimaryKey(frameworkVersionId);
1442
1443 Session session = null;
1444
1445 try {
1446 session = openSession();
1447
1448 SCFrameworkVersion[] array = new SCFrameworkVersionImpl[3];
1449
1450 array[0] = getByG_A_PrevAndNext(session, scFrameworkVersion,
1451 groupId, active, orderByComparator, true);
1452
1453 array[1] = scFrameworkVersion;
1454
1455 array[2] = getByG_A_PrevAndNext(session, scFrameworkVersion,
1456 groupId, active, orderByComparator, false);
1457
1458 return array;
1459 }
1460 catch (Exception e) {
1461 throw processException(e);
1462 }
1463 finally {
1464 closeSession(session);
1465 }
1466 }
1467
1468 protected SCFrameworkVersion getByG_A_PrevAndNext(Session session,
1469 SCFrameworkVersion scFrameworkVersion, long groupId, boolean active,
1470 OrderByComparator orderByComparator, boolean previous) {
1471 StringBundler query = null;
1472
1473 if (orderByComparator != null) {
1474 query = new StringBundler(6 +
1475 (orderByComparator.getOrderByFields().length * 6));
1476 }
1477 else {
1478 query = new StringBundler(3);
1479 }
1480
1481 query.append(_SQL_SELECT_SCFRAMEWORKVERSION_WHERE);
1482
1483 query.append(_FINDER_COLUMN_G_A_GROUPID_2);
1484
1485 query.append(_FINDER_COLUMN_G_A_ACTIVE_2);
1486
1487 if (orderByComparator != null) {
1488 String[] orderByFields = orderByComparator.getOrderByFields();
1489
1490 if (orderByFields.length > 0) {
1491 query.append(WHERE_AND);
1492 }
1493
1494 for (int i = 0; i < orderByFields.length; i++) {
1495 query.append(_ORDER_BY_ENTITY_ALIAS);
1496 query.append(orderByFields[i]);
1497
1498 if ((i + 1) < orderByFields.length) {
1499 if (orderByComparator.isAscending() ^ previous) {
1500 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1501 }
1502 else {
1503 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1504 }
1505 }
1506 else {
1507 if (orderByComparator.isAscending() ^ previous) {
1508 query.append(WHERE_GREATER_THAN);
1509 }
1510 else {
1511 query.append(WHERE_LESSER_THAN);
1512 }
1513 }
1514 }
1515
1516 query.append(ORDER_BY_CLAUSE);
1517
1518 for (int i = 0; i < orderByFields.length; i++) {
1519 query.append(_ORDER_BY_ENTITY_ALIAS);
1520 query.append(orderByFields[i]);
1521
1522 if ((i + 1) < orderByFields.length) {
1523 if (orderByComparator.isAscending() ^ previous) {
1524 query.append(ORDER_BY_ASC_HAS_NEXT);
1525 }
1526 else {
1527 query.append(ORDER_BY_DESC_HAS_NEXT);
1528 }
1529 }
1530 else {
1531 if (orderByComparator.isAscending() ^ previous) {
1532 query.append(ORDER_BY_ASC);
1533 }
1534 else {
1535 query.append(ORDER_BY_DESC);
1536 }
1537 }
1538 }
1539 }
1540
1541 else {
1542 query.append(SCFrameworkVersionModelImpl.ORDER_BY_JPQL);
1543 }
1544
1545 String sql = query.toString();
1546
1547 Query q = session.createQuery(sql);
1548
1549 q.setFirstResult(0);
1550 q.setMaxResults(2);
1551
1552 QueryPos qPos = QueryPos.getInstance(q);
1553
1554 qPos.add(groupId);
1555
1556 qPos.add(active);
1557
1558 if (orderByComparator != null) {
1559 Object[] values = orderByComparator.getOrderByValues(scFrameworkVersion);
1560
1561 for (Object value : values) {
1562 qPos.add(value);
1563 }
1564 }
1565
1566 List<SCFrameworkVersion> list = q.list();
1567
1568 if (list.size() == 2) {
1569 return list.get(1);
1570 }
1571 else {
1572 return null;
1573 }
1574 }
1575
1576
1584 public List<SCFrameworkVersion> filterFindByG_A(long groupId, boolean active)
1585 throws SystemException {
1586 return filterFindByG_A(groupId, active, QueryUtil.ALL_POS,
1587 QueryUtil.ALL_POS, null);
1588 }
1589
1590
1604 public List<SCFrameworkVersion> filterFindByG_A(long groupId,
1605 boolean active, int start, int end) throws SystemException {
1606 return filterFindByG_A(groupId, active, start, end, null);
1607 }
1608
1609
1624 public List<SCFrameworkVersion> filterFindByG_A(long groupId,
1625 boolean active, int start, int end, OrderByComparator orderByComparator)
1626 throws SystemException {
1627 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1628 return findByG_A(groupId, active, start, end, orderByComparator);
1629 }
1630
1631 Session session = null;
1632
1633 try {
1634 session = openSession();
1635
1636 StringBundler query = null;
1637
1638 if (orderByComparator != null) {
1639 query = new StringBundler(4 +
1640 (orderByComparator.getOrderByFields().length * 3));
1641 }
1642 else {
1643 query = new StringBundler(4);
1644 }
1645
1646 if (getDB().isSupportsInlineDistinct()) {
1647 query.append(_FILTER_SQL_SELECT_SCFRAMEWORKVERSION_WHERE);
1648 }
1649 else {
1650 query.append(_FILTER_SQL_SELECT_SCFRAMEWORKVERSION_NO_INLINE_DISTINCT_WHERE);
1651 }
1652
1653 query.append(_FINDER_COLUMN_G_A_GROUPID_2);
1654
1655 query.append(_FINDER_COLUMN_G_A_ACTIVE_2);
1656
1657 if (orderByComparator != null) {
1658 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1659 orderByComparator);
1660 }
1661
1662 else {
1663 query.append(SCFrameworkVersionModelImpl.ORDER_BY_JPQL);
1664 }
1665
1666 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1667 SCFrameworkVersion.class.getName(), _FILTER_COLUMN_PK,
1668 _FILTER_COLUMN_USERID, groupId);
1669
1670 SQLQuery q = session.createSQLQuery(sql);
1671
1672 q.addEntity(_FILTER_ENTITY_ALIAS, SCFrameworkVersionImpl.class);
1673
1674 QueryPos qPos = QueryPos.getInstance(q);
1675
1676 qPos.add(groupId);
1677
1678 qPos.add(active);
1679
1680 return (List<SCFrameworkVersion>)QueryUtil.list(q, getDialect(),
1681 start, end);
1682 }
1683 catch (Exception e) {
1684 throw processException(e);
1685 }
1686 finally {
1687 closeSession(session);
1688 }
1689 }
1690
1691
1697 public List<SCFrameworkVersion> findAll() throws SystemException {
1698 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1699 }
1700
1701
1713 public List<SCFrameworkVersion> findAll(int start, int end)
1714 throws SystemException {
1715 return findAll(start, end, null);
1716 }
1717
1718
1731 public List<SCFrameworkVersion> findAll(int start, int end,
1732 OrderByComparator orderByComparator) throws SystemException {
1733 Object[] finderArgs = new Object[] {
1734 String.valueOf(start), String.valueOf(end),
1735 String.valueOf(orderByComparator)
1736 };
1737
1738 List<SCFrameworkVersion> list = (List<SCFrameworkVersion>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
1739 finderArgs, this);
1740
1741 if (list == null) {
1742 Session session = null;
1743
1744 try {
1745 session = openSession();
1746
1747 StringBundler query = null;
1748 String sql = null;
1749
1750 if (orderByComparator != null) {
1751 query = new StringBundler(2 +
1752 (orderByComparator.getOrderByFields().length * 3));
1753
1754 query.append(_SQL_SELECT_SCFRAMEWORKVERSION);
1755
1756 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1757 orderByComparator);
1758
1759 sql = query.toString();
1760 }
1761 else {
1762 sql = _SQL_SELECT_SCFRAMEWORKVERSION.concat(SCFrameworkVersionModelImpl.ORDER_BY_JPQL);
1763 }
1764
1765 Query q = session.createQuery(sql);
1766
1767 if (orderByComparator == null) {
1768 list = (List<SCFrameworkVersion>)QueryUtil.list(q,
1769 getDialect(), start, end, false);
1770
1771 Collections.sort(list);
1772 }
1773 else {
1774 list = (List<SCFrameworkVersion>)QueryUtil.list(q,
1775 getDialect(), start, end);
1776 }
1777 }
1778 catch (Exception e) {
1779 throw processException(e);
1780 }
1781 finally {
1782 if (list == null) {
1783 list = new ArrayList<SCFrameworkVersion>();
1784 }
1785
1786 cacheResult(list);
1787
1788 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
1789
1790 closeSession(session);
1791 }
1792 }
1793
1794 return list;
1795 }
1796
1797
1803 public void removeByGroupId(long groupId) throws SystemException {
1804 for (SCFrameworkVersion scFrameworkVersion : findByGroupId(groupId)) {
1805 remove(scFrameworkVersion);
1806 }
1807 }
1808
1809
1815 public void removeByCompanyId(long companyId) throws SystemException {
1816 for (SCFrameworkVersion scFrameworkVersion : findByCompanyId(companyId)) {
1817 remove(scFrameworkVersion);
1818 }
1819 }
1820
1821
1828 public void removeByG_A(long groupId, boolean active)
1829 throws SystemException {
1830 for (SCFrameworkVersion scFrameworkVersion : findByG_A(groupId, active)) {
1831 remove(scFrameworkVersion);
1832 }
1833 }
1834
1835
1840 public void removeAll() throws SystemException {
1841 for (SCFrameworkVersion scFrameworkVersion : findAll()) {
1842 remove(scFrameworkVersion);
1843 }
1844 }
1845
1846
1853 public int countByGroupId(long groupId) throws SystemException {
1854 Object[] finderArgs = new Object[] { groupId };
1855
1856 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
1857 finderArgs, this);
1858
1859 if (count == null) {
1860 Session session = null;
1861
1862 try {
1863 session = openSession();
1864
1865 StringBundler query = new StringBundler(2);
1866
1867 query.append(_SQL_COUNT_SCFRAMEWORKVERSION_WHERE);
1868
1869 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1870
1871 String sql = query.toString();
1872
1873 Query q = session.createQuery(sql);
1874
1875 QueryPos qPos = QueryPos.getInstance(q);
1876
1877 qPos.add(groupId);
1878
1879 count = (Long)q.uniqueResult();
1880 }
1881 catch (Exception e) {
1882 throw processException(e);
1883 }
1884 finally {
1885 if (count == null) {
1886 count = Long.valueOf(0);
1887 }
1888
1889 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
1890 finderArgs, count);
1891
1892 closeSession(session);
1893 }
1894 }
1895
1896 return count.intValue();
1897 }
1898
1899
1906 public int filterCountByGroupId(long groupId) throws SystemException {
1907 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1908 return countByGroupId(groupId);
1909 }
1910
1911 Session session = null;
1912
1913 try {
1914 session = openSession();
1915
1916 StringBundler query = new StringBundler(2);
1917
1918 query.append(_FILTER_SQL_COUNT_SCFRAMEWORKVERSION_WHERE);
1919
1920 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1921
1922 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1923 SCFrameworkVersion.class.getName(), _FILTER_COLUMN_PK,
1924 _FILTER_COLUMN_USERID, groupId);
1925
1926 SQLQuery q = session.createSQLQuery(sql);
1927
1928 q.addScalar(COUNT_COLUMN_NAME,
1929 com.liferay.portal.kernel.dao.orm.Type.LONG);
1930
1931 QueryPos qPos = QueryPos.getInstance(q);
1932
1933 qPos.add(groupId);
1934
1935 Long count = (Long)q.uniqueResult();
1936
1937 return count.intValue();
1938 }
1939 catch (Exception e) {
1940 throw processException(e);
1941 }
1942 finally {
1943 closeSession(session);
1944 }
1945 }
1946
1947
1954 public int countByCompanyId(long companyId) throws SystemException {
1955 Object[] finderArgs = new Object[] { companyId };
1956
1957 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
1958 finderArgs, this);
1959
1960 if (count == null) {
1961 Session session = null;
1962
1963 try {
1964 session = openSession();
1965
1966 StringBundler query = new StringBundler(2);
1967
1968 query.append(_SQL_COUNT_SCFRAMEWORKVERSION_WHERE);
1969
1970 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1971
1972 String sql = query.toString();
1973
1974 Query q = session.createQuery(sql);
1975
1976 QueryPos qPos = QueryPos.getInstance(q);
1977
1978 qPos.add(companyId);
1979
1980 count = (Long)q.uniqueResult();
1981 }
1982 catch (Exception e) {
1983 throw processException(e);
1984 }
1985 finally {
1986 if (count == null) {
1987 count = Long.valueOf(0);
1988 }
1989
1990 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
1991 finderArgs, count);
1992
1993 closeSession(session);
1994 }
1995 }
1996
1997 return count.intValue();
1998 }
1999
2000
2008 public int countByG_A(long groupId, boolean active)
2009 throws SystemException {
2010 Object[] finderArgs = new Object[] { groupId, active };
2011
2012 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_A,
2013 finderArgs, this);
2014
2015 if (count == null) {
2016 Session session = null;
2017
2018 try {
2019 session = openSession();
2020
2021 StringBundler query = new StringBundler(3);
2022
2023 query.append(_SQL_COUNT_SCFRAMEWORKVERSION_WHERE);
2024
2025 query.append(_FINDER_COLUMN_G_A_GROUPID_2);
2026
2027 query.append(_FINDER_COLUMN_G_A_ACTIVE_2);
2028
2029 String sql = query.toString();
2030
2031 Query q = session.createQuery(sql);
2032
2033 QueryPos qPos = QueryPos.getInstance(q);
2034
2035 qPos.add(groupId);
2036
2037 qPos.add(active);
2038
2039 count = (Long)q.uniqueResult();
2040 }
2041 catch (Exception e) {
2042 throw processException(e);
2043 }
2044 finally {
2045 if (count == null) {
2046 count = Long.valueOf(0);
2047 }
2048
2049 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_A, finderArgs,
2050 count);
2051
2052 closeSession(session);
2053 }
2054 }
2055
2056 return count.intValue();
2057 }
2058
2059
2067 public int filterCountByG_A(long groupId, boolean active)
2068 throws SystemException {
2069 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2070 return countByG_A(groupId, active);
2071 }
2072
2073 Session session = null;
2074
2075 try {
2076 session = openSession();
2077
2078 StringBundler query = new StringBundler(3);
2079
2080 query.append(_FILTER_SQL_COUNT_SCFRAMEWORKVERSION_WHERE);
2081
2082 query.append(_FINDER_COLUMN_G_A_GROUPID_2);
2083
2084 query.append(_FINDER_COLUMN_G_A_ACTIVE_2);
2085
2086 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2087 SCFrameworkVersion.class.getName(), _FILTER_COLUMN_PK,
2088 _FILTER_COLUMN_USERID, groupId);
2089
2090 SQLQuery q = session.createSQLQuery(sql);
2091
2092 q.addScalar(COUNT_COLUMN_NAME,
2093 com.liferay.portal.kernel.dao.orm.Type.LONG);
2094
2095 QueryPos qPos = QueryPos.getInstance(q);
2096
2097 qPos.add(groupId);
2098
2099 qPos.add(active);
2100
2101 Long count = (Long)q.uniqueResult();
2102
2103 return count.intValue();
2104 }
2105 catch (Exception e) {
2106 throw processException(e);
2107 }
2108 finally {
2109 closeSession(session);
2110 }
2111 }
2112
2113
2119 public int countAll() throws SystemException {
2120 Object[] finderArgs = new Object[0];
2121
2122 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2123 finderArgs, this);
2124
2125 if (count == null) {
2126 Session session = null;
2127
2128 try {
2129 session = openSession();
2130
2131 Query q = session.createQuery(_SQL_COUNT_SCFRAMEWORKVERSION);
2132
2133 count = (Long)q.uniqueResult();
2134 }
2135 catch (Exception e) {
2136 throw processException(e);
2137 }
2138 finally {
2139 if (count == null) {
2140 count = Long.valueOf(0);
2141 }
2142
2143 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
2144 count);
2145
2146 closeSession(session);
2147 }
2148 }
2149
2150 return count.intValue();
2151 }
2152
2153
2160 public List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> getSCProductVersions(
2161 long pk) throws SystemException {
2162 return getSCProductVersions(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
2163 }
2164
2165
2178 public List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> getSCProductVersions(
2179 long pk, int start, int end) throws SystemException {
2180 return getSCProductVersions(pk, start, end, null);
2181 }
2182
2183 public static final FinderPath FINDER_PATH_GET_SCPRODUCTVERSIONS = new FinderPath(com.liferay.portlet.softwarecatalog.model.impl.SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
2184 SCFrameworkVersionModelImpl.FINDER_CACHE_ENABLED_SCFRAMEWORKVERSI_SCPRODUCTVERS,
2185 SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME,
2186 "getSCProductVersions",
2187 new String[] {
2188 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
2189 "com.liferay.portal.kernel.util.OrderByComparator"
2190 });
2191
2192
2206 public List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> getSCProductVersions(
2207 long pk, int start, int end, OrderByComparator orderByComparator)
2208 throws SystemException {
2209 Object[] finderArgs = new Object[] {
2210 pk, String.valueOf(start), String.valueOf(end),
2211 String.valueOf(orderByComparator)
2212 };
2213
2214 List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> list = (List<com.liferay.portlet.softwarecatalog.model.SCProductVersion>)FinderCacheUtil.getResult(FINDER_PATH_GET_SCPRODUCTVERSIONS,
2215 finderArgs, this);
2216
2217 if (list == null) {
2218 Session session = null;
2219
2220 try {
2221 session = openSession();
2222
2223 String sql = null;
2224
2225 if (orderByComparator != null) {
2226 sql = _SQL_GETSCPRODUCTVERSIONS.concat(ORDER_BY_CLAUSE)
2227 .concat(orderByComparator.getOrderBy());
2228 }
2229 else {
2230 sql = _SQL_GETSCPRODUCTVERSIONS.concat(com.liferay.portlet.softwarecatalog.model.impl.SCProductVersionModelImpl.ORDER_BY_SQL);
2231 }
2232
2233 SQLQuery q = session.createSQLQuery(sql);
2234
2235 q.addEntity("SCProductVersion",
2236 com.liferay.portlet.softwarecatalog.model.impl.SCProductVersionImpl.class);
2237
2238 QueryPos qPos = QueryPos.getInstance(q);
2239
2240 qPos.add(pk);
2241
2242 list = (List<com.liferay.portlet.softwarecatalog.model.SCProductVersion>)QueryUtil.list(q,
2243 getDialect(), start, end);
2244 }
2245 catch (Exception e) {
2246 throw processException(e);
2247 }
2248 finally {
2249 if (list == null) {
2250 list = new ArrayList<com.liferay.portlet.softwarecatalog.model.SCProductVersion>();
2251 }
2252
2253 scProductVersionPersistence.cacheResult(list);
2254
2255 FinderCacheUtil.putResult(FINDER_PATH_GET_SCPRODUCTVERSIONS,
2256 finderArgs, list);
2257
2258 closeSession(session);
2259 }
2260 }
2261
2262 return list;
2263 }
2264
2265 public static final FinderPath FINDER_PATH_GET_SCPRODUCTVERSIONS_SIZE = new FinderPath(com.liferay.portlet.softwarecatalog.model.impl.SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
2266 SCFrameworkVersionModelImpl.FINDER_CACHE_ENABLED_SCFRAMEWORKVERSI_SCPRODUCTVERS,
2267 SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME,
2268 "getSCProductVersionsSize", new String[] { Long.class.getName() });
2269
2270
2277 public int getSCProductVersionsSize(long pk) throws SystemException {
2278 Object[] finderArgs = new Object[] { pk };
2279
2280 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_SCPRODUCTVERSIONS_SIZE,
2281 finderArgs, this);
2282
2283 if (count == null) {
2284 Session session = null;
2285
2286 try {
2287 session = openSession();
2288
2289 SQLQuery q = session.createSQLQuery(_SQL_GETSCPRODUCTVERSIONSSIZE);
2290
2291 q.addScalar(COUNT_COLUMN_NAME,
2292 com.liferay.portal.kernel.dao.orm.Type.LONG);
2293
2294 QueryPos qPos = QueryPos.getInstance(q);
2295
2296 qPos.add(pk);
2297
2298 count = (Long)q.uniqueResult();
2299 }
2300 catch (Exception e) {
2301 throw processException(e);
2302 }
2303 finally {
2304 if (count == null) {
2305 count = Long.valueOf(0);
2306 }
2307
2308 FinderCacheUtil.putResult(FINDER_PATH_GET_SCPRODUCTVERSIONS_SIZE,
2309 finderArgs, count);
2310
2311 closeSession(session);
2312 }
2313 }
2314
2315 return count.intValue();
2316 }
2317
2318 public static final FinderPath FINDER_PATH_CONTAINS_SCPRODUCTVERSION = new FinderPath(com.liferay.portlet.softwarecatalog.model.impl.SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
2319 SCFrameworkVersionModelImpl.FINDER_CACHE_ENABLED_SCFRAMEWORKVERSI_SCPRODUCTVERS,
2320 SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME,
2321 "containsSCProductVersion",
2322 new String[] { Long.class.getName(), Long.class.getName() });
2323
2324
2332 public boolean containsSCProductVersion(long pk, long scProductVersionPK)
2333 throws SystemException {
2334 Object[] finderArgs = new Object[] { pk, scProductVersionPK };
2335
2336 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_SCPRODUCTVERSION,
2337 finderArgs, this);
2338
2339 if (value == null) {
2340 try {
2341 value = Boolean.valueOf(containsSCProductVersion.contains(pk,
2342 scProductVersionPK));
2343 }
2344 catch (Exception e) {
2345 throw processException(e);
2346 }
2347 finally {
2348 if (value == null) {
2349 value = Boolean.FALSE;
2350 }
2351
2352 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_SCPRODUCTVERSION,
2353 finderArgs, value);
2354 }
2355 }
2356
2357 return value.booleanValue();
2358 }
2359
2360
2367 public boolean containsSCProductVersions(long pk) throws SystemException {
2368 if (getSCProductVersionsSize(pk) > 0) {
2369 return true;
2370 }
2371 else {
2372 return false;
2373 }
2374 }
2375
2376
2383 public void addSCProductVersion(long pk, long scProductVersionPK)
2384 throws SystemException {
2385 try {
2386 addSCProductVersion.add(pk, scProductVersionPK);
2387 }
2388 catch (Exception e) {
2389 throw processException(e);
2390 }
2391 finally {
2392 FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
2393 }
2394 }
2395
2396
2403 public void addSCProductVersion(long pk,
2404 com.liferay.portlet.softwarecatalog.model.SCProductVersion scProductVersion)
2405 throws SystemException {
2406 try {
2407 addSCProductVersion.add(pk, scProductVersion.getPrimaryKey());
2408 }
2409 catch (Exception e) {
2410 throw processException(e);
2411 }
2412 finally {
2413 FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
2414 }
2415 }
2416
2417
2424 public void addSCProductVersions(long pk, long[] scProductVersionPKs)
2425 throws SystemException {
2426 try {
2427 for (long scProductVersionPK : scProductVersionPKs) {
2428 addSCProductVersion.add(pk, scProductVersionPK);
2429 }
2430 }
2431 catch (Exception e) {
2432 throw processException(e);
2433 }
2434 finally {
2435 FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
2436 }
2437 }
2438
2439
2446 public void addSCProductVersions(long pk,
2447 List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> scProductVersions)
2448 throws SystemException {
2449 try {
2450 for (com.liferay.portlet.softwarecatalog.model.SCProductVersion scProductVersion : scProductVersions) {
2451 addSCProductVersion.add(pk, scProductVersion.getPrimaryKey());
2452 }
2453 }
2454 catch (Exception e) {
2455 throw processException(e);
2456 }
2457 finally {
2458 FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
2459 }
2460 }
2461
2462
2468 public void clearSCProductVersions(long pk) throws SystemException {
2469 try {
2470 clearSCProductVersions.clear(pk);
2471 }
2472 catch (Exception e) {
2473 throw processException(e);
2474 }
2475 finally {
2476 FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
2477 }
2478 }
2479
2480
2487 public void removeSCProductVersion(long pk, long scProductVersionPK)
2488 throws SystemException {
2489 try {
2490 removeSCProductVersion.remove(pk, scProductVersionPK);
2491 }
2492 catch (Exception e) {
2493 throw processException(e);
2494 }
2495 finally {
2496 FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
2497 }
2498 }
2499
2500
2507 public void removeSCProductVersion(long pk,
2508 com.liferay.portlet.softwarecatalog.model.SCProductVersion scProductVersion)
2509 throws SystemException {
2510 try {
2511 removeSCProductVersion.remove(pk, scProductVersion.getPrimaryKey());
2512 }
2513 catch (Exception e) {
2514 throw processException(e);
2515 }
2516 finally {
2517 FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
2518 }
2519 }
2520
2521
2528 public void removeSCProductVersions(long pk, long[] scProductVersionPKs)
2529 throws SystemException {
2530 try {
2531 for (long scProductVersionPK : scProductVersionPKs) {
2532 removeSCProductVersion.remove(pk, scProductVersionPK);
2533 }
2534 }
2535 catch (Exception e) {
2536 throw processException(e);
2537 }
2538 finally {
2539 FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
2540 }
2541 }
2542
2543
2550 public void removeSCProductVersions(long pk,
2551 List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> scProductVersions)
2552 throws SystemException {
2553 try {
2554 for (com.liferay.portlet.softwarecatalog.model.SCProductVersion scProductVersion : scProductVersions) {
2555 removeSCProductVersion.remove(pk,
2556 scProductVersion.getPrimaryKey());
2557 }
2558 }
2559 catch (Exception e) {
2560 throw processException(e);
2561 }
2562 finally {
2563 FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
2564 }
2565 }
2566
2567
2574 public void setSCProductVersions(long pk, long[] scProductVersionPKs)
2575 throws SystemException {
2576 try {
2577 Set<Long> scProductVersionPKSet = SetUtil.fromArray(scProductVersionPKs);
2578
2579 List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> scProductVersions =
2580 getSCProductVersions(pk);
2581
2582 for (com.liferay.portlet.softwarecatalog.model.SCProductVersion scProductVersion : scProductVersions) {
2583 if (!scProductVersionPKSet.remove(
2584 scProductVersion.getPrimaryKey())) {
2585 removeSCProductVersion.remove(pk,
2586 scProductVersion.getPrimaryKey());
2587 }
2588 }
2589
2590 for (Long scProductVersionPK : scProductVersionPKSet) {
2591 addSCProductVersion.add(pk, scProductVersionPK);
2592 }
2593 }
2594 catch (Exception e) {
2595 throw processException(e);
2596 }
2597 finally {
2598 FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
2599 }
2600 }
2601
2602
2609 public void setSCProductVersions(long pk,
2610 List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> scProductVersions)
2611 throws SystemException {
2612 try {
2613 long[] scProductVersionPKs = new long[scProductVersions.size()];
2614
2615 for (int i = 0; i < scProductVersions.size(); i++) {
2616 com.liferay.portlet.softwarecatalog.model.SCProductVersion scProductVersion =
2617 scProductVersions.get(i);
2618
2619 scProductVersionPKs[i] = scProductVersion.getPrimaryKey();
2620 }
2621
2622 setSCProductVersions(pk, scProductVersionPKs);
2623 }
2624 catch (Exception e) {
2625 throw processException(e);
2626 }
2627 finally {
2628 FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
2629 }
2630 }
2631
2632
2635 public void afterPropertiesSet() {
2636 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2637 com.liferay.portal.util.PropsUtil.get(
2638 "value.object.listener.com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion")));
2639
2640 if (listenerClassNames.length > 0) {
2641 try {
2642 List<ModelListener<SCFrameworkVersion>> listenersList = new ArrayList<ModelListener<SCFrameworkVersion>>();
2643
2644 for (String listenerClassName : listenerClassNames) {
2645 listenersList.add((ModelListener<SCFrameworkVersion>)InstanceFactory.newInstance(
2646 listenerClassName));
2647 }
2648
2649 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2650 }
2651 catch (Exception e) {
2652 _log.error(e);
2653 }
2654 }
2655
2656 containsSCProductVersion = new ContainsSCProductVersion(this);
2657
2658 addSCProductVersion = new AddSCProductVersion(this);
2659 clearSCProductVersions = new ClearSCProductVersions(this);
2660 removeSCProductVersion = new RemoveSCProductVersion(this);
2661 }
2662
2663 public void destroy() {
2664 EntityCacheUtil.removeCache(SCFrameworkVersionImpl.class.getName());
2665 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
2666 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST);
2667 }
2668
2669 @BeanReference(type = SCLicensePersistence.class)
2670 protected SCLicensePersistence scLicensePersistence;
2671 @BeanReference(type = SCFrameworkVersionPersistence.class)
2672 protected SCFrameworkVersionPersistence scFrameworkVersionPersistence;
2673 @BeanReference(type = SCProductEntryPersistence.class)
2674 protected SCProductEntryPersistence scProductEntryPersistence;
2675 @BeanReference(type = SCProductScreenshotPersistence.class)
2676 protected SCProductScreenshotPersistence scProductScreenshotPersistence;
2677 @BeanReference(type = SCProductVersionPersistence.class)
2678 protected SCProductVersionPersistence scProductVersionPersistence;
2679 @BeanReference(type = ResourcePersistence.class)
2680 protected ResourcePersistence resourcePersistence;
2681 @BeanReference(type = UserPersistence.class)
2682 protected UserPersistence userPersistence;
2683 protected ContainsSCProductVersion containsSCProductVersion;
2684 protected AddSCProductVersion addSCProductVersion;
2685 protected ClearSCProductVersions clearSCProductVersions;
2686 protected RemoveSCProductVersion removeSCProductVersion;
2687
2688 protected class ContainsSCProductVersion {
2689 protected ContainsSCProductVersion(
2690 SCFrameworkVersionPersistenceImpl persistenceImpl) {
2691 super();
2692
2693 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
2694 _SQL_CONTAINSSCPRODUCTVERSION,
2695 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
2696 RowMapper.COUNT);
2697 }
2698
2699 protected boolean contains(long frameworkVersionId,
2700 long productVersionId) {
2701 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
2702 new Long(frameworkVersionId), new Long(productVersionId)
2703 });
2704
2705 if (results.size() > 0) {
2706 Integer count = results.get(0);
2707
2708 if (count.intValue() > 0) {
2709 return true;
2710 }
2711 }
2712
2713 return false;
2714 }
2715
2716 private MappingSqlQuery<Integer> _mappingSqlQuery;
2717 }
2718
2719 protected class AddSCProductVersion {
2720 protected AddSCProductVersion(
2721 SCFrameworkVersionPersistenceImpl persistenceImpl) {
2722 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2723 "INSERT INTO SCFrameworkVersi_SCProductVers (frameworkVersionId, productVersionId) VALUES (?, ?)",
2724 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
2725 _persistenceImpl = persistenceImpl;
2726 }
2727
2728 protected void add(long frameworkVersionId, long productVersionId)
2729 throws SystemException {
2730 if (!_persistenceImpl.containsSCProductVersion.contains(
2731 frameworkVersionId, productVersionId)) {
2732 ModelListener<com.liferay.portlet.softwarecatalog.model.SCProductVersion>[] scProductVersionListeners =
2733 scProductVersionPersistence.getListeners();
2734
2735 for (ModelListener<SCFrameworkVersion> listener : listeners) {
2736 listener.onBeforeAddAssociation(frameworkVersionId,
2737 com.liferay.portlet.softwarecatalog.model.SCProductVersion.class.getName(),
2738 productVersionId);
2739 }
2740
2741 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCProductVersion> listener : scProductVersionListeners) {
2742 listener.onBeforeAddAssociation(productVersionId,
2743 SCFrameworkVersion.class.getName(), frameworkVersionId);
2744 }
2745
2746 _sqlUpdate.update(new Object[] {
2747 new Long(frameworkVersionId), new Long(productVersionId)
2748 });
2749
2750 for (ModelListener<SCFrameworkVersion> listener : listeners) {
2751 listener.onAfterAddAssociation(frameworkVersionId,
2752 com.liferay.portlet.softwarecatalog.model.SCProductVersion.class.getName(),
2753 productVersionId);
2754 }
2755
2756 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCProductVersion> listener : scProductVersionListeners) {
2757 listener.onAfterAddAssociation(productVersionId,
2758 SCFrameworkVersion.class.getName(), frameworkVersionId);
2759 }
2760 }
2761 }
2762
2763 private SqlUpdate _sqlUpdate;
2764 private SCFrameworkVersionPersistenceImpl _persistenceImpl;
2765 }
2766
2767 protected class ClearSCProductVersions {
2768 protected ClearSCProductVersions(
2769 SCFrameworkVersionPersistenceImpl persistenceImpl) {
2770 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2771 "DELETE FROM SCFrameworkVersi_SCProductVers WHERE frameworkVersionId = ?",
2772 new int[] { java.sql.Types.BIGINT });
2773 }
2774
2775 protected void clear(long frameworkVersionId) throws SystemException {
2776 ModelListener<com.liferay.portlet.softwarecatalog.model.SCProductVersion>[] scProductVersionListeners =
2777 scProductVersionPersistence.getListeners();
2778
2779 List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> scProductVersions =
2780 null;
2781
2782 if ((listeners.length > 0) ||
2783 (scProductVersionListeners.length > 0)) {
2784 scProductVersions = getSCProductVersions(frameworkVersionId);
2785
2786 for (com.liferay.portlet.softwarecatalog.model.SCProductVersion scProductVersion : scProductVersions) {
2787 for (ModelListener<SCFrameworkVersion> listener : listeners) {
2788 listener.onBeforeRemoveAssociation(frameworkVersionId,
2789 com.liferay.portlet.softwarecatalog.model.SCProductVersion.class.getName(),
2790 scProductVersion.getPrimaryKey());
2791 }
2792
2793 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCProductVersion> listener : scProductVersionListeners) {
2794 listener.onBeforeRemoveAssociation(scProductVersion.getPrimaryKey(),
2795 SCFrameworkVersion.class.getName(),
2796 frameworkVersionId);
2797 }
2798 }
2799 }
2800
2801 _sqlUpdate.update(new Object[] { new Long(frameworkVersionId) });
2802
2803 if ((listeners.length > 0) ||
2804 (scProductVersionListeners.length > 0)) {
2805 for (com.liferay.portlet.softwarecatalog.model.SCProductVersion scProductVersion : scProductVersions) {
2806 for (ModelListener<SCFrameworkVersion> listener : listeners) {
2807 listener.onAfterRemoveAssociation(frameworkVersionId,
2808 com.liferay.portlet.softwarecatalog.model.SCProductVersion.class.getName(),
2809 scProductVersion.getPrimaryKey());
2810 }
2811
2812 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCProductVersion> listener : scProductVersionListeners) {
2813 listener.onAfterRemoveAssociation(scProductVersion.getPrimaryKey(),
2814 SCFrameworkVersion.class.getName(),
2815 frameworkVersionId);
2816 }
2817 }
2818 }
2819 }
2820
2821 private SqlUpdate _sqlUpdate;
2822 }
2823
2824 protected class RemoveSCProductVersion {
2825 protected RemoveSCProductVersion(
2826 SCFrameworkVersionPersistenceImpl persistenceImpl) {
2827 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2828 "DELETE FROM SCFrameworkVersi_SCProductVers WHERE frameworkVersionId = ? AND productVersionId = ?",
2829 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
2830 _persistenceImpl = persistenceImpl;
2831 }
2832
2833 protected void remove(long frameworkVersionId, long productVersionId)
2834 throws SystemException {
2835 if (_persistenceImpl.containsSCProductVersion.contains(
2836 frameworkVersionId, productVersionId)) {
2837 ModelListener<com.liferay.portlet.softwarecatalog.model.SCProductVersion>[] scProductVersionListeners =
2838 scProductVersionPersistence.getListeners();
2839
2840 for (ModelListener<SCFrameworkVersion> listener : listeners) {
2841 listener.onBeforeRemoveAssociation(frameworkVersionId,
2842 com.liferay.portlet.softwarecatalog.model.SCProductVersion.class.getName(),
2843 productVersionId);
2844 }
2845
2846 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCProductVersion> listener : scProductVersionListeners) {
2847 listener.onBeforeRemoveAssociation(productVersionId,
2848 SCFrameworkVersion.class.getName(), frameworkVersionId);
2849 }
2850
2851 _sqlUpdate.update(new Object[] {
2852 new Long(frameworkVersionId), new Long(productVersionId)
2853 });
2854
2855 for (ModelListener<SCFrameworkVersion> listener : listeners) {
2856 listener.onAfterRemoveAssociation(frameworkVersionId,
2857 com.liferay.portlet.softwarecatalog.model.SCProductVersion.class.getName(),
2858 productVersionId);
2859 }
2860
2861 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCProductVersion> listener : scProductVersionListeners) {
2862 listener.onAfterRemoveAssociation(productVersionId,
2863 SCFrameworkVersion.class.getName(), frameworkVersionId);
2864 }
2865 }
2866 }
2867
2868 private SqlUpdate _sqlUpdate;
2869 private SCFrameworkVersionPersistenceImpl _persistenceImpl;
2870 }
2871
2872 private static final String _SQL_SELECT_SCFRAMEWORKVERSION = "SELECT scFrameworkVersion FROM SCFrameworkVersion scFrameworkVersion";
2873 private static final String _SQL_SELECT_SCFRAMEWORKVERSION_WHERE = "SELECT scFrameworkVersion FROM SCFrameworkVersion scFrameworkVersion WHERE ";
2874 private static final String _SQL_COUNT_SCFRAMEWORKVERSION = "SELECT COUNT(scFrameworkVersion) FROM SCFrameworkVersion scFrameworkVersion";
2875 private static final String _SQL_COUNT_SCFRAMEWORKVERSION_WHERE = "SELECT COUNT(scFrameworkVersion) FROM SCFrameworkVersion scFrameworkVersion WHERE ";
2876 private static final String _SQL_GETSCPRODUCTVERSIONS = "SELECT {SCProductVersion.*} FROM SCProductVersion INNER JOIN SCFrameworkVersi_SCProductVers ON (SCFrameworkVersi_SCProductVers.productVersionId = SCProductVersion.productVersionId) WHERE (SCFrameworkVersi_SCProductVers.frameworkVersionId = ?)";
2877 private static final String _SQL_GETSCPRODUCTVERSIONSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM SCFrameworkVersi_SCProductVers WHERE frameworkVersionId = ?";
2878 private static final String _SQL_CONTAINSSCPRODUCTVERSION = "SELECT COUNT(*) AS COUNT_VALUE FROM SCFrameworkVersi_SCProductVers WHERE frameworkVersionId = ? AND productVersionId = ?";
2879 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "scFrameworkVersion.groupId = ?";
2880 private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "scFrameworkVersion.companyId = ?";
2881 private static final String _FINDER_COLUMN_G_A_GROUPID_2 = "scFrameworkVersion.groupId = ? AND ";
2882 private static final String _FINDER_COLUMN_G_A_ACTIVE_2 = "scFrameworkVersion.active = ?";
2883 private static final String _FILTER_SQL_SELECT_SCFRAMEWORKVERSION_WHERE = "SELECT DISTINCT {scFrameworkVersion.*} FROM SCFrameworkVersion scFrameworkVersion WHERE ";
2884 private static final String _FILTER_SQL_SELECT_SCFRAMEWORKVERSION_NO_INLINE_DISTINCT_WHERE =
2885 "SELECT {scFrameworkVersion.*} FROM (SELECT DISTINCT frameworkVersionId FROM SCFrameworkVersion) scFrameworkVersion2 INNER JOIN SCFrameworkVersion scFrameworkVersion ON (scFrameworkVersion2.frameworkVersionId = scFrameworkVersion.frameworkVersionId) WHERE ";
2886 private static final String _FILTER_SQL_COUNT_SCFRAMEWORKVERSION_WHERE = "SELECT COUNT(DISTINCT scFrameworkVersion.frameworkVersionId) AS COUNT_VALUE FROM SCFrameworkVersion scFrameworkVersion WHERE ";
2887 private static final String _FILTER_COLUMN_PK = "scFrameworkVersion.frameworkVersionId";
2888 private static final String _FILTER_COLUMN_USERID = "scFrameworkVersion.userId";
2889 private static final String _FILTER_ENTITY_ALIAS = "scFrameworkVersion";
2890 private static final String _ORDER_BY_ENTITY_ALIAS = "scFrameworkVersion.";
2891 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No SCFrameworkVersion exists with the primary key ";
2892 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No SCFrameworkVersion exists with the key {";
2893 private static Log _log = LogFactoryUtil.getLog(SCFrameworkVersionPersistenceImpl.class);
2894 }