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