1
19
20 package com.liferay.portlet.softwarecatalog.service.persistence;
21
22 import com.liferay.portal.SystemException;
23 import com.liferay.portal.kernel.dao.jdbc.MappingSqlQuery;
24 import com.liferay.portal.kernel.dao.jdbc.MappingSqlQueryFactoryUtil;
25 import com.liferay.portal.kernel.dao.jdbc.RowMapper;
26 import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
27 import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
28 import com.liferay.portal.kernel.dao.orm.DynamicQuery;
29 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
30 import com.liferay.portal.kernel.dao.orm.Query;
31 import com.liferay.portal.kernel.dao.orm.QueryPos;
32 import com.liferay.portal.kernel.dao.orm.QueryUtil;
33 import com.liferay.portal.kernel.dao.orm.SQLQuery;
34 import com.liferay.portal.kernel.dao.orm.Session;
35 import com.liferay.portal.kernel.dao.orm.Type;
36 import com.liferay.portal.kernel.log.Log;
37 import com.liferay.portal.kernel.log.LogFactoryUtil;
38 import com.liferay.portal.kernel.util.GetterUtil;
39 import com.liferay.portal.kernel.util.OrderByComparator;
40 import com.liferay.portal.kernel.util.StringPool;
41 import com.liferay.portal.kernel.util.StringUtil;
42 import com.liferay.portal.model.ModelListener;
43 import com.liferay.portal.service.persistence.BatchSessionUtil;
44 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
45
46 import com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException;
47 import com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion;
48 import com.liferay.portlet.softwarecatalog.model.impl.SCFrameworkVersionImpl;
49 import com.liferay.portlet.softwarecatalog.model.impl.SCFrameworkVersionModelImpl;
50
51 import java.sql.Types;
52
53 import java.util.ArrayList;
54 import java.util.Collections;
55 import java.util.Iterator;
56 import java.util.List;
57
58
64 public class SCFrameworkVersionPersistenceImpl extends BasePersistenceImpl
65 implements SCFrameworkVersionPersistence {
66 public SCFrameworkVersion create(long frameworkVersionId) {
67 SCFrameworkVersion scFrameworkVersion = new SCFrameworkVersionImpl();
68
69 scFrameworkVersion.setNew(true);
70 scFrameworkVersion.setPrimaryKey(frameworkVersionId);
71
72 return scFrameworkVersion;
73 }
74
75 public SCFrameworkVersion remove(long frameworkVersionId)
76 throws NoSuchFrameworkVersionException, SystemException {
77 Session session = null;
78
79 try {
80 session = openSession();
81
82 SCFrameworkVersion scFrameworkVersion = (SCFrameworkVersion)session.get(SCFrameworkVersionImpl.class,
83 new Long(frameworkVersionId));
84
85 if (scFrameworkVersion == null) {
86 if (_log.isWarnEnabled()) {
87 _log.warn(
88 "No SCFrameworkVersion exists with the primary key " +
89 frameworkVersionId);
90 }
91
92 throw new NoSuchFrameworkVersionException(
93 "No SCFrameworkVersion exists with the primary key " +
94 frameworkVersionId);
95 }
96
97 return remove(scFrameworkVersion);
98 }
99 catch (NoSuchFrameworkVersionException nsee) {
100 throw nsee;
101 }
102 catch (Exception e) {
103 throw processException(e);
104 }
105 finally {
106 closeSession(session);
107 }
108 }
109
110 public SCFrameworkVersion remove(SCFrameworkVersion scFrameworkVersion)
111 throws SystemException {
112 for (ModelListener listener : listeners) {
113 listener.onBeforeRemove(scFrameworkVersion);
114 }
115
116 scFrameworkVersion = removeImpl(scFrameworkVersion);
117
118 for (ModelListener listener : listeners) {
119 listener.onAfterRemove(scFrameworkVersion);
120 }
121
122 return scFrameworkVersion;
123 }
124
125 protected SCFrameworkVersion removeImpl(
126 SCFrameworkVersion scFrameworkVersion) throws SystemException {
127 try {
128 clearSCProductVersions.clear(scFrameworkVersion.getPrimaryKey());
129 }
130 catch (Exception e) {
131 throw processException(e);
132 }
133 finally {
134 FinderCacheUtil.clearCache("SCFrameworkVersi_SCProductVers");
135 }
136
137 Session session = null;
138
139 try {
140 session = openSession();
141
142 if (BatchSessionUtil.isEnabled()) {
143 Object staleObject = session.get(SCFrameworkVersionImpl.class,
144 scFrameworkVersion.getPrimaryKeyObj());
145
146 if (staleObject != null) {
147 session.evict(staleObject);
148 }
149 }
150
151 session.delete(scFrameworkVersion);
152
153 session.flush();
154
155 return scFrameworkVersion;
156 }
157 catch (Exception e) {
158 throw processException(e);
159 }
160 finally {
161 closeSession(session);
162
163 FinderCacheUtil.clearCache(SCFrameworkVersion.class.getName());
164 }
165 }
166
167
170 public SCFrameworkVersion update(SCFrameworkVersion scFrameworkVersion)
171 throws SystemException {
172 if (_log.isWarnEnabled()) {
173 _log.warn(
174 "Using the deprecated update(SCFrameworkVersion scFrameworkVersion) method. Use update(SCFrameworkVersion scFrameworkVersion, boolean merge) instead.");
175 }
176
177 return update(scFrameworkVersion, false);
178 }
179
180
193 public SCFrameworkVersion update(SCFrameworkVersion scFrameworkVersion,
194 boolean merge) throws SystemException {
195 boolean isNew = scFrameworkVersion.isNew();
196
197 for (ModelListener listener : listeners) {
198 if (isNew) {
199 listener.onBeforeCreate(scFrameworkVersion);
200 }
201 else {
202 listener.onBeforeUpdate(scFrameworkVersion);
203 }
204 }
205
206 scFrameworkVersion = updateImpl(scFrameworkVersion, merge);
207
208 for (ModelListener listener : listeners) {
209 if (isNew) {
210 listener.onAfterCreate(scFrameworkVersion);
211 }
212 else {
213 listener.onAfterUpdate(scFrameworkVersion);
214 }
215 }
216
217 return scFrameworkVersion;
218 }
219
220 public SCFrameworkVersion updateImpl(
221 com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion scFrameworkVersion,
222 boolean merge) throws SystemException {
223 FinderCacheUtil.clearCache("SCFrameworkVersi_SCProductVers");
224
225 Session session = null;
226
227 try {
228 session = openSession();
229
230 BatchSessionUtil.update(session, scFrameworkVersion, merge);
231
232 scFrameworkVersion.setNew(false);
233
234 return scFrameworkVersion;
235 }
236 catch (Exception e) {
237 throw processException(e);
238 }
239 finally {
240 closeSession(session);
241
242 FinderCacheUtil.clearCache(SCFrameworkVersion.class.getName());
243 }
244 }
245
246 public SCFrameworkVersion findByPrimaryKey(long frameworkVersionId)
247 throws NoSuchFrameworkVersionException, SystemException {
248 SCFrameworkVersion scFrameworkVersion = fetchByPrimaryKey(frameworkVersionId);
249
250 if (scFrameworkVersion == null) {
251 if (_log.isWarnEnabled()) {
252 _log.warn("No SCFrameworkVersion exists with the primary key " +
253 frameworkVersionId);
254 }
255
256 throw new NoSuchFrameworkVersionException(
257 "No SCFrameworkVersion exists with the primary key " +
258 frameworkVersionId);
259 }
260
261 return scFrameworkVersion;
262 }
263
264 public SCFrameworkVersion fetchByPrimaryKey(long frameworkVersionId)
265 throws SystemException {
266 Session session = null;
267
268 try {
269 session = openSession();
270
271 return (SCFrameworkVersion)session.get(SCFrameworkVersionImpl.class,
272 new Long(frameworkVersionId));
273 }
274 catch (Exception e) {
275 throw processException(e);
276 }
277 finally {
278 closeSession(session);
279 }
280 }
281
282 public List<SCFrameworkVersion> findByGroupId(long groupId)
283 throws SystemException {
284 boolean finderClassNameCacheEnabled = SCFrameworkVersionModelImpl.CACHE_ENABLED;
285 String finderClassName = SCFrameworkVersion.class.getName();
286 String finderMethodName = "findByGroupId";
287 String[] finderParams = new String[] { Long.class.getName() };
288 Object[] finderArgs = new Object[] { new Long(groupId) };
289
290 Object result = null;
291
292 if (finderClassNameCacheEnabled) {
293 result = FinderCacheUtil.getResult(finderClassName,
294 finderMethodName, finderParams, finderArgs, this);
295 }
296
297 if (result == null) {
298 Session session = null;
299
300 try {
301 session = openSession();
302
303 StringBuilder query = new StringBuilder();
304
305 query.append(
306 "FROM com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion WHERE ");
307
308 query.append("groupId = ?");
309
310 query.append(" ");
311
312 query.append("ORDER BY ");
313
314 query.append("name DESC");
315
316 Query q = session.createQuery(query.toString());
317
318 QueryPos qPos = QueryPos.getInstance(q);
319
320 qPos.add(groupId);
321
322 List<SCFrameworkVersion> list = q.list();
323
324 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
325 finderClassName, finderMethodName, finderParams,
326 finderArgs, list);
327
328 return list;
329 }
330 catch (Exception e) {
331 throw processException(e);
332 }
333 finally {
334 closeSession(session);
335 }
336 }
337 else {
338 return (List<SCFrameworkVersion>)result;
339 }
340 }
341
342 public List<SCFrameworkVersion> findByGroupId(long groupId, int start,
343 int end) throws SystemException {
344 return findByGroupId(groupId, start, end, null);
345 }
346
347 public List<SCFrameworkVersion> findByGroupId(long groupId, int start,
348 int end, OrderByComparator obc) throws SystemException {
349 boolean finderClassNameCacheEnabled = SCFrameworkVersionModelImpl.CACHE_ENABLED;
350 String finderClassName = SCFrameworkVersion.class.getName();
351 String finderMethodName = "findByGroupId";
352 String[] finderParams = new String[] {
353 Long.class.getName(),
354
355 "java.lang.Integer", "java.lang.Integer",
356 "com.liferay.portal.kernel.util.OrderByComparator"
357 };
358 Object[] finderArgs = new Object[] {
359 new Long(groupId),
360
361 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
362 };
363
364 Object result = null;
365
366 if (finderClassNameCacheEnabled) {
367 result = FinderCacheUtil.getResult(finderClassName,
368 finderMethodName, finderParams, finderArgs, this);
369 }
370
371 if (result == null) {
372 Session session = null;
373
374 try {
375 session = openSession();
376
377 StringBuilder query = new StringBuilder();
378
379 query.append(
380 "FROM com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion WHERE ");
381
382 query.append("groupId = ?");
383
384 query.append(" ");
385
386 if (obc != null) {
387 query.append("ORDER BY ");
388 query.append(obc.getOrderBy());
389 }
390
391 else {
392 query.append("ORDER BY ");
393
394 query.append("name DESC");
395 }
396
397 Query q = session.createQuery(query.toString());
398
399 QueryPos qPos = QueryPos.getInstance(q);
400
401 qPos.add(groupId);
402
403 List<SCFrameworkVersion> list = (List<SCFrameworkVersion>)QueryUtil.list(q,
404 getDialect(), start, end);
405
406 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
407 finderClassName, finderMethodName, finderParams,
408 finderArgs, list);
409
410 return list;
411 }
412 catch (Exception e) {
413 throw processException(e);
414 }
415 finally {
416 closeSession(session);
417 }
418 }
419 else {
420 return (List<SCFrameworkVersion>)result;
421 }
422 }
423
424 public SCFrameworkVersion findByGroupId_First(long groupId,
425 OrderByComparator obc)
426 throws NoSuchFrameworkVersionException, SystemException {
427 List<SCFrameworkVersion> list = findByGroupId(groupId, 0, 1, obc);
428
429 if (list.size() == 0) {
430 StringBuilder msg = new StringBuilder();
431
432 msg.append("No SCFrameworkVersion exists with the key {");
433
434 msg.append("groupId=" + groupId);
435
436 msg.append(StringPool.CLOSE_CURLY_BRACE);
437
438 throw new NoSuchFrameworkVersionException(msg.toString());
439 }
440 else {
441 return list.get(0);
442 }
443 }
444
445 public SCFrameworkVersion findByGroupId_Last(long groupId,
446 OrderByComparator obc)
447 throws NoSuchFrameworkVersionException, SystemException {
448 int count = countByGroupId(groupId);
449
450 List<SCFrameworkVersion> list = findByGroupId(groupId, count - 1,
451 count, obc);
452
453 if (list.size() == 0) {
454 StringBuilder msg = new StringBuilder();
455
456 msg.append("No SCFrameworkVersion exists with the key {");
457
458 msg.append("groupId=" + groupId);
459
460 msg.append(StringPool.CLOSE_CURLY_BRACE);
461
462 throw new NoSuchFrameworkVersionException(msg.toString());
463 }
464 else {
465 return list.get(0);
466 }
467 }
468
469 public SCFrameworkVersion[] findByGroupId_PrevAndNext(
470 long frameworkVersionId, long groupId, OrderByComparator obc)
471 throws NoSuchFrameworkVersionException, SystemException {
472 SCFrameworkVersion scFrameworkVersion = findByPrimaryKey(frameworkVersionId);
473
474 int count = countByGroupId(groupId);
475
476 Session session = null;
477
478 try {
479 session = openSession();
480
481 StringBuilder query = new StringBuilder();
482
483 query.append(
484 "FROM com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion WHERE ");
485
486 query.append("groupId = ?");
487
488 query.append(" ");
489
490 if (obc != null) {
491 query.append("ORDER BY ");
492 query.append(obc.getOrderBy());
493 }
494
495 else {
496 query.append("ORDER BY ");
497
498 query.append("name DESC");
499 }
500
501 Query q = session.createQuery(query.toString());
502
503 QueryPos qPos = QueryPos.getInstance(q);
504
505 qPos.add(groupId);
506
507 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
508 scFrameworkVersion);
509
510 SCFrameworkVersion[] array = new SCFrameworkVersionImpl[3];
511
512 array[0] = (SCFrameworkVersion)objArray[0];
513 array[1] = (SCFrameworkVersion)objArray[1];
514 array[2] = (SCFrameworkVersion)objArray[2];
515
516 return array;
517 }
518 catch (Exception e) {
519 throw processException(e);
520 }
521 finally {
522 closeSession(session);
523 }
524 }
525
526 public List<SCFrameworkVersion> findByCompanyId(long companyId)
527 throws SystemException {
528 boolean finderClassNameCacheEnabled = SCFrameworkVersionModelImpl.CACHE_ENABLED;
529 String finderClassName = SCFrameworkVersion.class.getName();
530 String finderMethodName = "findByCompanyId";
531 String[] finderParams = new String[] { Long.class.getName() };
532 Object[] finderArgs = new Object[] { new Long(companyId) };
533
534 Object result = null;
535
536 if (finderClassNameCacheEnabled) {
537 result = FinderCacheUtil.getResult(finderClassName,
538 finderMethodName, finderParams, finderArgs, this);
539 }
540
541 if (result == null) {
542 Session session = null;
543
544 try {
545 session = openSession();
546
547 StringBuilder query = new StringBuilder();
548
549 query.append(
550 "FROM com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion WHERE ");
551
552 query.append("companyId = ?");
553
554 query.append(" ");
555
556 query.append("ORDER BY ");
557
558 query.append("name DESC");
559
560 Query q = session.createQuery(query.toString());
561
562 QueryPos qPos = QueryPos.getInstance(q);
563
564 qPos.add(companyId);
565
566 List<SCFrameworkVersion> list = q.list();
567
568 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
569 finderClassName, finderMethodName, finderParams,
570 finderArgs, list);
571
572 return list;
573 }
574 catch (Exception e) {
575 throw processException(e);
576 }
577 finally {
578 closeSession(session);
579 }
580 }
581 else {
582 return (List<SCFrameworkVersion>)result;
583 }
584 }
585
586 public List<SCFrameworkVersion> findByCompanyId(long companyId, int start,
587 int end) throws SystemException {
588 return findByCompanyId(companyId, start, end, null);
589 }
590
591 public List<SCFrameworkVersion> findByCompanyId(long companyId, int start,
592 int end, OrderByComparator obc) throws SystemException {
593 boolean finderClassNameCacheEnabled = SCFrameworkVersionModelImpl.CACHE_ENABLED;
594 String finderClassName = SCFrameworkVersion.class.getName();
595 String finderMethodName = "findByCompanyId";
596 String[] finderParams = new String[] {
597 Long.class.getName(),
598
599 "java.lang.Integer", "java.lang.Integer",
600 "com.liferay.portal.kernel.util.OrderByComparator"
601 };
602 Object[] finderArgs = new Object[] {
603 new Long(companyId),
604
605 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
606 };
607
608 Object result = null;
609
610 if (finderClassNameCacheEnabled) {
611 result = FinderCacheUtil.getResult(finderClassName,
612 finderMethodName, finderParams, finderArgs, this);
613 }
614
615 if (result == null) {
616 Session session = null;
617
618 try {
619 session = openSession();
620
621 StringBuilder query = new StringBuilder();
622
623 query.append(
624 "FROM com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion WHERE ");
625
626 query.append("companyId = ?");
627
628 query.append(" ");
629
630 if (obc != null) {
631 query.append("ORDER BY ");
632 query.append(obc.getOrderBy());
633 }
634
635 else {
636 query.append("ORDER BY ");
637
638 query.append("name DESC");
639 }
640
641 Query q = session.createQuery(query.toString());
642
643 QueryPos qPos = QueryPos.getInstance(q);
644
645 qPos.add(companyId);
646
647 List<SCFrameworkVersion> list = (List<SCFrameworkVersion>)QueryUtil.list(q,
648 getDialect(), start, end);
649
650 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
651 finderClassName, finderMethodName, finderParams,
652 finderArgs, list);
653
654 return list;
655 }
656 catch (Exception e) {
657 throw processException(e);
658 }
659 finally {
660 closeSession(session);
661 }
662 }
663 else {
664 return (List<SCFrameworkVersion>)result;
665 }
666 }
667
668 public SCFrameworkVersion findByCompanyId_First(long companyId,
669 OrderByComparator obc)
670 throws NoSuchFrameworkVersionException, SystemException {
671 List<SCFrameworkVersion> list = findByCompanyId(companyId, 0, 1, obc);
672
673 if (list.size() == 0) {
674 StringBuilder msg = new StringBuilder();
675
676 msg.append("No SCFrameworkVersion exists with the key {");
677
678 msg.append("companyId=" + companyId);
679
680 msg.append(StringPool.CLOSE_CURLY_BRACE);
681
682 throw new NoSuchFrameworkVersionException(msg.toString());
683 }
684 else {
685 return list.get(0);
686 }
687 }
688
689 public SCFrameworkVersion findByCompanyId_Last(long companyId,
690 OrderByComparator obc)
691 throws NoSuchFrameworkVersionException, SystemException {
692 int count = countByCompanyId(companyId);
693
694 List<SCFrameworkVersion> list = findByCompanyId(companyId, count - 1,
695 count, obc);
696
697 if (list.size() == 0) {
698 StringBuilder msg = new StringBuilder();
699
700 msg.append("No SCFrameworkVersion exists with the key {");
701
702 msg.append("companyId=" + companyId);
703
704 msg.append(StringPool.CLOSE_CURLY_BRACE);
705
706 throw new NoSuchFrameworkVersionException(msg.toString());
707 }
708 else {
709 return list.get(0);
710 }
711 }
712
713 public SCFrameworkVersion[] findByCompanyId_PrevAndNext(
714 long frameworkVersionId, long companyId, OrderByComparator obc)
715 throws NoSuchFrameworkVersionException, SystemException {
716 SCFrameworkVersion scFrameworkVersion = findByPrimaryKey(frameworkVersionId);
717
718 int count = countByCompanyId(companyId);
719
720 Session session = null;
721
722 try {
723 session = openSession();
724
725 StringBuilder query = new StringBuilder();
726
727 query.append(
728 "FROM com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion WHERE ");
729
730 query.append("companyId = ?");
731
732 query.append(" ");
733
734 if (obc != null) {
735 query.append("ORDER BY ");
736 query.append(obc.getOrderBy());
737 }
738
739 else {
740 query.append("ORDER BY ");
741
742 query.append("name DESC");
743 }
744
745 Query q = session.createQuery(query.toString());
746
747 QueryPos qPos = QueryPos.getInstance(q);
748
749 qPos.add(companyId);
750
751 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
752 scFrameworkVersion);
753
754 SCFrameworkVersion[] array = new SCFrameworkVersionImpl[3];
755
756 array[0] = (SCFrameworkVersion)objArray[0];
757 array[1] = (SCFrameworkVersion)objArray[1];
758 array[2] = (SCFrameworkVersion)objArray[2];
759
760 return array;
761 }
762 catch (Exception e) {
763 throw processException(e);
764 }
765 finally {
766 closeSession(session);
767 }
768 }
769
770 public List<SCFrameworkVersion> findByG_A(long groupId, boolean active)
771 throws SystemException {
772 boolean finderClassNameCacheEnabled = SCFrameworkVersionModelImpl.CACHE_ENABLED;
773 String finderClassName = SCFrameworkVersion.class.getName();
774 String finderMethodName = "findByG_A";
775 String[] finderParams = new String[] {
776 Long.class.getName(), Boolean.class.getName()
777 };
778 Object[] finderArgs = new Object[] {
779 new Long(groupId), Boolean.valueOf(active)
780 };
781
782 Object result = null;
783
784 if (finderClassNameCacheEnabled) {
785 result = FinderCacheUtil.getResult(finderClassName,
786 finderMethodName, finderParams, finderArgs, this);
787 }
788
789 if (result == null) {
790 Session session = null;
791
792 try {
793 session = openSession();
794
795 StringBuilder query = new StringBuilder();
796
797 query.append(
798 "FROM com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion WHERE ");
799
800 query.append("groupId = ?");
801
802 query.append(" AND ");
803
804 query.append("active_ = ?");
805
806 query.append(" ");
807
808 query.append("ORDER BY ");
809
810 query.append("name DESC");
811
812 Query q = session.createQuery(query.toString());
813
814 QueryPos qPos = QueryPos.getInstance(q);
815
816 qPos.add(groupId);
817
818 qPos.add(active);
819
820 List<SCFrameworkVersion> list = q.list();
821
822 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
823 finderClassName, finderMethodName, finderParams,
824 finderArgs, list);
825
826 return list;
827 }
828 catch (Exception e) {
829 throw processException(e);
830 }
831 finally {
832 closeSession(session);
833 }
834 }
835 else {
836 return (List<SCFrameworkVersion>)result;
837 }
838 }
839
840 public List<SCFrameworkVersion> findByG_A(long groupId, boolean active,
841 int start, int end) throws SystemException {
842 return findByG_A(groupId, active, start, end, null);
843 }
844
845 public List<SCFrameworkVersion> findByG_A(long groupId, boolean active,
846 int start, int end, OrderByComparator obc) throws SystemException {
847 boolean finderClassNameCacheEnabled = SCFrameworkVersionModelImpl.CACHE_ENABLED;
848 String finderClassName = SCFrameworkVersion.class.getName();
849 String finderMethodName = "findByG_A";
850 String[] finderParams = new String[] {
851 Long.class.getName(), Boolean.class.getName(),
852
853 "java.lang.Integer", "java.lang.Integer",
854 "com.liferay.portal.kernel.util.OrderByComparator"
855 };
856 Object[] finderArgs = new Object[] {
857 new Long(groupId), Boolean.valueOf(active),
858
859 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
860 };
861
862 Object result = null;
863
864 if (finderClassNameCacheEnabled) {
865 result = FinderCacheUtil.getResult(finderClassName,
866 finderMethodName, finderParams, finderArgs, this);
867 }
868
869 if (result == null) {
870 Session session = null;
871
872 try {
873 session = openSession();
874
875 StringBuilder query = new StringBuilder();
876
877 query.append(
878 "FROM com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion WHERE ");
879
880 query.append("groupId = ?");
881
882 query.append(" AND ");
883
884 query.append("active_ = ?");
885
886 query.append(" ");
887
888 if (obc != null) {
889 query.append("ORDER BY ");
890 query.append(obc.getOrderBy());
891 }
892
893 else {
894 query.append("ORDER BY ");
895
896 query.append("name DESC");
897 }
898
899 Query q = session.createQuery(query.toString());
900
901 QueryPos qPos = QueryPos.getInstance(q);
902
903 qPos.add(groupId);
904
905 qPos.add(active);
906
907 List<SCFrameworkVersion> list = (List<SCFrameworkVersion>)QueryUtil.list(q,
908 getDialect(), start, end);
909
910 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
911 finderClassName, finderMethodName, finderParams,
912 finderArgs, list);
913
914 return list;
915 }
916 catch (Exception e) {
917 throw processException(e);
918 }
919 finally {
920 closeSession(session);
921 }
922 }
923 else {
924 return (List<SCFrameworkVersion>)result;
925 }
926 }
927
928 public SCFrameworkVersion findByG_A_First(long groupId, boolean active,
929 OrderByComparator obc)
930 throws NoSuchFrameworkVersionException, SystemException {
931 List<SCFrameworkVersion> list = findByG_A(groupId, active, 0, 1, obc);
932
933 if (list.size() == 0) {
934 StringBuilder msg = new StringBuilder();
935
936 msg.append("No SCFrameworkVersion exists with the key {");
937
938 msg.append("groupId=" + groupId);
939
940 msg.append(", ");
941 msg.append("active=" + active);
942
943 msg.append(StringPool.CLOSE_CURLY_BRACE);
944
945 throw new NoSuchFrameworkVersionException(msg.toString());
946 }
947 else {
948 return list.get(0);
949 }
950 }
951
952 public SCFrameworkVersion findByG_A_Last(long groupId, boolean active,
953 OrderByComparator obc)
954 throws NoSuchFrameworkVersionException, SystemException {
955 int count = countByG_A(groupId, active);
956
957 List<SCFrameworkVersion> list = findByG_A(groupId, active, count - 1,
958 count, obc);
959
960 if (list.size() == 0) {
961 StringBuilder msg = new StringBuilder();
962
963 msg.append("No SCFrameworkVersion exists with the key {");
964
965 msg.append("groupId=" + groupId);
966
967 msg.append(", ");
968 msg.append("active=" + active);
969
970 msg.append(StringPool.CLOSE_CURLY_BRACE);
971
972 throw new NoSuchFrameworkVersionException(msg.toString());
973 }
974 else {
975 return list.get(0);
976 }
977 }
978
979 public SCFrameworkVersion[] findByG_A_PrevAndNext(long frameworkVersionId,
980 long groupId, boolean active, OrderByComparator obc)
981 throws NoSuchFrameworkVersionException, SystemException {
982 SCFrameworkVersion scFrameworkVersion = findByPrimaryKey(frameworkVersionId);
983
984 int count = countByG_A(groupId, active);
985
986 Session session = null;
987
988 try {
989 session = openSession();
990
991 StringBuilder query = new StringBuilder();
992
993 query.append(
994 "FROM com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion WHERE ");
995
996 query.append("groupId = ?");
997
998 query.append(" AND ");
999
1000 query.append("active_ = ?");
1001
1002 query.append(" ");
1003
1004 if (obc != null) {
1005 query.append("ORDER BY ");
1006 query.append(obc.getOrderBy());
1007 }
1008
1009 else {
1010 query.append("ORDER BY ");
1011
1012 query.append("name DESC");
1013 }
1014
1015 Query q = session.createQuery(query.toString());
1016
1017 QueryPos qPos = QueryPos.getInstance(q);
1018
1019 qPos.add(groupId);
1020
1021 qPos.add(active);
1022
1023 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1024 scFrameworkVersion);
1025
1026 SCFrameworkVersion[] array = new SCFrameworkVersionImpl[3];
1027
1028 array[0] = (SCFrameworkVersion)objArray[0];
1029 array[1] = (SCFrameworkVersion)objArray[1];
1030 array[2] = (SCFrameworkVersion)objArray[2];
1031
1032 return array;
1033 }
1034 catch (Exception e) {
1035 throw processException(e);
1036 }
1037 finally {
1038 closeSession(session);
1039 }
1040 }
1041
1042 public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
1043 throws SystemException {
1044 Session session = null;
1045
1046 try {
1047 session = openSession();
1048
1049 dynamicQuery.compile(session);
1050
1051 return dynamicQuery.list();
1052 }
1053 catch (Exception e) {
1054 throw processException(e);
1055 }
1056 finally {
1057 closeSession(session);
1058 }
1059 }
1060
1061 public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
1062 int start, int end) throws SystemException {
1063 Session session = null;
1064
1065 try {
1066 session = openSession();
1067
1068 dynamicQuery.setLimit(start, end);
1069
1070 dynamicQuery.compile(session);
1071
1072 return dynamicQuery.list();
1073 }
1074 catch (Exception e) {
1075 throw processException(e);
1076 }
1077 finally {
1078 closeSession(session);
1079 }
1080 }
1081
1082 public List<SCFrameworkVersion> findAll() throws SystemException {
1083 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1084 }
1085
1086 public List<SCFrameworkVersion> findAll(int start, int end)
1087 throws SystemException {
1088 return findAll(start, end, null);
1089 }
1090
1091 public List<SCFrameworkVersion> findAll(int start, int end,
1092 OrderByComparator obc) throws SystemException {
1093 boolean finderClassNameCacheEnabled = SCFrameworkVersionModelImpl.CACHE_ENABLED;
1094 String finderClassName = SCFrameworkVersion.class.getName();
1095 String finderMethodName = "findAll";
1096 String[] finderParams = new String[] {
1097 "java.lang.Integer", "java.lang.Integer",
1098 "com.liferay.portal.kernel.util.OrderByComparator"
1099 };
1100 Object[] finderArgs = new Object[] {
1101 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1102 };
1103
1104 Object result = null;
1105
1106 if (finderClassNameCacheEnabled) {
1107 result = FinderCacheUtil.getResult(finderClassName,
1108 finderMethodName, finderParams, finderArgs, this);
1109 }
1110
1111 if (result == null) {
1112 Session session = null;
1113
1114 try {
1115 session = openSession();
1116
1117 StringBuilder query = new StringBuilder();
1118
1119 query.append(
1120 "FROM com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion ");
1121
1122 if (obc != null) {
1123 query.append("ORDER BY ");
1124 query.append(obc.getOrderBy());
1125 }
1126
1127 else {
1128 query.append("ORDER BY ");
1129
1130 query.append("name DESC");
1131 }
1132
1133 Query q = session.createQuery(query.toString());
1134
1135 List<SCFrameworkVersion> list = null;
1136
1137 if (obc == null) {
1138 list = (List<SCFrameworkVersion>)QueryUtil.list(q,
1139 getDialect(), start, end, false);
1140
1141 Collections.sort(list);
1142 }
1143 else {
1144 list = (List<SCFrameworkVersion>)QueryUtil.list(q,
1145 getDialect(), start, end);
1146 }
1147
1148 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1149 finderClassName, finderMethodName, finderParams,
1150 finderArgs, list);
1151
1152 return list;
1153 }
1154 catch (Exception e) {
1155 throw processException(e);
1156 }
1157 finally {
1158 closeSession(session);
1159 }
1160 }
1161 else {
1162 return (List<SCFrameworkVersion>)result;
1163 }
1164 }
1165
1166 public void removeByGroupId(long groupId) throws SystemException {
1167 for (SCFrameworkVersion scFrameworkVersion : findByGroupId(groupId)) {
1168 remove(scFrameworkVersion);
1169 }
1170 }
1171
1172 public void removeByCompanyId(long companyId) throws SystemException {
1173 for (SCFrameworkVersion scFrameworkVersion : findByCompanyId(companyId)) {
1174 remove(scFrameworkVersion);
1175 }
1176 }
1177
1178 public void removeByG_A(long groupId, boolean active)
1179 throws SystemException {
1180 for (SCFrameworkVersion scFrameworkVersion : findByG_A(groupId, active)) {
1181 remove(scFrameworkVersion);
1182 }
1183 }
1184
1185 public void removeAll() throws SystemException {
1186 for (SCFrameworkVersion scFrameworkVersion : findAll()) {
1187 remove(scFrameworkVersion);
1188 }
1189 }
1190
1191 public int countByGroupId(long groupId) throws SystemException {
1192 boolean finderClassNameCacheEnabled = SCFrameworkVersionModelImpl.CACHE_ENABLED;
1193 String finderClassName = SCFrameworkVersion.class.getName();
1194 String finderMethodName = "countByGroupId";
1195 String[] finderParams = new String[] { Long.class.getName() };
1196 Object[] finderArgs = new Object[] { new Long(groupId) };
1197
1198 Object result = null;
1199
1200 if (finderClassNameCacheEnabled) {
1201 result = FinderCacheUtil.getResult(finderClassName,
1202 finderMethodName, finderParams, finderArgs, this);
1203 }
1204
1205 if (result == null) {
1206 Session session = null;
1207
1208 try {
1209 session = openSession();
1210
1211 StringBuilder query = new StringBuilder();
1212
1213 query.append("SELECT COUNT(*) ");
1214 query.append(
1215 "FROM com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion WHERE ");
1216
1217 query.append("groupId = ?");
1218
1219 query.append(" ");
1220
1221 Query q = session.createQuery(query.toString());
1222
1223 QueryPos qPos = QueryPos.getInstance(q);
1224
1225 qPos.add(groupId);
1226
1227 Long count = null;
1228
1229 Iterator<Long> itr = q.list().iterator();
1230
1231 if (itr.hasNext()) {
1232 count = itr.next();
1233 }
1234
1235 if (count == null) {
1236 count = new Long(0);
1237 }
1238
1239 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1240 finderClassName, finderMethodName, finderParams,
1241 finderArgs, count);
1242
1243 return count.intValue();
1244 }
1245 catch (Exception e) {
1246 throw processException(e);
1247 }
1248 finally {
1249 closeSession(session);
1250 }
1251 }
1252 else {
1253 return ((Long)result).intValue();
1254 }
1255 }
1256
1257 public int countByCompanyId(long companyId) throws SystemException {
1258 boolean finderClassNameCacheEnabled = SCFrameworkVersionModelImpl.CACHE_ENABLED;
1259 String finderClassName = SCFrameworkVersion.class.getName();
1260 String finderMethodName = "countByCompanyId";
1261 String[] finderParams = new String[] { Long.class.getName() };
1262 Object[] finderArgs = new Object[] { new Long(companyId) };
1263
1264 Object result = null;
1265
1266 if (finderClassNameCacheEnabled) {
1267 result = FinderCacheUtil.getResult(finderClassName,
1268 finderMethodName, finderParams, finderArgs, this);
1269 }
1270
1271 if (result == null) {
1272 Session session = null;
1273
1274 try {
1275 session = openSession();
1276
1277 StringBuilder query = new StringBuilder();
1278
1279 query.append("SELECT COUNT(*) ");
1280 query.append(
1281 "FROM com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion WHERE ");
1282
1283 query.append("companyId = ?");
1284
1285 query.append(" ");
1286
1287 Query q = session.createQuery(query.toString());
1288
1289 QueryPos qPos = QueryPos.getInstance(q);
1290
1291 qPos.add(companyId);
1292
1293 Long count = null;
1294
1295 Iterator<Long> itr = q.list().iterator();
1296
1297 if (itr.hasNext()) {
1298 count = itr.next();
1299 }
1300
1301 if (count == null) {
1302 count = new Long(0);
1303 }
1304
1305 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1306 finderClassName, finderMethodName, finderParams,
1307 finderArgs, count);
1308
1309 return count.intValue();
1310 }
1311 catch (Exception e) {
1312 throw processException(e);
1313 }
1314 finally {
1315 closeSession(session);
1316 }
1317 }
1318 else {
1319 return ((Long)result).intValue();
1320 }
1321 }
1322
1323 public int countByG_A(long groupId, boolean active)
1324 throws SystemException {
1325 boolean finderClassNameCacheEnabled = SCFrameworkVersionModelImpl.CACHE_ENABLED;
1326 String finderClassName = SCFrameworkVersion.class.getName();
1327 String finderMethodName = "countByG_A";
1328 String[] finderParams = new String[] {
1329 Long.class.getName(), Boolean.class.getName()
1330 };
1331 Object[] finderArgs = new Object[] {
1332 new Long(groupId), Boolean.valueOf(active)
1333 };
1334
1335 Object result = null;
1336
1337 if (finderClassNameCacheEnabled) {
1338 result = FinderCacheUtil.getResult(finderClassName,
1339 finderMethodName, finderParams, finderArgs, this);
1340 }
1341
1342 if (result == null) {
1343 Session session = null;
1344
1345 try {
1346 session = openSession();
1347
1348 StringBuilder query = new StringBuilder();
1349
1350 query.append("SELECT COUNT(*) ");
1351 query.append(
1352 "FROM com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion WHERE ");
1353
1354 query.append("groupId = ?");
1355
1356 query.append(" AND ");
1357
1358 query.append("active_ = ?");
1359
1360 query.append(" ");
1361
1362 Query q = session.createQuery(query.toString());
1363
1364 QueryPos qPos = QueryPos.getInstance(q);
1365
1366 qPos.add(groupId);
1367
1368 qPos.add(active);
1369
1370 Long count = null;
1371
1372 Iterator<Long> itr = q.list().iterator();
1373
1374 if (itr.hasNext()) {
1375 count = itr.next();
1376 }
1377
1378 if (count == null) {
1379 count = new Long(0);
1380 }
1381
1382 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1383 finderClassName, finderMethodName, finderParams,
1384 finderArgs, count);
1385
1386 return count.intValue();
1387 }
1388 catch (Exception e) {
1389 throw processException(e);
1390 }
1391 finally {
1392 closeSession(session);
1393 }
1394 }
1395 else {
1396 return ((Long)result).intValue();
1397 }
1398 }
1399
1400 public int countAll() throws SystemException {
1401 boolean finderClassNameCacheEnabled = SCFrameworkVersionModelImpl.CACHE_ENABLED;
1402 String finderClassName = SCFrameworkVersion.class.getName();
1403 String finderMethodName = "countAll";
1404 String[] finderParams = new String[] { };
1405 Object[] finderArgs = new Object[] { };
1406
1407 Object result = null;
1408
1409 if (finderClassNameCacheEnabled) {
1410 result = FinderCacheUtil.getResult(finderClassName,
1411 finderMethodName, finderParams, finderArgs, this);
1412 }
1413
1414 if (result == null) {
1415 Session session = null;
1416
1417 try {
1418 session = openSession();
1419
1420 Query q = session.createQuery(
1421 "SELECT COUNT(*) FROM com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion");
1422
1423 Long count = null;
1424
1425 Iterator<Long> itr = q.list().iterator();
1426
1427 if (itr.hasNext()) {
1428 count = itr.next();
1429 }
1430
1431 if (count == null) {
1432 count = new Long(0);
1433 }
1434
1435 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1436 finderClassName, finderMethodName, finderParams,
1437 finderArgs, count);
1438
1439 return count.intValue();
1440 }
1441 catch (Exception e) {
1442 throw processException(e);
1443 }
1444 finally {
1445 closeSession(session);
1446 }
1447 }
1448 else {
1449 return ((Long)result).intValue();
1450 }
1451 }
1452
1453 public List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> getSCProductVersions(
1454 long pk) throws SystemException {
1455 return getSCProductVersions(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
1456 }
1457
1458 public List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> getSCProductVersions(
1459 long pk, int start, int end) throws SystemException {
1460 return getSCProductVersions(pk, start, end, null);
1461 }
1462
1463 public List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> getSCProductVersions(
1464 long pk, int start, int end, OrderByComparator obc)
1465 throws SystemException {
1466 boolean finderClassNameCacheEnabled = SCFrameworkVersionModelImpl.CACHE_ENABLED_SCFRAMEWORKVERSI_SCPRODUCTVERS;
1467
1468 String finderClassName = "SCFrameworkVersi_SCProductVers";
1469
1470 String finderMethodName = "getSCProductVersions";
1471 String[] finderParams = new String[] {
1472 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
1473 "com.liferay.portal.kernel.util.OrderByComparator"
1474 };
1475 Object[] finderArgs = new Object[] {
1476 new Long(pk), String.valueOf(start), String.valueOf(end),
1477 String.valueOf(obc)
1478 };
1479
1480 Object result = null;
1481
1482 if (finderClassNameCacheEnabled) {
1483 result = FinderCacheUtil.getResult(finderClassName,
1484 finderMethodName, finderParams, finderArgs, this);
1485 }
1486
1487 if (result == null) {
1488 Session session = null;
1489
1490 try {
1491 session = openSession();
1492
1493 StringBuilder sb = new StringBuilder();
1494
1495 sb.append(_SQL_GETSCPRODUCTVERSIONS);
1496
1497 if (obc != null) {
1498 sb.append("ORDER BY ");
1499 sb.append(obc.getOrderBy());
1500 }
1501
1502 else {
1503 sb.append("ORDER BY ");
1504
1505 sb.append("SCProductVersion.createDate DESC");
1506 }
1507
1508 String sql = sb.toString();
1509
1510 SQLQuery q = session.createSQLQuery(sql);
1511
1512 q.addEntity("SCProductVersion",
1513 com.liferay.portlet.softwarecatalog.model.impl.SCProductVersionImpl.class);
1514
1515 QueryPos qPos = QueryPos.getInstance(q);
1516
1517 qPos.add(pk);
1518
1519 List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> list =
1520 (List<com.liferay.portlet.softwarecatalog.model.SCProductVersion>)QueryUtil.list(q,
1521 getDialect(), start, end);
1522
1523 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1524 finderClassName, finderMethodName, finderParams,
1525 finderArgs, list);
1526
1527 return list;
1528 }
1529 catch (Exception e) {
1530 throw processException(e);
1531 }
1532 finally {
1533 closeSession(session);
1534 }
1535 }
1536 else {
1537 return (List<com.liferay.portlet.softwarecatalog.model.SCProductVersion>)result;
1538 }
1539 }
1540
1541 public int getSCProductVersionsSize(long pk) throws SystemException {
1542 boolean finderClassNameCacheEnabled = SCFrameworkVersionModelImpl.CACHE_ENABLED_SCFRAMEWORKVERSI_SCPRODUCTVERS;
1543
1544 String finderClassName = "SCFrameworkVersi_SCProductVers";
1545
1546 String finderMethodName = "getSCProductVersionsSize";
1547 String[] finderParams = new String[] { Long.class.getName() };
1548 Object[] finderArgs = new Object[] { new Long(pk) };
1549
1550 Object result = null;
1551
1552 if (finderClassNameCacheEnabled) {
1553 result = FinderCacheUtil.getResult(finderClassName,
1554 finderMethodName, finderParams, finderArgs, this);
1555 }
1556
1557 if (result == null) {
1558 Session session = null;
1559
1560 try {
1561 session = openSession();
1562
1563 SQLQuery q = session.createSQLQuery(_SQL_GETSCPRODUCTVERSIONSSIZE);
1564
1565 q.addScalar(COUNT_COLUMN_NAME, Type.LONG);
1566
1567 QueryPos qPos = QueryPos.getInstance(q);
1568
1569 qPos.add(pk);
1570
1571 Long count = null;
1572
1573 Iterator<Long> itr = q.list().iterator();
1574
1575 if (itr.hasNext()) {
1576 count = itr.next();
1577 }
1578
1579 if (count == null) {
1580 count = new Long(0);
1581 }
1582
1583 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1584 finderClassName, finderMethodName, finderParams,
1585 finderArgs, count);
1586
1587 return count.intValue();
1588 }
1589 catch (Exception e) {
1590 throw processException(e);
1591 }
1592 finally {
1593 closeSession(session);
1594 }
1595 }
1596 else {
1597 return ((Long)result).intValue();
1598 }
1599 }
1600
1601 public boolean containsSCProductVersion(long pk, long scProductVersionPK)
1602 throws SystemException {
1603 boolean finderClassNameCacheEnabled = SCFrameworkVersionModelImpl.CACHE_ENABLED_SCFRAMEWORKVERSI_SCPRODUCTVERS;
1604
1605 String finderClassName = "SCFrameworkVersi_SCProductVers";
1606
1607 String finderMethodName = "containsSCProductVersions";
1608 String[] finderParams = new String[] {
1609 Long.class.getName(),
1610
1611 Long.class.getName()
1612 };
1613 Object[] finderArgs = new Object[] {
1614 new Long(pk),
1615
1616 new Long(scProductVersionPK)
1617 };
1618
1619 Object result = null;
1620
1621 if (finderClassNameCacheEnabled) {
1622 result = FinderCacheUtil.getResult(finderClassName,
1623 finderMethodName, finderParams, finderArgs, this);
1624 }
1625
1626 if (result == null) {
1627 try {
1628 Boolean value = Boolean.valueOf(containsSCProductVersion.contains(
1629 pk, scProductVersionPK));
1630
1631 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1632 finderClassName, finderMethodName, finderParams,
1633 finderArgs, value);
1634
1635 return value.booleanValue();
1636 }
1637 catch (Exception e) {
1638 throw processException(e);
1639 }
1640 }
1641 else {
1642 return ((Boolean)result).booleanValue();
1643 }
1644 }
1645
1646 public boolean containsSCProductVersions(long pk) throws SystemException {
1647 if (getSCProductVersionsSize(pk) > 0) {
1648 return true;
1649 }
1650 else {
1651 return false;
1652 }
1653 }
1654
1655 public void addSCProductVersion(long pk, long scProductVersionPK)
1656 throws SystemException {
1657 try {
1658 addSCProductVersion.add(pk, scProductVersionPK);
1659 }
1660 catch (Exception e) {
1661 throw processException(e);
1662 }
1663 finally {
1664 FinderCacheUtil.clearCache("SCFrameworkVersi_SCProductVers");
1665 }
1666 }
1667
1668 public void addSCProductVersion(long pk,
1669 com.liferay.portlet.softwarecatalog.model.SCProductVersion scProductVersion)
1670 throws SystemException {
1671 try {
1672 addSCProductVersion.add(pk, scProductVersion.getPrimaryKey());
1673 }
1674 catch (Exception e) {
1675 throw processException(e);
1676 }
1677 finally {
1678 FinderCacheUtil.clearCache("SCFrameworkVersi_SCProductVers");
1679 }
1680 }
1681
1682 public void addSCProductVersions(long pk, long[] scProductVersionPKs)
1683 throws SystemException {
1684 try {
1685 for (long scProductVersionPK : scProductVersionPKs) {
1686 addSCProductVersion.add(pk, scProductVersionPK);
1687 }
1688 }
1689 catch (Exception e) {
1690 throw processException(e);
1691 }
1692 finally {
1693 FinderCacheUtil.clearCache("SCFrameworkVersi_SCProductVers");
1694 }
1695 }
1696
1697 public void addSCProductVersions(long pk,
1698 List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> scProductVersions)
1699 throws SystemException {
1700 try {
1701 for (com.liferay.portlet.softwarecatalog.model.SCProductVersion scProductVersion : scProductVersions) {
1702 addSCProductVersion.add(pk, scProductVersion.getPrimaryKey());
1703 }
1704 }
1705 catch (Exception e) {
1706 throw processException(e);
1707 }
1708 finally {
1709 FinderCacheUtil.clearCache("SCFrameworkVersi_SCProductVers");
1710 }
1711 }
1712
1713 public void clearSCProductVersions(long pk) throws SystemException {
1714 try {
1715 clearSCProductVersions.clear(pk);
1716 }
1717 catch (Exception e) {
1718 throw processException(e);
1719 }
1720 finally {
1721 FinderCacheUtil.clearCache("SCFrameworkVersi_SCProductVers");
1722 }
1723 }
1724
1725 public void removeSCProductVersion(long pk, long scProductVersionPK)
1726 throws SystemException {
1727 try {
1728 removeSCProductVersion.remove(pk, scProductVersionPK);
1729 }
1730 catch (Exception e) {
1731 throw processException(e);
1732 }
1733 finally {
1734 FinderCacheUtil.clearCache("SCFrameworkVersi_SCProductVers");
1735 }
1736 }
1737
1738 public void removeSCProductVersion(long pk,
1739 com.liferay.portlet.softwarecatalog.model.SCProductVersion scProductVersion)
1740 throws SystemException {
1741 try {
1742 removeSCProductVersion.remove(pk, scProductVersion.getPrimaryKey());
1743 }
1744 catch (Exception e) {
1745 throw processException(e);
1746 }
1747 finally {
1748 FinderCacheUtil.clearCache("SCFrameworkVersi_SCProductVers");
1749 }
1750 }
1751
1752 public void removeSCProductVersions(long pk, long[] scProductVersionPKs)
1753 throws SystemException {
1754 try {
1755 for (long scProductVersionPK : scProductVersionPKs) {
1756 removeSCProductVersion.remove(pk, scProductVersionPK);
1757 }
1758 }
1759 catch (Exception e) {
1760 throw processException(e);
1761 }
1762 finally {
1763 FinderCacheUtil.clearCache("SCFrameworkVersi_SCProductVers");
1764 }
1765 }
1766
1767 public void removeSCProductVersions(long pk,
1768 List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> scProductVersions)
1769 throws SystemException {
1770 try {
1771 for (com.liferay.portlet.softwarecatalog.model.SCProductVersion scProductVersion : scProductVersions) {
1772 removeSCProductVersion.remove(pk,
1773 scProductVersion.getPrimaryKey());
1774 }
1775 }
1776 catch (Exception e) {
1777 throw processException(e);
1778 }
1779 finally {
1780 FinderCacheUtil.clearCache("SCFrameworkVersi_SCProductVers");
1781 }
1782 }
1783
1784 public void setSCProductVersions(long pk, long[] scProductVersionPKs)
1785 throws SystemException {
1786 try {
1787 clearSCProductVersions.clear(pk);
1788
1789 for (long scProductVersionPK : scProductVersionPKs) {
1790 addSCProductVersion.add(pk, scProductVersionPK);
1791 }
1792 }
1793 catch (Exception e) {
1794 throw processException(e);
1795 }
1796 finally {
1797 FinderCacheUtil.clearCache("SCFrameworkVersi_SCProductVers");
1798 }
1799 }
1800
1801 public void setSCProductVersions(long pk,
1802 List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> scProductVersions)
1803 throws SystemException {
1804 try {
1805 clearSCProductVersions.clear(pk);
1806
1807 for (com.liferay.portlet.softwarecatalog.model.SCProductVersion scProductVersion : scProductVersions) {
1808 addSCProductVersion.add(pk, scProductVersion.getPrimaryKey());
1809 }
1810 }
1811 catch (Exception e) {
1812 throw processException(e);
1813 }
1814 finally {
1815 FinderCacheUtil.clearCache("SCFrameworkVersi_SCProductVers");
1816 }
1817 }
1818
1819 public void afterPropertiesSet() {
1820 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1821 com.liferay.portal.util.PropsUtil.get(
1822 "value.object.listener.com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion")));
1823
1824 if (listenerClassNames.length > 0) {
1825 try {
1826 List<ModelListener> listenersList = new ArrayList<ModelListener>();
1827
1828 for (String listenerClassName : listenerClassNames) {
1829 listenersList.add((ModelListener)Class.forName(
1830 listenerClassName).newInstance());
1831 }
1832
1833 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1834 }
1835 catch (Exception e) {
1836 _log.error(e);
1837 }
1838 }
1839
1840 containsSCProductVersion = new ContainsSCProductVersion(this);
1841
1842 addSCProductVersion = new AddSCProductVersion(this);
1843 clearSCProductVersions = new ClearSCProductVersions(this);
1844 removeSCProductVersion = new RemoveSCProductVersion(this);
1845 }
1846
1847 protected ContainsSCProductVersion containsSCProductVersion;
1848 protected AddSCProductVersion addSCProductVersion;
1849 protected ClearSCProductVersions clearSCProductVersions;
1850 protected RemoveSCProductVersion removeSCProductVersion;
1851
1852 protected class ContainsSCProductVersion {
1853 protected ContainsSCProductVersion(
1854 SCFrameworkVersionPersistenceImpl persistenceImpl) {
1855 super();
1856
1857 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
1858 _SQL_CONTAINSSCPRODUCTVERSION,
1859 new int[] { Types.BIGINT, Types.BIGINT }, RowMapper.COUNT);
1860 }
1861
1862 protected boolean contains(long frameworkVersionId,
1863 long productVersionId) {
1864 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
1865 new Long(frameworkVersionId), new Long(productVersionId)
1866 });
1867
1868 if (results.size() > 0) {
1869 Integer count = results.get(0);
1870
1871 if (count.intValue() > 0) {
1872 return true;
1873 }
1874 }
1875
1876 return false;
1877 }
1878
1879 private MappingSqlQuery _mappingSqlQuery;
1880 }
1881
1882 protected class AddSCProductVersion {
1883 protected AddSCProductVersion(
1884 SCFrameworkVersionPersistenceImpl persistenceImpl) {
1885 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
1886 "INSERT INTO SCFrameworkVersi_SCProductVers (frameworkVersionId, productVersionId) VALUES (?, ?)",
1887 new int[] { Types.BIGINT, Types.BIGINT });
1888 _persistenceImpl = persistenceImpl;
1889 }
1890
1891 protected void add(long frameworkVersionId, long productVersionId) {
1892 if (!_persistenceImpl.containsSCProductVersion.contains(
1893 frameworkVersionId, productVersionId)) {
1894 _sqlUpdate.update(new Object[] {
1895 new Long(frameworkVersionId), new Long(productVersionId)
1896 });
1897 }
1898 }
1899
1900 private SqlUpdate _sqlUpdate;
1901 private SCFrameworkVersionPersistenceImpl _persistenceImpl;
1902 }
1903
1904 protected class ClearSCProductVersions {
1905 protected ClearSCProductVersions(
1906 SCFrameworkVersionPersistenceImpl persistenceImpl) {
1907 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
1908 "DELETE FROM SCFrameworkVersi_SCProductVers WHERE frameworkVersionId = ?",
1909 new int[] { Types.BIGINT });
1910 }
1911
1912 protected void clear(long frameworkVersionId) {
1913 _sqlUpdate.update(new Object[] { new Long(frameworkVersionId) });
1914 }
1915
1916 private SqlUpdate _sqlUpdate;
1917 }
1918
1919 protected class RemoveSCProductVersion {
1920 protected RemoveSCProductVersion(
1921 SCFrameworkVersionPersistenceImpl persistenceImpl) {
1922 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
1923 "DELETE FROM SCFrameworkVersi_SCProductVers WHERE frameworkVersionId = ? AND productVersionId = ?",
1924 new int[] { Types.BIGINT, Types.BIGINT });
1925 }
1926
1927 protected void remove(long frameworkVersionId, long productVersionId) {
1928 _sqlUpdate.update(new Object[] {
1929 new Long(frameworkVersionId), new Long(productVersionId)
1930 });
1931 }
1932
1933 private SqlUpdate _sqlUpdate;
1934 }
1935
1936 private static final String _SQL_GETSCPRODUCTVERSIONS = "SELECT {SCProductVersion.*} FROM SCProductVersion INNER JOIN SCFrameworkVersi_SCProductVers ON (SCFrameworkVersi_SCProductVers.productVersionId = SCProductVersion.productVersionId) WHERE (SCFrameworkVersi_SCProductVers.frameworkVersionId = ?)";
1937 private static final String _SQL_GETSCPRODUCTVERSIONSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM SCFrameworkVersi_SCProductVers WHERE frameworkVersionId = ?";
1938 private static final String _SQL_CONTAINSSCPRODUCTVERSION = "SELECT COUNT(*) AS COUNT_VALUE FROM SCFrameworkVersi_SCProductVers WHERE frameworkVersionId = ? AND productVersionId = ?";
1939 private static Log _log = LogFactoryUtil.getLog(SCFrameworkVersionPersistenceImpl.class);
1940}