1
22
23 package com.liferay.portal.service.persistence;
24
25 import com.liferay.portal.NoSuchGroupException;
26 import com.liferay.portal.SystemException;
27 import com.liferay.portal.kernel.annotation.BeanReference;
28 import com.liferay.portal.kernel.cache.CacheRegistry;
29 import com.liferay.portal.kernel.dao.jdbc.MappingSqlQuery;
30 import com.liferay.portal.kernel.dao.jdbc.MappingSqlQueryFactoryUtil;
31 import com.liferay.portal.kernel.dao.jdbc.RowMapper;
32 import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
33 import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
34 import com.liferay.portal.kernel.dao.orm.DynamicQuery;
35 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
36 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
37 import com.liferay.portal.kernel.dao.orm.FinderPath;
38 import com.liferay.portal.kernel.dao.orm.Query;
39 import com.liferay.portal.kernel.dao.orm.QueryPos;
40 import com.liferay.portal.kernel.dao.orm.QueryUtil;
41 import com.liferay.portal.kernel.dao.orm.SQLQuery;
42 import com.liferay.portal.kernel.dao.orm.Session;
43 import com.liferay.portal.kernel.dao.orm.Type;
44 import com.liferay.portal.kernel.log.Log;
45 import com.liferay.portal.kernel.log.LogFactoryUtil;
46 import com.liferay.portal.kernel.util.GetterUtil;
47 import com.liferay.portal.kernel.util.OrderByComparator;
48 import com.liferay.portal.kernel.util.StringPool;
49 import com.liferay.portal.kernel.util.StringUtil;
50 import com.liferay.portal.model.Group;
51 import com.liferay.portal.model.ModelListener;
52 import com.liferay.portal.model.impl.GroupImpl;
53 import com.liferay.portal.model.impl.GroupModelImpl;
54 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
55
56 import java.sql.Types;
57
58 import java.util.ArrayList;
59 import java.util.Collections;
60 import java.util.List;
61
62
68 public class GroupPersistenceImpl extends BasePersistenceImpl
69 implements GroupPersistence {
70 public static final String FINDER_CLASS_NAME_ENTITY = GroupImpl.class.getName();
71 public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
72 ".List";
73 public static final FinderPath FINDER_PATH_FETCH_BY_LIVEGROUPID = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
74 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
75 "fetchByLiveGroupId", new String[] { Long.class.getName() });
76 public static final FinderPath FINDER_PATH_COUNT_BY_LIVEGROUPID = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
77 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
78 "countByLiveGroupId", new String[] { Long.class.getName() });
79 public static final FinderPath FINDER_PATH_FETCH_BY_C_N = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
80 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
81 "fetchByC_N",
82 new String[] { Long.class.getName(), String.class.getName() });
83 public static final FinderPath FINDER_PATH_COUNT_BY_C_N = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
84 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
85 "countByC_N",
86 new String[] { Long.class.getName(), String.class.getName() });
87 public static final FinderPath FINDER_PATH_FETCH_BY_C_F = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
88 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
89 "fetchByC_F",
90 new String[] { Long.class.getName(), String.class.getName() });
91 public static final FinderPath FINDER_PATH_COUNT_BY_C_F = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
92 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
93 "countByC_F",
94 new String[] { Long.class.getName(), String.class.getName() });
95 public static final FinderPath FINDER_PATH_FIND_BY_T_A = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
96 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
97 "findByT_A",
98 new String[] { Integer.class.getName(), Boolean.class.getName() });
99 public static final FinderPath FINDER_PATH_FIND_BY_OBC_T_A = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
100 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
101 "findByT_A",
102 new String[] {
103 Integer.class.getName(), Boolean.class.getName(),
104
105 "java.lang.Integer", "java.lang.Integer",
106 "com.liferay.portal.kernel.util.OrderByComparator"
107 });
108 public static final FinderPath FINDER_PATH_COUNT_BY_T_A = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
109 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
110 "countByT_A",
111 new String[] { Integer.class.getName(), Boolean.class.getName() });
112 public static final FinderPath FINDER_PATH_FETCH_BY_C_C_C = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
113 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
114 "fetchByC_C_C",
115 new String[] {
116 Long.class.getName(), Long.class.getName(), Long.class.getName()
117 });
118 public static final FinderPath FINDER_PATH_COUNT_BY_C_C_C = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
119 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
120 "countByC_C_C",
121 new String[] {
122 Long.class.getName(), Long.class.getName(), Long.class.getName()
123 });
124 public static final FinderPath FINDER_PATH_FETCH_BY_C_L_N = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
125 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
126 "fetchByC_L_N",
127 new String[] {
128 Long.class.getName(), Long.class.getName(),
129 String.class.getName()
130 });
131 public static final FinderPath FINDER_PATH_COUNT_BY_C_L_N = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
132 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
133 "countByC_L_N",
134 new String[] {
135 Long.class.getName(), Long.class.getName(),
136 String.class.getName()
137 });
138 public static final FinderPath FINDER_PATH_FETCH_BY_C_C_L_N = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
139 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
140 "fetchByC_C_L_N",
141 new String[] {
142 Long.class.getName(), Long.class.getName(), Long.class.getName(),
143 String.class.getName()
144 });
145 public static final FinderPath FINDER_PATH_COUNT_BY_C_C_L_N = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
146 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
147 "countByC_C_L_N",
148 new String[] {
149 Long.class.getName(), Long.class.getName(), Long.class.getName(),
150 String.class.getName()
151 });
152 public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
153 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
154 "findAll", new String[0]);
155 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
156 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
157 "countAll", new String[0]);
158
159 public void cacheResult(Group group) {
160 EntityCacheUtil.putResult(GroupModelImpl.ENTITY_CACHE_ENABLED,
161 GroupImpl.class, group.getPrimaryKey(), group);
162
163 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LIVEGROUPID,
164 new Object[] { new Long(group.getLiveGroupId()) }, group);
165
166 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_N,
167 new Object[] { new Long(group.getCompanyId()), group.getName() },
168 group);
169
170 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_F,
171 new Object[] { new Long(group.getCompanyId()), group.getFriendlyURL() },
172 group);
173
174 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C_C,
175 new Object[] {
176 new Long(group.getCompanyId()), new Long(group.getClassNameId()),
177 new Long(group.getClassPK())
178 }, group);
179
180 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_L_N,
181 new Object[] {
182 new Long(group.getCompanyId()), new Long(group.getLiveGroupId()),
183
184 group.getName()
185 }, group);
186
187 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C_L_N,
188 new Object[] {
189 new Long(group.getCompanyId()), new Long(group.getClassNameId()),
190 new Long(group.getLiveGroupId()),
191
192 group.getName()
193 }, group);
194 }
195
196 public void cacheResult(List<Group> groups) {
197 for (Group group : groups) {
198 if (EntityCacheUtil.getResult(GroupModelImpl.ENTITY_CACHE_ENABLED,
199 GroupImpl.class, group.getPrimaryKey(), this) == null) {
200 cacheResult(group);
201 }
202 }
203 }
204
205 public void clearCache() {
206 CacheRegistry.clear(GroupImpl.class.getName());
207 EntityCacheUtil.clearCache(GroupImpl.class.getName());
208 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
209 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
210 }
211
212 public Group create(long groupId) {
213 Group group = new GroupImpl();
214
215 group.setNew(true);
216 group.setPrimaryKey(groupId);
217
218 return group;
219 }
220
221 public Group remove(long groupId)
222 throws NoSuchGroupException, SystemException {
223 Session session = null;
224
225 try {
226 session = openSession();
227
228 Group group = (Group)session.get(GroupImpl.class, new Long(groupId));
229
230 if (group == null) {
231 if (_log.isWarnEnabled()) {
232 _log.warn("No Group exists with the primary key " +
233 groupId);
234 }
235
236 throw new NoSuchGroupException(
237 "No Group exists with the primary key " + groupId);
238 }
239
240 return remove(group);
241 }
242 catch (NoSuchGroupException nsee) {
243 throw nsee;
244 }
245 catch (Exception e) {
246 throw processException(e);
247 }
248 finally {
249 closeSession(session);
250 }
251 }
252
253 public Group remove(Group group) throws SystemException {
254 for (ModelListener<Group> listener : listeners) {
255 listener.onBeforeRemove(group);
256 }
257
258 group = removeImpl(group);
259
260 for (ModelListener<Group> listener : listeners) {
261 listener.onAfterRemove(group);
262 }
263
264 return group;
265 }
266
267 protected Group removeImpl(Group group) throws SystemException {
268 try {
269 clearOrganizations.clear(group.getPrimaryKey());
270 }
271 catch (Exception e) {
272 throw processException(e);
273 }
274 finally {
275 FinderCacheUtil.clearCache("Groups_Orgs");
276 }
277
278 try {
279 clearPermissions.clear(group.getPrimaryKey());
280 }
281 catch (Exception e) {
282 throw processException(e);
283 }
284 finally {
285 FinderCacheUtil.clearCache("Groups_Permissions");
286 }
287
288 try {
289 clearRoles.clear(group.getPrimaryKey());
290 }
291 catch (Exception e) {
292 throw processException(e);
293 }
294 finally {
295 FinderCacheUtil.clearCache("Groups_Roles");
296 }
297
298 try {
299 clearUserGroups.clear(group.getPrimaryKey());
300 }
301 catch (Exception e) {
302 throw processException(e);
303 }
304 finally {
305 FinderCacheUtil.clearCache("Groups_UserGroups");
306 }
307
308 try {
309 clearUsers.clear(group.getPrimaryKey());
310 }
311 catch (Exception e) {
312 throw processException(e);
313 }
314 finally {
315 FinderCacheUtil.clearCache("Users_Groups");
316 }
317
318 Session session = null;
319
320 try {
321 session = openSession();
322
323 if (group.isCachedModel() || BatchSessionUtil.isEnabled()) {
324 Object staleObject = session.get(GroupImpl.class,
325 group.getPrimaryKeyObj());
326
327 if (staleObject != null) {
328 session.evict(staleObject);
329 }
330 }
331
332 session.delete(group);
333
334 session.flush();
335 }
336 catch (Exception e) {
337 throw processException(e);
338 }
339 finally {
340 closeSession(session);
341 }
342
343 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
344
345 GroupModelImpl groupModelImpl = (GroupModelImpl)group;
346
347 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_LIVEGROUPID,
348 new Object[] { new Long(groupModelImpl.getOriginalLiveGroupId()) });
349
350 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_N,
351 new Object[] {
352 new Long(groupModelImpl.getOriginalCompanyId()),
353
354 groupModelImpl.getOriginalName()
355 });
356
357 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_F,
358 new Object[] {
359 new Long(groupModelImpl.getOriginalCompanyId()),
360
361 groupModelImpl.getOriginalFriendlyURL()
362 });
363
364 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C_C,
365 new Object[] {
366 new Long(groupModelImpl.getOriginalCompanyId()),
367 new Long(groupModelImpl.getOriginalClassNameId()),
368 new Long(groupModelImpl.getOriginalClassPK())
369 });
370
371 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_L_N,
372 new Object[] {
373 new Long(groupModelImpl.getOriginalCompanyId()),
374 new Long(groupModelImpl.getOriginalLiveGroupId()),
375
376 groupModelImpl.getOriginalName()
377 });
378
379 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C_L_N,
380 new Object[] {
381 new Long(groupModelImpl.getOriginalCompanyId()),
382 new Long(groupModelImpl.getOriginalClassNameId()),
383 new Long(groupModelImpl.getOriginalLiveGroupId()),
384
385 groupModelImpl.getOriginalName()
386 });
387
388 EntityCacheUtil.removeResult(GroupModelImpl.ENTITY_CACHE_ENABLED,
389 GroupImpl.class, group.getPrimaryKey());
390
391 return group;
392 }
393
394
397 public Group update(Group group) throws SystemException {
398 if (_log.isWarnEnabled()) {
399 _log.warn(
400 "Using the deprecated update(Group group) method. Use update(Group group, boolean merge) instead.");
401 }
402
403 return update(group, false);
404 }
405
406
419 public Group update(Group group, boolean merge) throws SystemException {
420 boolean isNew = group.isNew();
421
422 for (ModelListener<Group> listener : listeners) {
423 if (isNew) {
424 listener.onBeforeCreate(group);
425 }
426 else {
427 listener.onBeforeUpdate(group);
428 }
429 }
430
431 group = updateImpl(group, merge);
432
433 for (ModelListener<Group> listener : listeners) {
434 if (isNew) {
435 listener.onAfterCreate(group);
436 }
437 else {
438 listener.onAfterUpdate(group);
439 }
440 }
441
442 return group;
443 }
444
445 public Group updateImpl(com.liferay.portal.model.Group group, boolean merge)
446 throws SystemException {
447 boolean isNew = group.isNew();
448
449 GroupModelImpl groupModelImpl = (GroupModelImpl)group;
450
451 Session session = null;
452
453 try {
454 session = openSession();
455
456 BatchSessionUtil.update(session, group, merge);
457
458 group.setNew(false);
459 }
460 catch (Exception e) {
461 throw processException(e);
462 }
463 finally {
464 closeSession(session);
465 }
466
467 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
468
469 EntityCacheUtil.putResult(GroupModelImpl.ENTITY_CACHE_ENABLED,
470 GroupImpl.class, group.getPrimaryKey(), group);
471
472 if (!isNew &&
473 (group.getLiveGroupId() != groupModelImpl.getOriginalLiveGroupId())) {
474 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_LIVEGROUPID,
475 new Object[] { new Long(groupModelImpl.getOriginalLiveGroupId()) });
476 }
477
478 if (isNew ||
479 (group.getLiveGroupId() != groupModelImpl.getOriginalLiveGroupId())) {
480 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LIVEGROUPID,
481 new Object[] { new Long(group.getLiveGroupId()) }, group);
482 }
483
484 if (!isNew &&
485 ((group.getCompanyId() != groupModelImpl.getOriginalCompanyId()) ||
486 !group.getName().equals(groupModelImpl.getOriginalName()))) {
487 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_N,
488 new Object[] {
489 new Long(groupModelImpl.getOriginalCompanyId()),
490
491 groupModelImpl.getOriginalName()
492 });
493 }
494
495 if (isNew ||
496 ((group.getCompanyId() != groupModelImpl.getOriginalCompanyId()) ||
497 !group.getName().equals(groupModelImpl.getOriginalName()))) {
498 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_N,
499 new Object[] { new Long(group.getCompanyId()), group.getName() },
500 group);
501 }
502
503 if (!isNew &&
504 ((group.getCompanyId() != groupModelImpl.getOriginalCompanyId()) ||
505 !group.getFriendlyURL()
506 .equals(groupModelImpl.getOriginalFriendlyURL()))) {
507 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_F,
508 new Object[] {
509 new Long(groupModelImpl.getOriginalCompanyId()),
510
511 groupModelImpl.getOriginalFriendlyURL()
512 });
513 }
514
515 if (isNew ||
516 ((group.getCompanyId() != groupModelImpl.getOriginalCompanyId()) ||
517 !group.getFriendlyURL()
518 .equals(groupModelImpl.getOriginalFriendlyURL()))) {
519 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_F,
520 new Object[] {
521 new Long(group.getCompanyId()),
522
523 group.getFriendlyURL()
524 }, group);
525 }
526
527 if (!isNew &&
528 ((group.getCompanyId() != groupModelImpl.getOriginalCompanyId()) ||
529 (group.getClassNameId() != groupModelImpl.getOriginalClassNameId()) ||
530 (group.getClassPK() != groupModelImpl.getOriginalClassPK()))) {
531 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C_C,
532 new Object[] {
533 new Long(groupModelImpl.getOriginalCompanyId()),
534 new Long(groupModelImpl.getOriginalClassNameId()),
535 new Long(groupModelImpl.getOriginalClassPK())
536 });
537 }
538
539 if (isNew ||
540 ((group.getCompanyId() != groupModelImpl.getOriginalCompanyId()) ||
541 (group.getClassNameId() != groupModelImpl.getOriginalClassNameId()) ||
542 (group.getClassPK() != groupModelImpl.getOriginalClassPK()))) {
543 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C_C,
544 new Object[] {
545 new Long(group.getCompanyId()),
546 new Long(group.getClassNameId()),
547 new Long(group.getClassPK())
548 }, group);
549 }
550
551 if (!isNew &&
552 ((group.getCompanyId() != groupModelImpl.getOriginalCompanyId()) ||
553 (group.getLiveGroupId() != groupModelImpl.getOriginalLiveGroupId()) ||
554 !group.getName().equals(groupModelImpl.getOriginalName()))) {
555 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_L_N,
556 new Object[] {
557 new Long(groupModelImpl.getOriginalCompanyId()),
558 new Long(groupModelImpl.getOriginalLiveGroupId()),
559
560 groupModelImpl.getOriginalName()
561 });
562 }
563
564 if (isNew ||
565 ((group.getCompanyId() != groupModelImpl.getOriginalCompanyId()) ||
566 (group.getLiveGroupId() != groupModelImpl.getOriginalLiveGroupId()) ||
567 !group.getName().equals(groupModelImpl.getOriginalName()))) {
568 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_L_N,
569 new Object[] {
570 new Long(group.getCompanyId()),
571 new Long(group.getLiveGroupId()),
572
573 group.getName()
574 }, group);
575 }
576
577 if (!isNew &&
578 ((group.getCompanyId() != groupModelImpl.getOriginalCompanyId()) ||
579 (group.getClassNameId() != groupModelImpl.getOriginalClassNameId()) ||
580 (group.getLiveGroupId() != groupModelImpl.getOriginalLiveGroupId()) ||
581 !group.getName().equals(groupModelImpl.getOriginalName()))) {
582 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C_L_N,
583 new Object[] {
584 new Long(groupModelImpl.getOriginalCompanyId()),
585 new Long(groupModelImpl.getOriginalClassNameId()),
586 new Long(groupModelImpl.getOriginalLiveGroupId()),
587
588 groupModelImpl.getOriginalName()
589 });
590 }
591
592 if (isNew ||
593 ((group.getCompanyId() != groupModelImpl.getOriginalCompanyId()) ||
594 (group.getClassNameId() != groupModelImpl.getOriginalClassNameId()) ||
595 (group.getLiveGroupId() != groupModelImpl.getOriginalLiveGroupId()) ||
596 !group.getName().equals(groupModelImpl.getOriginalName()))) {
597 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C_L_N,
598 new Object[] {
599 new Long(group.getCompanyId()),
600 new Long(group.getClassNameId()),
601 new Long(group.getLiveGroupId()),
602
603 group.getName()
604 }, group);
605 }
606
607 return group;
608 }
609
610 public Group findByPrimaryKey(long groupId)
611 throws NoSuchGroupException, SystemException {
612 Group group = fetchByPrimaryKey(groupId);
613
614 if (group == null) {
615 if (_log.isWarnEnabled()) {
616 _log.warn("No Group exists with the primary key " + groupId);
617 }
618
619 throw new NoSuchGroupException(
620 "No Group exists with the primary key " + groupId);
621 }
622
623 return group;
624 }
625
626 public Group fetchByPrimaryKey(long groupId) throws SystemException {
627 Group group = (Group)EntityCacheUtil.getResult(GroupModelImpl.ENTITY_CACHE_ENABLED,
628 GroupImpl.class, groupId, this);
629
630 if (group == null) {
631 Session session = null;
632
633 try {
634 session = openSession();
635
636 group = (Group)session.get(GroupImpl.class, new Long(groupId));
637 }
638 catch (Exception e) {
639 throw processException(e);
640 }
641 finally {
642 if (group != null) {
643 cacheResult(group);
644 }
645
646 closeSession(session);
647 }
648 }
649
650 return group;
651 }
652
653 public Group findByLiveGroupId(long liveGroupId)
654 throws NoSuchGroupException, SystemException {
655 Group group = fetchByLiveGroupId(liveGroupId);
656
657 if (group == null) {
658 StringBuilder msg = new StringBuilder();
659
660 msg.append("No Group exists with the key {");
661
662 msg.append("liveGroupId=" + liveGroupId);
663
664 msg.append(StringPool.CLOSE_CURLY_BRACE);
665
666 if (_log.isWarnEnabled()) {
667 _log.warn(msg.toString());
668 }
669
670 throw new NoSuchGroupException(msg.toString());
671 }
672
673 return group;
674 }
675
676 public Group fetchByLiveGroupId(long liveGroupId) throws SystemException {
677 return fetchByLiveGroupId(liveGroupId, true);
678 }
679
680 public Group fetchByLiveGroupId(long liveGroupId, boolean retrieveFromCache)
681 throws SystemException {
682 Object[] finderArgs = new Object[] { new Long(liveGroupId) };
683
684 Object result = null;
685
686 if (retrieveFromCache) {
687 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_LIVEGROUPID,
688 finderArgs, this);
689 }
690
691 if (result == null) {
692 Session session = null;
693
694 try {
695 session = openSession();
696
697 StringBuilder query = new StringBuilder();
698
699 query.append("FROM com.liferay.portal.model.Group WHERE ");
700
701 query.append("liveGroupId = ?");
702
703 query.append(" ");
704
705 query.append("ORDER BY ");
706
707 query.append("name ASC");
708
709 Query q = session.createQuery(query.toString());
710
711 QueryPos qPos = QueryPos.getInstance(q);
712
713 qPos.add(liveGroupId);
714
715 List<Group> list = q.list();
716
717 result = list;
718
719 Group group = null;
720
721 if (list.isEmpty()) {
722 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LIVEGROUPID,
723 finderArgs, list);
724 }
725 else {
726 group = list.get(0);
727
728 cacheResult(group);
729
730 if ((group.getLiveGroupId() != liveGroupId)) {
731 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LIVEGROUPID,
732 finderArgs, list);
733 }
734 }
735
736 return group;
737 }
738 catch (Exception e) {
739 throw processException(e);
740 }
741 finally {
742 if (result == null) {
743 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LIVEGROUPID,
744 finderArgs, new ArrayList<Group>());
745 }
746
747 closeSession(session);
748 }
749 }
750 else {
751 if (result instanceof List) {
752 return null;
753 }
754 else {
755 return (Group)result;
756 }
757 }
758 }
759
760 public Group findByC_N(long companyId, String name)
761 throws NoSuchGroupException, SystemException {
762 Group group = fetchByC_N(companyId, name);
763
764 if (group == null) {
765 StringBuilder msg = new StringBuilder();
766
767 msg.append("No Group exists with the key {");
768
769 msg.append("companyId=" + companyId);
770
771 msg.append(", ");
772 msg.append("name=" + name);
773
774 msg.append(StringPool.CLOSE_CURLY_BRACE);
775
776 if (_log.isWarnEnabled()) {
777 _log.warn(msg.toString());
778 }
779
780 throw new NoSuchGroupException(msg.toString());
781 }
782
783 return group;
784 }
785
786 public Group fetchByC_N(long companyId, String name)
787 throws SystemException {
788 return fetchByC_N(companyId, name, true);
789 }
790
791 public Group fetchByC_N(long companyId, String name,
792 boolean retrieveFromCache) throws SystemException {
793 Object[] finderArgs = new Object[] { new Long(companyId), name };
794
795 Object result = null;
796
797 if (retrieveFromCache) {
798 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_N,
799 finderArgs, this);
800 }
801
802 if (result == null) {
803 Session session = null;
804
805 try {
806 session = openSession();
807
808 StringBuilder query = new StringBuilder();
809
810 query.append("FROM com.liferay.portal.model.Group WHERE ");
811
812 query.append("companyId = ?");
813
814 query.append(" AND ");
815
816 if (name == null) {
817 query.append("name IS NULL");
818 }
819 else {
820 query.append("name = ?");
821 }
822
823 query.append(" ");
824
825 query.append("ORDER BY ");
826
827 query.append("name ASC");
828
829 Query q = session.createQuery(query.toString());
830
831 QueryPos qPos = QueryPos.getInstance(q);
832
833 qPos.add(companyId);
834
835 if (name != null) {
836 qPos.add(name);
837 }
838
839 List<Group> list = q.list();
840
841 result = list;
842
843 Group group = null;
844
845 if (list.isEmpty()) {
846 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_N,
847 finderArgs, list);
848 }
849 else {
850 group = list.get(0);
851
852 cacheResult(group);
853
854 if ((group.getCompanyId() != companyId) ||
855 (group.getName() == null) ||
856 !group.getName().equals(name)) {
857 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_N,
858 finderArgs, list);
859 }
860 }
861
862 return group;
863 }
864 catch (Exception e) {
865 throw processException(e);
866 }
867 finally {
868 if (result == null) {
869 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_N,
870 finderArgs, new ArrayList<Group>());
871 }
872
873 closeSession(session);
874 }
875 }
876 else {
877 if (result instanceof List) {
878 return null;
879 }
880 else {
881 return (Group)result;
882 }
883 }
884 }
885
886 public Group findByC_F(long companyId, String friendlyURL)
887 throws NoSuchGroupException, SystemException {
888 Group group = fetchByC_F(companyId, friendlyURL);
889
890 if (group == null) {
891 StringBuilder msg = new StringBuilder();
892
893 msg.append("No Group exists with the key {");
894
895 msg.append("companyId=" + companyId);
896
897 msg.append(", ");
898 msg.append("friendlyURL=" + friendlyURL);
899
900 msg.append(StringPool.CLOSE_CURLY_BRACE);
901
902 if (_log.isWarnEnabled()) {
903 _log.warn(msg.toString());
904 }
905
906 throw new NoSuchGroupException(msg.toString());
907 }
908
909 return group;
910 }
911
912 public Group fetchByC_F(long companyId, String friendlyURL)
913 throws SystemException {
914 return fetchByC_F(companyId, friendlyURL, true);
915 }
916
917 public Group fetchByC_F(long companyId, String friendlyURL,
918 boolean retrieveFromCache) throws SystemException {
919 Object[] finderArgs = new Object[] { new Long(companyId), friendlyURL };
920
921 Object result = null;
922
923 if (retrieveFromCache) {
924 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_F,
925 finderArgs, this);
926 }
927
928 if (result == null) {
929 Session session = null;
930
931 try {
932 session = openSession();
933
934 StringBuilder query = new StringBuilder();
935
936 query.append("FROM com.liferay.portal.model.Group WHERE ");
937
938 query.append("companyId = ?");
939
940 query.append(" AND ");
941
942 if (friendlyURL == null) {
943 query.append("friendlyURL IS NULL");
944 }
945 else {
946 query.append("friendlyURL = ?");
947 }
948
949 query.append(" ");
950
951 query.append("ORDER BY ");
952
953 query.append("name ASC");
954
955 Query q = session.createQuery(query.toString());
956
957 QueryPos qPos = QueryPos.getInstance(q);
958
959 qPos.add(companyId);
960
961 if (friendlyURL != null) {
962 qPos.add(friendlyURL);
963 }
964
965 List<Group> list = q.list();
966
967 result = list;
968
969 Group group = null;
970
971 if (list.isEmpty()) {
972 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_F,
973 finderArgs, list);
974 }
975 else {
976 group = list.get(0);
977
978 cacheResult(group);
979
980 if ((group.getCompanyId() != companyId) ||
981 (group.getFriendlyURL() == null) ||
982 !group.getFriendlyURL().equals(friendlyURL)) {
983 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_F,
984 finderArgs, list);
985 }
986 }
987
988 return group;
989 }
990 catch (Exception e) {
991 throw processException(e);
992 }
993 finally {
994 if (result == null) {
995 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_F,
996 finderArgs, new ArrayList<Group>());
997 }
998
999 closeSession(session);
1000 }
1001 }
1002 else {
1003 if (result instanceof List) {
1004 return null;
1005 }
1006 else {
1007 return (Group)result;
1008 }
1009 }
1010 }
1011
1012 public List<Group> findByT_A(int type, boolean active)
1013 throws SystemException {
1014 Object[] finderArgs = new Object[] {
1015 new Integer(type), Boolean.valueOf(active)
1016 };
1017
1018 List<Group> list = (List<Group>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_T_A,
1019 finderArgs, this);
1020
1021 if (list == null) {
1022 Session session = null;
1023
1024 try {
1025 session = openSession();
1026
1027 StringBuilder query = new StringBuilder();
1028
1029 query.append("FROM com.liferay.portal.model.Group WHERE ");
1030
1031 query.append("type_ = ?");
1032
1033 query.append(" AND ");
1034
1035 query.append("active_ = ?");
1036
1037 query.append(" ");
1038
1039 query.append("ORDER BY ");
1040
1041 query.append("name ASC");
1042
1043 Query q = session.createQuery(query.toString());
1044
1045 QueryPos qPos = QueryPos.getInstance(q);
1046
1047 qPos.add(type);
1048
1049 qPos.add(active);
1050
1051 list = q.list();
1052 }
1053 catch (Exception e) {
1054 throw processException(e);
1055 }
1056 finally {
1057 if (list == null) {
1058 list = new ArrayList<Group>();
1059 }
1060
1061 cacheResult(list);
1062
1063 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_T_A, finderArgs,
1064 list);
1065
1066 closeSession(session);
1067 }
1068 }
1069
1070 return list;
1071 }
1072
1073 public List<Group> findByT_A(int type, boolean active, int start, int end)
1074 throws SystemException {
1075 return findByT_A(type, active, start, end, null);
1076 }
1077
1078 public List<Group> findByT_A(int type, boolean active, int start, int end,
1079 OrderByComparator obc) throws SystemException {
1080 Object[] finderArgs = new Object[] {
1081 new Integer(type), Boolean.valueOf(active),
1082
1083 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1084 };
1085
1086 List<Group> list = (List<Group>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_T_A,
1087 finderArgs, this);
1088
1089 if (list == null) {
1090 Session session = null;
1091
1092 try {
1093 session = openSession();
1094
1095 StringBuilder query = new StringBuilder();
1096
1097 query.append("FROM com.liferay.portal.model.Group WHERE ");
1098
1099 query.append("type_ = ?");
1100
1101 query.append(" AND ");
1102
1103 query.append("active_ = ?");
1104
1105 query.append(" ");
1106
1107 if (obc != null) {
1108 query.append("ORDER BY ");
1109 query.append(obc.getOrderBy());
1110 }
1111
1112 else {
1113 query.append("ORDER BY ");
1114
1115 query.append("name ASC");
1116 }
1117
1118 Query q = session.createQuery(query.toString());
1119
1120 QueryPos qPos = QueryPos.getInstance(q);
1121
1122 qPos.add(type);
1123
1124 qPos.add(active);
1125
1126 list = (List<Group>)QueryUtil.list(q, getDialect(), start, end);
1127 }
1128 catch (Exception e) {
1129 throw processException(e);
1130 }
1131 finally {
1132 if (list == null) {
1133 list = new ArrayList<Group>();
1134 }
1135
1136 cacheResult(list);
1137
1138 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_T_A,
1139 finderArgs, list);
1140
1141 closeSession(session);
1142 }
1143 }
1144
1145 return list;
1146 }
1147
1148 public Group findByT_A_First(int type, boolean active, OrderByComparator obc)
1149 throws NoSuchGroupException, SystemException {
1150 List<Group> list = findByT_A(type, active, 0, 1, obc);
1151
1152 if (list.isEmpty()) {
1153 StringBuilder msg = new StringBuilder();
1154
1155 msg.append("No Group exists with the key {");
1156
1157 msg.append("type=" + type);
1158
1159 msg.append(", ");
1160 msg.append("active=" + active);
1161
1162 msg.append(StringPool.CLOSE_CURLY_BRACE);
1163
1164 throw new NoSuchGroupException(msg.toString());
1165 }
1166 else {
1167 return list.get(0);
1168 }
1169 }
1170
1171 public Group findByT_A_Last(int type, boolean active, OrderByComparator obc)
1172 throws NoSuchGroupException, SystemException {
1173 int count = countByT_A(type, active);
1174
1175 List<Group> list = findByT_A(type, active, count - 1, count, obc);
1176
1177 if (list.isEmpty()) {
1178 StringBuilder msg = new StringBuilder();
1179
1180 msg.append("No Group exists with the key {");
1181
1182 msg.append("type=" + type);
1183
1184 msg.append(", ");
1185 msg.append("active=" + active);
1186
1187 msg.append(StringPool.CLOSE_CURLY_BRACE);
1188
1189 throw new NoSuchGroupException(msg.toString());
1190 }
1191 else {
1192 return list.get(0);
1193 }
1194 }
1195
1196 public Group[] findByT_A_PrevAndNext(long groupId, int type,
1197 boolean active, OrderByComparator obc)
1198 throws NoSuchGroupException, SystemException {
1199 Group group = findByPrimaryKey(groupId);
1200
1201 int count = countByT_A(type, active);
1202
1203 Session session = null;
1204
1205 try {
1206 session = openSession();
1207
1208 StringBuilder query = new StringBuilder();
1209
1210 query.append("FROM com.liferay.portal.model.Group WHERE ");
1211
1212 query.append("type_ = ?");
1213
1214 query.append(" AND ");
1215
1216 query.append("active_ = ?");
1217
1218 query.append(" ");
1219
1220 if (obc != null) {
1221 query.append("ORDER BY ");
1222 query.append(obc.getOrderBy());
1223 }
1224
1225 else {
1226 query.append("ORDER BY ");
1227
1228 query.append("name ASC");
1229 }
1230
1231 Query q = session.createQuery(query.toString());
1232
1233 QueryPos qPos = QueryPos.getInstance(q);
1234
1235 qPos.add(type);
1236
1237 qPos.add(active);
1238
1239 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, group);
1240
1241 Group[] array = new GroupImpl[3];
1242
1243 array[0] = (Group)objArray[0];
1244 array[1] = (Group)objArray[1];
1245 array[2] = (Group)objArray[2];
1246
1247 return array;
1248 }
1249 catch (Exception e) {
1250 throw processException(e);
1251 }
1252 finally {
1253 closeSession(session);
1254 }
1255 }
1256
1257 public Group findByC_C_C(long companyId, long classNameId, long classPK)
1258 throws NoSuchGroupException, SystemException {
1259 Group group = fetchByC_C_C(companyId, classNameId, classPK);
1260
1261 if (group == null) {
1262 StringBuilder msg = new StringBuilder();
1263
1264 msg.append("No Group exists with the key {");
1265
1266 msg.append("companyId=" + companyId);
1267
1268 msg.append(", ");
1269 msg.append("classNameId=" + classNameId);
1270
1271 msg.append(", ");
1272 msg.append("classPK=" + classPK);
1273
1274 msg.append(StringPool.CLOSE_CURLY_BRACE);
1275
1276 if (_log.isWarnEnabled()) {
1277 _log.warn(msg.toString());
1278 }
1279
1280 throw new NoSuchGroupException(msg.toString());
1281 }
1282
1283 return group;
1284 }
1285
1286 public Group fetchByC_C_C(long companyId, long classNameId, long classPK)
1287 throws SystemException {
1288 return fetchByC_C_C(companyId, classNameId, classPK, true);
1289 }
1290
1291 public Group fetchByC_C_C(long companyId, long classNameId, long classPK,
1292 boolean retrieveFromCache) throws SystemException {
1293 Object[] finderArgs = new Object[] {
1294 new Long(companyId), new Long(classNameId), new Long(classPK)
1295 };
1296
1297 Object result = null;
1298
1299 if (retrieveFromCache) {
1300 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_C_C,
1301 finderArgs, this);
1302 }
1303
1304 if (result == null) {
1305 Session session = null;
1306
1307 try {
1308 session = openSession();
1309
1310 StringBuilder query = new StringBuilder();
1311
1312 query.append("FROM com.liferay.portal.model.Group WHERE ");
1313
1314 query.append("companyId = ?");
1315
1316 query.append(" AND ");
1317
1318 query.append("classNameId = ?");
1319
1320 query.append(" AND ");
1321
1322 query.append("classPK = ?");
1323
1324 query.append(" ");
1325
1326 query.append("ORDER BY ");
1327
1328 query.append("name ASC");
1329
1330 Query q = session.createQuery(query.toString());
1331
1332 QueryPos qPos = QueryPos.getInstance(q);
1333
1334 qPos.add(companyId);
1335
1336 qPos.add(classNameId);
1337
1338 qPos.add(classPK);
1339
1340 List<Group> list = q.list();
1341
1342 result = list;
1343
1344 Group group = null;
1345
1346 if (list.isEmpty()) {
1347 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C_C,
1348 finderArgs, list);
1349 }
1350 else {
1351 group = list.get(0);
1352
1353 cacheResult(group);
1354
1355 if ((group.getCompanyId() != companyId) ||
1356 (group.getClassNameId() != classNameId) ||
1357 (group.getClassPK() != classPK)) {
1358 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C_C,
1359 finderArgs, list);
1360 }
1361 }
1362
1363 return group;
1364 }
1365 catch (Exception e) {
1366 throw processException(e);
1367 }
1368 finally {
1369 if (result == null) {
1370 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C_C,
1371 finderArgs, new ArrayList<Group>());
1372 }
1373
1374 closeSession(session);
1375 }
1376 }
1377 else {
1378 if (result instanceof List) {
1379 return null;
1380 }
1381 else {
1382 return (Group)result;
1383 }
1384 }
1385 }
1386
1387 public Group findByC_L_N(long companyId, long liveGroupId, String name)
1388 throws NoSuchGroupException, SystemException {
1389 Group group = fetchByC_L_N(companyId, liveGroupId, name);
1390
1391 if (group == null) {
1392 StringBuilder msg = new StringBuilder();
1393
1394 msg.append("No Group exists with the key {");
1395
1396 msg.append("companyId=" + companyId);
1397
1398 msg.append(", ");
1399 msg.append("liveGroupId=" + liveGroupId);
1400
1401 msg.append(", ");
1402 msg.append("name=" + name);
1403
1404 msg.append(StringPool.CLOSE_CURLY_BRACE);
1405
1406 if (_log.isWarnEnabled()) {
1407 _log.warn(msg.toString());
1408 }
1409
1410 throw new NoSuchGroupException(msg.toString());
1411 }
1412
1413 return group;
1414 }
1415
1416 public Group fetchByC_L_N(long companyId, long liveGroupId, String name)
1417 throws SystemException {
1418 return fetchByC_L_N(companyId, liveGroupId, name, true);
1419 }
1420
1421 public Group fetchByC_L_N(long companyId, long liveGroupId, String name,
1422 boolean retrieveFromCache) throws SystemException {
1423 Object[] finderArgs = new Object[] {
1424 new Long(companyId), new Long(liveGroupId),
1425
1426 name
1427 };
1428
1429 Object result = null;
1430
1431 if (retrieveFromCache) {
1432 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_L_N,
1433 finderArgs, this);
1434 }
1435
1436 if (result == null) {
1437 Session session = null;
1438
1439 try {
1440 session = openSession();
1441
1442 StringBuilder query = new StringBuilder();
1443
1444 query.append("FROM com.liferay.portal.model.Group WHERE ");
1445
1446 query.append("companyId = ?");
1447
1448 query.append(" AND ");
1449
1450 query.append("liveGroupId = ?");
1451
1452 query.append(" AND ");
1453
1454 if (name == null) {
1455 query.append("name IS NULL");
1456 }
1457 else {
1458 query.append("name = ?");
1459 }
1460
1461 query.append(" ");
1462
1463 query.append("ORDER BY ");
1464
1465 query.append("name ASC");
1466
1467 Query q = session.createQuery(query.toString());
1468
1469 QueryPos qPos = QueryPos.getInstance(q);
1470
1471 qPos.add(companyId);
1472
1473 qPos.add(liveGroupId);
1474
1475 if (name != null) {
1476 qPos.add(name);
1477 }
1478
1479 List<Group> list = q.list();
1480
1481 result = list;
1482
1483 Group group = null;
1484
1485 if (list.isEmpty()) {
1486 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_L_N,
1487 finderArgs, list);
1488 }
1489 else {
1490 group = list.get(0);
1491
1492 cacheResult(group);
1493
1494 if ((group.getCompanyId() != companyId) ||
1495 (group.getLiveGroupId() != liveGroupId) ||
1496 (group.getName() == null) ||
1497 !group.getName().equals(name)) {
1498 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_L_N,
1499 finderArgs, list);
1500 }
1501 }
1502
1503 return group;
1504 }
1505 catch (Exception e) {
1506 throw processException(e);
1507 }
1508 finally {
1509 if (result == null) {
1510 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_L_N,
1511 finderArgs, new ArrayList<Group>());
1512 }
1513
1514 closeSession(session);
1515 }
1516 }
1517 else {
1518 if (result instanceof List) {
1519 return null;
1520 }
1521 else {
1522 return (Group)result;
1523 }
1524 }
1525 }
1526
1527 public Group findByC_C_L_N(long companyId, long classNameId,
1528 long liveGroupId, String name)
1529 throws NoSuchGroupException, SystemException {
1530 Group group = fetchByC_C_L_N(companyId, classNameId, liveGroupId, name);
1531
1532 if (group == null) {
1533 StringBuilder msg = new StringBuilder();
1534
1535 msg.append("No Group exists with the key {");
1536
1537 msg.append("companyId=" + companyId);
1538
1539 msg.append(", ");
1540 msg.append("classNameId=" + classNameId);
1541
1542 msg.append(", ");
1543 msg.append("liveGroupId=" + liveGroupId);
1544
1545 msg.append(", ");
1546 msg.append("name=" + name);
1547
1548 msg.append(StringPool.CLOSE_CURLY_BRACE);
1549
1550 if (_log.isWarnEnabled()) {
1551 _log.warn(msg.toString());
1552 }
1553
1554 throw new NoSuchGroupException(msg.toString());
1555 }
1556
1557 return group;
1558 }
1559
1560 public Group fetchByC_C_L_N(long companyId, long classNameId,
1561 long liveGroupId, String name) throws SystemException {
1562 return fetchByC_C_L_N(companyId, classNameId, liveGroupId, name, true);
1563 }
1564
1565 public Group fetchByC_C_L_N(long companyId, long classNameId,
1566 long liveGroupId, String name, boolean retrieveFromCache)
1567 throws SystemException {
1568 Object[] finderArgs = new Object[] {
1569 new Long(companyId), new Long(classNameId),
1570 new Long(liveGroupId),
1571
1572 name
1573 };
1574
1575 Object result = null;
1576
1577 if (retrieveFromCache) {
1578 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_C_L_N,
1579 finderArgs, this);
1580 }
1581
1582 if (result == null) {
1583 Session session = null;
1584
1585 try {
1586 session = openSession();
1587
1588 StringBuilder query = new StringBuilder();
1589
1590 query.append("FROM com.liferay.portal.model.Group WHERE ");
1591
1592 query.append("companyId = ?");
1593
1594 query.append(" AND ");
1595
1596 query.append("classNameId = ?");
1597
1598 query.append(" AND ");
1599
1600 query.append("liveGroupId = ?");
1601
1602 query.append(" AND ");
1603
1604 if (name == null) {
1605 query.append("name IS NULL");
1606 }
1607 else {
1608 query.append("name = ?");
1609 }
1610
1611 query.append(" ");
1612
1613 query.append("ORDER BY ");
1614
1615 query.append("name ASC");
1616
1617 Query q = session.createQuery(query.toString());
1618
1619 QueryPos qPos = QueryPos.getInstance(q);
1620
1621 qPos.add(companyId);
1622
1623 qPos.add(classNameId);
1624
1625 qPos.add(liveGroupId);
1626
1627 if (name != null) {
1628 qPos.add(name);
1629 }
1630
1631 List<Group> list = q.list();
1632
1633 result = list;
1634
1635 Group group = null;
1636
1637 if (list.isEmpty()) {
1638 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C_L_N,
1639 finderArgs, list);
1640 }
1641 else {
1642 group = list.get(0);
1643
1644 cacheResult(group);
1645
1646 if ((group.getCompanyId() != companyId) ||
1647 (group.getClassNameId() != classNameId) ||
1648 (group.getLiveGroupId() != liveGroupId) ||
1649 (group.getName() == null) ||
1650 !group.getName().equals(name)) {
1651 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C_L_N,
1652 finderArgs, list);
1653 }
1654 }
1655
1656 return group;
1657 }
1658 catch (Exception e) {
1659 throw processException(e);
1660 }
1661 finally {
1662 if (result == null) {
1663 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C_L_N,
1664 finderArgs, new ArrayList<Group>());
1665 }
1666
1667 closeSession(session);
1668 }
1669 }
1670 else {
1671 if (result instanceof List) {
1672 return null;
1673 }
1674 else {
1675 return (Group)result;
1676 }
1677 }
1678 }
1679
1680 public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
1681 throws SystemException {
1682 Session session = null;
1683
1684 try {
1685 session = openSession();
1686
1687 dynamicQuery.compile(session);
1688
1689 return dynamicQuery.list();
1690 }
1691 catch (Exception e) {
1692 throw processException(e);
1693 }
1694 finally {
1695 closeSession(session);
1696 }
1697 }
1698
1699 public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
1700 int start, int end) throws SystemException {
1701 Session session = null;
1702
1703 try {
1704 session = openSession();
1705
1706 dynamicQuery.setLimit(start, end);
1707
1708 dynamicQuery.compile(session);
1709
1710 return dynamicQuery.list();
1711 }
1712 catch (Exception e) {
1713 throw processException(e);
1714 }
1715 finally {
1716 closeSession(session);
1717 }
1718 }
1719
1720 public List<Group> findAll() throws SystemException {
1721 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1722 }
1723
1724 public List<Group> findAll(int start, int end) throws SystemException {
1725 return findAll(start, end, null);
1726 }
1727
1728 public List<Group> findAll(int start, int end, OrderByComparator obc)
1729 throws SystemException {
1730 Object[] finderArgs = new Object[] {
1731 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1732 };
1733
1734 List<Group> list = (List<Group>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
1735 finderArgs, this);
1736
1737 if (list == null) {
1738 Session session = null;
1739
1740 try {
1741 session = openSession();
1742
1743 StringBuilder query = new StringBuilder();
1744
1745 query.append("FROM com.liferay.portal.model.Group ");
1746
1747 if (obc != null) {
1748 query.append("ORDER BY ");
1749 query.append(obc.getOrderBy());
1750 }
1751
1752 else {
1753 query.append("ORDER BY ");
1754
1755 query.append("name ASC");
1756 }
1757
1758 Query q = session.createQuery(query.toString());
1759
1760 if (obc == null) {
1761 list = (List<Group>)QueryUtil.list(q, getDialect(), start,
1762 end, false);
1763
1764 Collections.sort(list);
1765 }
1766 else {
1767 list = (List<Group>)QueryUtil.list(q, getDialect(), start,
1768 end);
1769 }
1770 }
1771 catch (Exception e) {
1772 throw processException(e);
1773 }
1774 finally {
1775 if (list == null) {
1776 list = new ArrayList<Group>();
1777 }
1778
1779 cacheResult(list);
1780
1781 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
1782
1783 closeSession(session);
1784 }
1785 }
1786
1787 return list;
1788 }
1789
1790 public void removeByLiveGroupId(long liveGroupId)
1791 throws NoSuchGroupException, SystemException {
1792 Group group = findByLiveGroupId(liveGroupId);
1793
1794 remove(group);
1795 }
1796
1797 public void removeByC_N(long companyId, String name)
1798 throws NoSuchGroupException, SystemException {
1799 Group group = findByC_N(companyId, name);
1800
1801 remove(group);
1802 }
1803
1804 public void removeByC_F(long companyId, String friendlyURL)
1805 throws NoSuchGroupException, SystemException {
1806 Group group = findByC_F(companyId, friendlyURL);
1807
1808 remove(group);
1809 }
1810
1811 public void removeByT_A(int type, boolean active) throws SystemException {
1812 for (Group group : findByT_A(type, active)) {
1813 remove(group);
1814 }
1815 }
1816
1817 public void removeByC_C_C(long companyId, long classNameId, long classPK)
1818 throws NoSuchGroupException, SystemException {
1819 Group group = findByC_C_C(companyId, classNameId, classPK);
1820
1821 remove(group);
1822 }
1823
1824 public void removeByC_L_N(long companyId, long liveGroupId, String name)
1825 throws NoSuchGroupException, SystemException {
1826 Group group = findByC_L_N(companyId, liveGroupId, name);
1827
1828 remove(group);
1829 }
1830
1831 public void removeByC_C_L_N(long companyId, long classNameId,
1832 long liveGroupId, String name)
1833 throws NoSuchGroupException, SystemException {
1834 Group group = findByC_C_L_N(companyId, classNameId, liveGroupId, name);
1835
1836 remove(group);
1837 }
1838
1839 public void removeAll() throws SystemException {
1840 for (Group group : findAll()) {
1841 remove(group);
1842 }
1843 }
1844
1845 public int countByLiveGroupId(long liveGroupId) throws SystemException {
1846 Object[] finderArgs = new Object[] { new Long(liveGroupId) };
1847
1848 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_LIVEGROUPID,
1849 finderArgs, this);
1850
1851 if (count == null) {
1852 Session session = null;
1853
1854 try {
1855 session = openSession();
1856
1857 StringBuilder query = new StringBuilder();
1858
1859 query.append("SELECT COUNT(*) ");
1860 query.append("FROM com.liferay.portal.model.Group WHERE ");
1861
1862 query.append("liveGroupId = ?");
1863
1864 query.append(" ");
1865
1866 Query q = session.createQuery(query.toString());
1867
1868 QueryPos qPos = QueryPos.getInstance(q);
1869
1870 qPos.add(liveGroupId);
1871
1872 count = (Long)q.uniqueResult();
1873 }
1874 catch (Exception e) {
1875 throw processException(e);
1876 }
1877 finally {
1878 if (count == null) {
1879 count = Long.valueOf(0);
1880 }
1881
1882 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_LIVEGROUPID,
1883 finderArgs, count);
1884
1885 closeSession(session);
1886 }
1887 }
1888
1889 return count.intValue();
1890 }
1891
1892 public int countByC_N(long companyId, String name)
1893 throws SystemException {
1894 Object[] finderArgs = new Object[] { new Long(companyId), name };
1895
1896 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_N,
1897 finderArgs, this);
1898
1899 if (count == null) {
1900 Session session = null;
1901
1902 try {
1903 session = openSession();
1904
1905 StringBuilder query = new StringBuilder();
1906
1907 query.append("SELECT COUNT(*) ");
1908 query.append("FROM com.liferay.portal.model.Group WHERE ");
1909
1910 query.append("companyId = ?");
1911
1912 query.append(" AND ");
1913
1914 if (name == null) {
1915 query.append("name IS NULL");
1916 }
1917 else {
1918 query.append("name = ?");
1919 }
1920
1921 query.append(" ");
1922
1923 Query q = session.createQuery(query.toString());
1924
1925 QueryPos qPos = QueryPos.getInstance(q);
1926
1927 qPos.add(companyId);
1928
1929 if (name != null) {
1930 qPos.add(name);
1931 }
1932
1933 count = (Long)q.uniqueResult();
1934 }
1935 catch (Exception e) {
1936 throw processException(e);
1937 }
1938 finally {
1939 if (count == null) {
1940 count = Long.valueOf(0);
1941 }
1942
1943 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_N, finderArgs,
1944 count);
1945
1946 closeSession(session);
1947 }
1948 }
1949
1950 return count.intValue();
1951 }
1952
1953 public int countByC_F(long companyId, String friendlyURL)
1954 throws SystemException {
1955 Object[] finderArgs = new Object[] { new Long(companyId), friendlyURL };
1956
1957 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_F,
1958 finderArgs, this);
1959
1960 if (count == null) {
1961 Session session = null;
1962
1963 try {
1964 session = openSession();
1965
1966 StringBuilder query = new StringBuilder();
1967
1968 query.append("SELECT COUNT(*) ");
1969 query.append("FROM com.liferay.portal.model.Group WHERE ");
1970
1971 query.append("companyId = ?");
1972
1973 query.append(" AND ");
1974
1975 if (friendlyURL == null) {
1976 query.append("friendlyURL IS NULL");
1977 }
1978 else {
1979 query.append("friendlyURL = ?");
1980 }
1981
1982 query.append(" ");
1983
1984 Query q = session.createQuery(query.toString());
1985
1986 QueryPos qPos = QueryPos.getInstance(q);
1987
1988 qPos.add(companyId);
1989
1990 if (friendlyURL != null) {
1991 qPos.add(friendlyURL);
1992 }
1993
1994 count = (Long)q.uniqueResult();
1995 }
1996 catch (Exception e) {
1997 throw processException(e);
1998 }
1999 finally {
2000 if (count == null) {
2001 count = Long.valueOf(0);
2002 }
2003
2004 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_F, finderArgs,
2005 count);
2006
2007 closeSession(session);
2008 }
2009 }
2010
2011 return count.intValue();
2012 }
2013
2014 public int countByT_A(int type, boolean active) throws SystemException {
2015 Object[] finderArgs = new Object[] {
2016 new Integer(type), Boolean.valueOf(active)
2017 };
2018
2019 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_T_A,
2020 finderArgs, this);
2021
2022 if (count == null) {
2023 Session session = null;
2024
2025 try {
2026 session = openSession();
2027
2028 StringBuilder query = new StringBuilder();
2029
2030 query.append("SELECT COUNT(*) ");
2031 query.append("FROM com.liferay.portal.model.Group WHERE ");
2032
2033 query.append("type_ = ?");
2034
2035 query.append(" AND ");
2036
2037 query.append("active_ = ?");
2038
2039 query.append(" ");
2040
2041 Query q = session.createQuery(query.toString());
2042
2043 QueryPos qPos = QueryPos.getInstance(q);
2044
2045 qPos.add(type);
2046
2047 qPos.add(active);
2048
2049 count = (Long)q.uniqueResult();
2050 }
2051 catch (Exception e) {
2052 throw processException(e);
2053 }
2054 finally {
2055 if (count == null) {
2056 count = Long.valueOf(0);
2057 }
2058
2059 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_T_A, finderArgs,
2060 count);
2061
2062 closeSession(session);
2063 }
2064 }
2065
2066 return count.intValue();
2067 }
2068
2069 public int countByC_C_C(long companyId, long classNameId, long classPK)
2070 throws SystemException {
2071 Object[] finderArgs = new Object[] {
2072 new Long(companyId), new Long(classNameId), new Long(classPK)
2073 };
2074
2075 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C_C,
2076 finderArgs, this);
2077
2078 if (count == null) {
2079 Session session = null;
2080
2081 try {
2082 session = openSession();
2083
2084 StringBuilder query = new StringBuilder();
2085
2086 query.append("SELECT COUNT(*) ");
2087 query.append("FROM com.liferay.portal.model.Group WHERE ");
2088
2089 query.append("companyId = ?");
2090
2091 query.append(" AND ");
2092
2093 query.append("classNameId = ?");
2094
2095 query.append(" AND ");
2096
2097 query.append("classPK = ?");
2098
2099 query.append(" ");
2100
2101 Query q = session.createQuery(query.toString());
2102
2103 QueryPos qPos = QueryPos.getInstance(q);
2104
2105 qPos.add(companyId);
2106
2107 qPos.add(classNameId);
2108
2109 qPos.add(classPK);
2110
2111 count = (Long)q.uniqueResult();
2112 }
2113 catch (Exception e) {
2114 throw processException(e);
2115 }
2116 finally {
2117 if (count == null) {
2118 count = Long.valueOf(0);
2119 }
2120
2121 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C_C,
2122 finderArgs, count);
2123
2124 closeSession(session);
2125 }
2126 }
2127
2128 return count.intValue();
2129 }
2130
2131 public int countByC_L_N(long companyId, long liveGroupId, String name)
2132 throws SystemException {
2133 Object[] finderArgs = new Object[] {
2134 new Long(companyId), new Long(liveGroupId),
2135
2136 name
2137 };
2138
2139 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_L_N,
2140 finderArgs, this);
2141
2142 if (count == null) {
2143 Session session = null;
2144
2145 try {
2146 session = openSession();
2147
2148 StringBuilder query = new StringBuilder();
2149
2150 query.append("SELECT COUNT(*) ");
2151 query.append("FROM com.liferay.portal.model.Group WHERE ");
2152
2153 query.append("companyId = ?");
2154
2155 query.append(" AND ");
2156
2157 query.append("liveGroupId = ?");
2158
2159 query.append(" AND ");
2160
2161 if (name == null) {
2162 query.append("name IS NULL");
2163 }
2164 else {
2165 query.append("name = ?");
2166 }
2167
2168 query.append(" ");
2169
2170 Query q = session.createQuery(query.toString());
2171
2172 QueryPos qPos = QueryPos.getInstance(q);
2173
2174 qPos.add(companyId);
2175
2176 qPos.add(liveGroupId);
2177
2178 if (name != null) {
2179 qPos.add(name);
2180 }
2181
2182 count = (Long)q.uniqueResult();
2183 }
2184 catch (Exception e) {
2185 throw processException(e);
2186 }
2187 finally {
2188 if (count == null) {
2189 count = Long.valueOf(0);
2190 }
2191
2192 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_L_N,
2193 finderArgs, count);
2194
2195 closeSession(session);
2196 }
2197 }
2198
2199 return count.intValue();
2200 }
2201
2202 public int countByC_C_L_N(long companyId, long classNameId,
2203 long liveGroupId, String name) throws SystemException {
2204 Object[] finderArgs = new Object[] {
2205 new Long(companyId), new Long(classNameId),
2206 new Long(liveGroupId),
2207
2208 name
2209 };
2210
2211 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C_L_N,
2212 finderArgs, this);
2213
2214 if (count == null) {
2215 Session session = null;
2216
2217 try {
2218 session = openSession();
2219
2220 StringBuilder query = new StringBuilder();
2221
2222 query.append("SELECT COUNT(*) ");
2223 query.append("FROM com.liferay.portal.model.Group WHERE ");
2224
2225 query.append("companyId = ?");
2226
2227 query.append(" AND ");
2228
2229 query.append("classNameId = ?");
2230
2231 query.append(" AND ");
2232
2233 query.append("liveGroupId = ?");
2234
2235 query.append(" AND ");
2236
2237 if (name == null) {
2238 query.append("name IS NULL");
2239 }
2240 else {
2241 query.append("name = ?");
2242 }
2243
2244 query.append(" ");
2245
2246 Query q = session.createQuery(query.toString());
2247
2248 QueryPos qPos = QueryPos.getInstance(q);
2249
2250 qPos.add(companyId);
2251
2252 qPos.add(classNameId);
2253
2254 qPos.add(liveGroupId);
2255
2256 if (name != null) {
2257 qPos.add(name);
2258 }
2259
2260 count = (Long)q.uniqueResult();
2261 }
2262 catch (Exception e) {
2263 throw processException(e);
2264 }
2265 finally {
2266 if (count == null) {
2267 count = Long.valueOf(0);
2268 }
2269
2270 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C_L_N,
2271 finderArgs, count);
2272
2273 closeSession(session);
2274 }
2275 }
2276
2277 return count.intValue();
2278 }
2279
2280 public int countAll() throws SystemException {
2281 Object[] finderArgs = new Object[0];
2282
2283 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2284 finderArgs, this);
2285
2286 if (count == null) {
2287 Session session = null;
2288
2289 try {
2290 session = openSession();
2291
2292 Query q = session.createQuery(
2293 "SELECT COUNT(*) FROM com.liferay.portal.model.Group");
2294
2295 count = (Long)q.uniqueResult();
2296 }
2297 catch (Exception e) {
2298 throw processException(e);
2299 }
2300 finally {
2301 if (count == null) {
2302 count = Long.valueOf(0);
2303 }
2304
2305 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
2306 count);
2307
2308 closeSession(session);
2309 }
2310 }
2311
2312 return count.intValue();
2313 }
2314
2315 public List<com.liferay.portal.model.Organization> getOrganizations(long pk)
2316 throws SystemException {
2317 return getOrganizations(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
2318 }
2319
2320 public List<com.liferay.portal.model.Organization> getOrganizations(
2321 long pk, int start, int end) throws SystemException {
2322 return getOrganizations(pk, start, end, null);
2323 }
2324
2325 public static final FinderPath FINDER_PATH_GET_ORGANIZATIONS = new FinderPath(com.liferay.portal.model.impl.OrganizationModelImpl.ENTITY_CACHE_ENABLED,
2326 GroupModelImpl.FINDER_CACHE_ENABLED_GROUPS_ORGS, "Groups_Orgs",
2327 "getOrganizations",
2328 new String[] {
2329 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
2330 "com.liferay.portal.kernel.util.OrderByComparator"
2331 });
2332
2333 public List<com.liferay.portal.model.Organization> getOrganizations(
2334 long pk, int start, int end, OrderByComparator obc)
2335 throws SystemException {
2336 Object[] finderArgs = new Object[] {
2337 new Long(pk), String.valueOf(start), String.valueOf(end),
2338 String.valueOf(obc)
2339 };
2340
2341 List<com.liferay.portal.model.Organization> list = (List<com.liferay.portal.model.Organization>)FinderCacheUtil.getResult(FINDER_PATH_GET_ORGANIZATIONS,
2342 finderArgs, this);
2343
2344 if (list == null) {
2345 Session session = null;
2346
2347 try {
2348 session = openSession();
2349
2350 StringBuilder sb = new StringBuilder();
2351
2352 sb.append(_SQL_GETORGANIZATIONS);
2353
2354 if (obc != null) {
2355 sb.append("ORDER BY ");
2356 sb.append(obc.getOrderBy());
2357 }
2358
2359 else {
2360 sb.append("ORDER BY ");
2361
2362 sb.append("Organization_.name ASC");
2363 }
2364
2365 String sql = sb.toString();
2366
2367 SQLQuery q = session.createSQLQuery(sql);
2368
2369 q.addEntity("Organization_",
2370 com.liferay.portal.model.impl.OrganizationImpl.class);
2371
2372 QueryPos qPos = QueryPos.getInstance(q);
2373
2374 qPos.add(pk);
2375
2376 list = (List<com.liferay.portal.model.Organization>)QueryUtil.list(q,
2377 getDialect(), start, end);
2378 }
2379 catch (Exception e) {
2380 throw processException(e);
2381 }
2382 finally {
2383 if (list == null) {
2384 list = new ArrayList<com.liferay.portal.model.Organization>();
2385 }
2386
2387 organizationPersistence.cacheResult(list);
2388
2389 FinderCacheUtil.putResult(FINDER_PATH_GET_ORGANIZATIONS,
2390 finderArgs, list);
2391
2392 closeSession(session);
2393 }
2394 }
2395
2396 return list;
2397 }
2398
2399 public static final FinderPath FINDER_PATH_GET_ORGANIZATIONS_SIZE = new FinderPath(com.liferay.portal.model.impl.OrganizationModelImpl.ENTITY_CACHE_ENABLED,
2400 GroupModelImpl.FINDER_CACHE_ENABLED_GROUPS_ORGS, "Groups_Orgs",
2401 "getOrganizationsSize", new String[] { Long.class.getName() });
2402
2403 public int getOrganizationsSize(long pk) throws SystemException {
2404 Object[] finderArgs = new Object[] { new Long(pk) };
2405
2406 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_ORGANIZATIONS_SIZE,
2407 finderArgs, this);
2408
2409 if (count == null) {
2410 Session session = null;
2411
2412 try {
2413 session = openSession();
2414
2415 SQLQuery q = session.createSQLQuery(_SQL_GETORGANIZATIONSSIZE);
2416
2417 q.addScalar(COUNT_COLUMN_NAME, Type.LONG);
2418
2419 QueryPos qPos = QueryPos.getInstance(q);
2420
2421 qPos.add(pk);
2422
2423 count = (Long)q.uniqueResult();
2424 }
2425 catch (Exception e) {
2426 throw processException(e);
2427 }
2428 finally {
2429 if (count == null) {
2430 count = Long.valueOf(0);
2431 }
2432
2433 FinderCacheUtil.putResult(FINDER_PATH_GET_ORGANIZATIONS_SIZE,
2434 finderArgs, count);
2435
2436 closeSession(session);
2437 }
2438 }
2439
2440 return count.intValue();
2441 }
2442
2443 public static final FinderPath FINDER_PATH_CONTAINS_ORGANIZATION = new FinderPath(com.liferay.portal.model.impl.OrganizationModelImpl.ENTITY_CACHE_ENABLED,
2444 GroupModelImpl.FINDER_CACHE_ENABLED_GROUPS_ORGS, "Groups_Orgs",
2445 "containsOrganization",
2446 new String[] { Long.class.getName(), Long.class.getName() });
2447
2448 public boolean containsOrganization(long pk, long organizationPK)
2449 throws SystemException {
2450 Object[] finderArgs = new Object[] {
2451 new Long(pk),
2452
2453 new Long(organizationPK)
2454 };
2455
2456 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_ORGANIZATION,
2457 finderArgs, this);
2458
2459 if (value == null) {
2460 try {
2461 value = Boolean.valueOf(containsOrganization.contains(pk,
2462 organizationPK));
2463 }
2464 catch (Exception e) {
2465 throw processException(e);
2466 }
2467 finally {
2468 if (value == null) {
2469 value = Boolean.FALSE;
2470 }
2471
2472 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_ORGANIZATION,
2473 finderArgs, value);
2474 }
2475 }
2476
2477 return value.booleanValue();
2478 }
2479
2480 public boolean containsOrganizations(long pk) throws SystemException {
2481 if (getOrganizationsSize(pk) > 0) {
2482 return true;
2483 }
2484 else {
2485 return false;
2486 }
2487 }
2488
2489 public void addOrganization(long pk, long organizationPK)
2490 throws SystemException {
2491 try {
2492 addOrganization.add(pk, organizationPK);
2493 }
2494 catch (Exception e) {
2495 throw processException(e);
2496 }
2497 finally {
2498 FinderCacheUtil.clearCache("Groups_Orgs");
2499 }
2500 }
2501
2502 public void addOrganization(long pk,
2503 com.liferay.portal.model.Organization organization)
2504 throws SystemException {
2505 try {
2506 addOrganization.add(pk, organization.getPrimaryKey());
2507 }
2508 catch (Exception e) {
2509 throw processException(e);
2510 }
2511 finally {
2512 FinderCacheUtil.clearCache("Groups_Orgs");
2513 }
2514 }
2515
2516 public void addOrganizations(long pk, long[] organizationPKs)
2517 throws SystemException {
2518 try {
2519 for (long organizationPK : organizationPKs) {
2520 addOrganization.add(pk, organizationPK);
2521 }
2522 }
2523 catch (Exception e) {
2524 throw processException(e);
2525 }
2526 finally {
2527 FinderCacheUtil.clearCache("Groups_Orgs");
2528 }
2529 }
2530
2531 public void addOrganizations(long pk,
2532 List<com.liferay.portal.model.Organization> organizations)
2533 throws SystemException {
2534 try {
2535 for (com.liferay.portal.model.Organization organization : organizations) {
2536 addOrganization.add(pk, organization.getPrimaryKey());
2537 }
2538 }
2539 catch (Exception e) {
2540 throw processException(e);
2541 }
2542 finally {
2543 FinderCacheUtil.clearCache("Groups_Orgs");
2544 }
2545 }
2546
2547 public void clearOrganizations(long pk) throws SystemException {
2548 try {
2549 clearOrganizations.clear(pk);
2550 }
2551 catch (Exception e) {
2552 throw processException(e);
2553 }
2554 finally {
2555 FinderCacheUtil.clearCache("Groups_Orgs");
2556 }
2557 }
2558
2559 public void removeOrganization(long pk, long organizationPK)
2560 throws SystemException {
2561 try {
2562 removeOrganization.remove(pk, organizationPK);
2563 }
2564 catch (Exception e) {
2565 throw processException(e);
2566 }
2567 finally {
2568 FinderCacheUtil.clearCache("Groups_Orgs");
2569 }
2570 }
2571
2572 public void removeOrganization(long pk,
2573 com.liferay.portal.model.Organization organization)
2574 throws SystemException {
2575 try {
2576 removeOrganization.remove(pk, organization.getPrimaryKey());
2577 }
2578 catch (Exception e) {
2579 throw processException(e);
2580 }
2581 finally {
2582 FinderCacheUtil.clearCache("Groups_Orgs");
2583 }
2584 }
2585
2586 public void removeOrganizations(long pk, long[] organizationPKs)
2587 throws SystemException {
2588 try {
2589 for (long organizationPK : organizationPKs) {
2590 removeOrganization.remove(pk, organizationPK);
2591 }
2592 }
2593 catch (Exception e) {
2594 throw processException(e);
2595 }
2596 finally {
2597 FinderCacheUtil.clearCache("Groups_Orgs");
2598 }
2599 }
2600
2601 public void removeOrganizations(long pk,
2602 List<com.liferay.portal.model.Organization> organizations)
2603 throws SystemException {
2604 try {
2605 for (com.liferay.portal.model.Organization organization : organizations) {
2606 removeOrganization.remove(pk, organization.getPrimaryKey());
2607 }
2608 }
2609 catch (Exception e) {
2610 throw processException(e);
2611 }
2612 finally {
2613 FinderCacheUtil.clearCache("Groups_Orgs");
2614 }
2615 }
2616
2617 public void setOrganizations(long pk, long[] organizationPKs)
2618 throws SystemException {
2619 try {
2620 clearOrganizations.clear(pk);
2621
2622 for (long organizationPK : organizationPKs) {
2623 addOrganization.add(pk, organizationPK);
2624 }
2625 }
2626 catch (Exception e) {
2627 throw processException(e);
2628 }
2629 finally {
2630 FinderCacheUtil.clearCache("Groups_Orgs");
2631 }
2632 }
2633
2634 public void setOrganizations(long pk,
2635 List<com.liferay.portal.model.Organization> organizations)
2636 throws SystemException {
2637 try {
2638 clearOrganizations.clear(pk);
2639
2640 for (com.liferay.portal.model.Organization organization : organizations) {
2641 addOrganization.add(pk, organization.getPrimaryKey());
2642 }
2643 }
2644 catch (Exception e) {
2645 throw processException(e);
2646 }
2647 finally {
2648 FinderCacheUtil.clearCache("Groups_Orgs");
2649 }
2650 }
2651
2652 public List<com.liferay.portal.model.Permission> getPermissions(long pk)
2653 throws SystemException {
2654 return getPermissions(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
2655 }
2656
2657 public List<com.liferay.portal.model.Permission> getPermissions(long pk,
2658 int start, int end) throws SystemException {
2659 return getPermissions(pk, start, end, null);
2660 }
2661
2662 public static final FinderPath FINDER_PATH_GET_PERMISSIONS = new FinderPath(com.liferay.portal.model.impl.PermissionModelImpl.ENTITY_CACHE_ENABLED,
2663 GroupModelImpl.FINDER_CACHE_ENABLED_GROUPS_PERMISSIONS,
2664 "Groups_Permissions", "getPermissions",
2665 new String[] {
2666 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
2667 "com.liferay.portal.kernel.util.OrderByComparator"
2668 });
2669
2670 public List<com.liferay.portal.model.Permission> getPermissions(long pk,
2671 int start, int end, OrderByComparator obc) throws SystemException {
2672 Object[] finderArgs = new Object[] {
2673 new Long(pk), String.valueOf(start), String.valueOf(end),
2674 String.valueOf(obc)
2675 };
2676
2677 List<com.liferay.portal.model.Permission> list = (List<com.liferay.portal.model.Permission>)FinderCacheUtil.getResult(FINDER_PATH_GET_PERMISSIONS,
2678 finderArgs, this);
2679
2680 if (list == null) {
2681 Session session = null;
2682
2683 try {
2684 session = openSession();
2685
2686 StringBuilder sb = new StringBuilder();
2687
2688 sb.append(_SQL_GETPERMISSIONS);
2689
2690 if (obc != null) {
2691 sb.append("ORDER BY ");
2692 sb.append(obc.getOrderBy());
2693 }
2694
2695 String sql = sb.toString();
2696
2697 SQLQuery q = session.createSQLQuery(sql);
2698
2699 q.addEntity("Permission_",
2700 com.liferay.portal.model.impl.PermissionImpl.class);
2701
2702 QueryPos qPos = QueryPos.getInstance(q);
2703
2704 qPos.add(pk);
2705
2706 list = (List<com.liferay.portal.model.Permission>)QueryUtil.list(q,
2707 getDialect(), start, end);
2708 }
2709 catch (Exception e) {
2710 throw processException(e);
2711 }
2712 finally {
2713 if (list == null) {
2714 list = new ArrayList<com.liferay.portal.model.Permission>();
2715 }
2716
2717 permissionPersistence.cacheResult(list);
2718
2719 FinderCacheUtil.putResult(FINDER_PATH_GET_PERMISSIONS,
2720 finderArgs, list);
2721
2722 closeSession(session);
2723 }
2724 }
2725
2726 return list;
2727 }
2728
2729 public static final FinderPath FINDER_PATH_GET_PERMISSIONS_SIZE = new FinderPath(com.liferay.portal.model.impl.PermissionModelImpl.ENTITY_CACHE_ENABLED,
2730 GroupModelImpl.FINDER_CACHE_ENABLED_GROUPS_PERMISSIONS,
2731 "Groups_Permissions", "getPermissionsSize",
2732 new String[] { Long.class.getName() });
2733
2734 public int getPermissionsSize(long pk) throws SystemException {
2735 Object[] finderArgs = new Object[] { new Long(pk) };
2736
2737 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_PERMISSIONS_SIZE,
2738 finderArgs, this);
2739
2740 if (count == null) {
2741 Session session = null;
2742
2743 try {
2744 session = openSession();
2745
2746 SQLQuery q = session.createSQLQuery(_SQL_GETPERMISSIONSSIZE);
2747
2748 q.addScalar(COUNT_COLUMN_NAME, Type.LONG);
2749
2750 QueryPos qPos = QueryPos.getInstance(q);
2751
2752 qPos.add(pk);
2753
2754 count = (Long)q.uniqueResult();
2755 }
2756 catch (Exception e) {
2757 throw processException(e);
2758 }
2759 finally {
2760 if (count == null) {
2761 count = Long.valueOf(0);
2762 }
2763
2764 FinderCacheUtil.putResult(FINDER_PATH_GET_PERMISSIONS_SIZE,
2765 finderArgs, count);
2766
2767 closeSession(session);
2768 }
2769 }
2770
2771 return count.intValue();
2772 }
2773
2774 public static final FinderPath FINDER_PATH_CONTAINS_PERMISSION = new FinderPath(com.liferay.portal.model.impl.PermissionModelImpl.ENTITY_CACHE_ENABLED,
2775 GroupModelImpl.FINDER_CACHE_ENABLED_GROUPS_PERMISSIONS,
2776 "Groups_Permissions", "containsPermission",
2777 new String[] { Long.class.getName(), Long.class.getName() });
2778
2779 public boolean containsPermission(long pk, long permissionPK)
2780 throws SystemException {
2781 Object[] finderArgs = new Object[] { new Long(pk), new Long(permissionPK) };
2782
2783 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_PERMISSION,
2784 finderArgs, this);
2785
2786 if (value == null) {
2787 try {
2788 value = Boolean.valueOf(containsPermission.contains(pk,
2789 permissionPK));
2790 }
2791 catch (Exception e) {
2792 throw processException(e);
2793 }
2794 finally {
2795 if (value == null) {
2796 value = Boolean.FALSE;
2797 }
2798
2799 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_PERMISSION,
2800 finderArgs, value);
2801 }
2802 }
2803
2804 return value.booleanValue();
2805 }
2806
2807 public boolean containsPermissions(long pk) throws SystemException {
2808 if (getPermissionsSize(pk) > 0) {
2809 return true;
2810 }
2811 else {
2812 return false;
2813 }
2814 }
2815
2816 public void addPermission(long pk, long permissionPK)
2817 throws SystemException {
2818 try {
2819 addPermission.add(pk, permissionPK);
2820 }
2821 catch (Exception e) {
2822 throw processException(e);
2823 }
2824 finally {
2825 FinderCacheUtil.clearCache("Groups_Permissions");
2826 }
2827 }
2828
2829 public void addPermission(long pk,
2830 com.liferay.portal.model.Permission permission)
2831 throws SystemException {
2832 try {
2833 addPermission.add(pk, permission.getPrimaryKey());
2834 }
2835 catch (Exception e) {
2836 throw processException(e);
2837 }
2838 finally {
2839 FinderCacheUtil.clearCache("Groups_Permissions");
2840 }
2841 }
2842
2843 public void addPermissions(long pk, long[] permissionPKs)
2844 throws SystemException {
2845 try {
2846 for (long permissionPK : permissionPKs) {
2847 addPermission.add(pk, permissionPK);
2848 }
2849 }
2850 catch (Exception e) {
2851 throw processException(e);
2852 }
2853 finally {
2854 FinderCacheUtil.clearCache("Groups_Permissions");
2855 }
2856 }
2857
2858 public void addPermissions(long pk,
2859 List<com.liferay.portal.model.Permission> permissions)
2860 throws SystemException {
2861 try {
2862 for (com.liferay.portal.model.Permission permission : permissions) {
2863 addPermission.add(pk, permission.getPrimaryKey());
2864 }
2865 }
2866 catch (Exception e) {
2867 throw processException(e);
2868 }
2869 finally {
2870 FinderCacheUtil.clearCache("Groups_Permissions");
2871 }
2872 }
2873
2874 public void clearPermissions(long pk) throws SystemException {
2875 try {
2876 clearPermissions.clear(pk);
2877 }
2878 catch (Exception e) {
2879 throw processException(e);
2880 }
2881 finally {
2882 FinderCacheUtil.clearCache("Groups_Permissions");
2883 }
2884 }
2885
2886 public void removePermission(long pk, long permissionPK)
2887 throws SystemException {
2888 try {
2889 removePermission.remove(pk, permissionPK);
2890 }
2891 catch (Exception e) {
2892 throw processException(e);
2893 }
2894 finally {
2895 FinderCacheUtil.clearCache("Groups_Permissions");
2896 }
2897 }
2898
2899 public void removePermission(long pk,
2900 com.liferay.portal.model.Permission permission)
2901 throws SystemException {
2902 try {
2903 removePermission.remove(pk, permission.getPrimaryKey());
2904 }
2905 catch (Exception e) {
2906 throw processException(e);
2907 }
2908 finally {
2909 FinderCacheUtil.clearCache("Groups_Permissions");
2910 }
2911 }
2912
2913 public void removePermissions(long pk, long[] permissionPKs)
2914 throws SystemException {
2915 try {
2916 for (long permissionPK : permissionPKs) {
2917 removePermission.remove(pk, permissionPK);
2918 }
2919 }
2920 catch (Exception e) {
2921 throw processException(e);
2922 }
2923 finally {
2924 FinderCacheUtil.clearCache("Groups_Permissions");
2925 }
2926 }
2927
2928 public void removePermissions(long pk,
2929 List<com.liferay.portal.model.Permission> permissions)
2930 throws SystemException {
2931 try {
2932 for (com.liferay.portal.model.Permission permission : permissions) {
2933 removePermission.remove(pk, permission.getPrimaryKey());
2934 }
2935 }
2936 catch (Exception e) {
2937 throw processException(e);
2938 }
2939 finally {
2940 FinderCacheUtil.clearCache("Groups_Permissions");
2941 }
2942 }
2943
2944 public void setPermissions(long pk, long[] permissionPKs)
2945 throws SystemException {
2946 try {
2947 clearPermissions.clear(pk);
2948
2949 for (long permissionPK : permissionPKs) {
2950 addPermission.add(pk, permissionPK);
2951 }
2952 }
2953 catch (Exception e) {
2954 throw processException(e);
2955 }
2956 finally {
2957 FinderCacheUtil.clearCache("Groups_Permissions");
2958 }
2959 }
2960
2961 public void setPermissions(long pk,
2962 List<com.liferay.portal.model.Permission> permissions)
2963 throws SystemException {
2964 try {
2965 clearPermissions.clear(pk);
2966
2967 for (com.liferay.portal.model.Permission permission : permissions) {
2968 addPermission.add(pk, permission.getPrimaryKey());
2969 }
2970 }
2971 catch (Exception e) {
2972 throw processException(e);
2973 }
2974 finally {
2975 FinderCacheUtil.clearCache("Groups_Permissions");
2976 }
2977 }
2978
2979 public List<com.liferay.portal.model.Role> getRoles(long pk)
2980 throws SystemException {
2981 return getRoles(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
2982 }
2983
2984 public List<com.liferay.portal.model.Role> getRoles(long pk, int start,
2985 int end) throws SystemException {
2986 return getRoles(pk, start, end, null);
2987 }
2988
2989 public static final FinderPath FINDER_PATH_GET_ROLES = new FinderPath(com.liferay.portal.model.impl.RoleModelImpl.ENTITY_CACHE_ENABLED,
2990 GroupModelImpl.FINDER_CACHE_ENABLED_GROUPS_ROLES, "Groups_Roles",
2991 "getRoles",
2992 new String[] {
2993 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
2994 "com.liferay.portal.kernel.util.OrderByComparator"
2995 });
2996
2997 public List<com.liferay.portal.model.Role> getRoles(long pk, int start,
2998 int end, OrderByComparator obc) throws SystemException {
2999 Object[] finderArgs = new Object[] {
3000 new Long(pk), String.valueOf(start), String.valueOf(end),
3001 String.valueOf(obc)
3002 };
3003
3004 List<com.liferay.portal.model.Role> list = (List<com.liferay.portal.model.Role>)FinderCacheUtil.getResult(FINDER_PATH_GET_ROLES,
3005 finderArgs, this);
3006
3007 if (list == null) {
3008 Session session = null;
3009
3010 try {
3011 session = openSession();
3012
3013 StringBuilder sb = new StringBuilder();
3014
3015 sb.append(_SQL_GETROLES);
3016
3017 if (obc != null) {
3018 sb.append("ORDER BY ");
3019 sb.append(obc.getOrderBy());
3020 }
3021
3022 else {
3023 sb.append("ORDER BY ");
3024
3025 sb.append("Role_.name ASC");
3026 }
3027
3028 String sql = sb.toString();
3029
3030 SQLQuery q = session.createSQLQuery(sql);
3031
3032 q.addEntity("Role_",
3033 com.liferay.portal.model.impl.RoleImpl.class);
3034
3035 QueryPos qPos = QueryPos.getInstance(q);
3036
3037 qPos.add(pk);
3038
3039 list = (List<com.liferay.portal.model.Role>)QueryUtil.list(q,
3040 getDialect(), start, end);
3041 }
3042 catch (Exception e) {
3043 throw processException(e);
3044 }
3045 finally {
3046 if (list == null) {
3047 list = new ArrayList<com.liferay.portal.model.Role>();
3048 }
3049
3050 rolePersistence.cacheResult(list);
3051
3052 FinderCacheUtil.putResult(FINDER_PATH_GET_ROLES, finderArgs,
3053 list);
3054
3055 closeSession(session);
3056 }
3057 }
3058
3059 return list;
3060 }
3061
3062 public static final FinderPath FINDER_PATH_GET_ROLES_SIZE = new FinderPath(com.liferay.portal.model.impl.RoleModelImpl.ENTITY_CACHE_ENABLED,
3063 GroupModelImpl.FINDER_CACHE_ENABLED_GROUPS_ROLES, "Groups_Roles",
3064 "getRolesSize", new String[] { Long.class.getName() });
3065
3066 public int getRolesSize(long pk) throws SystemException {
3067 Object[] finderArgs = new Object[] { new Long(pk) };
3068
3069 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_ROLES_SIZE,
3070 finderArgs, this);
3071
3072 if (count == null) {
3073 Session session = null;
3074
3075 try {
3076 session = openSession();
3077
3078 SQLQuery q = session.createSQLQuery(_SQL_GETROLESSIZE);
3079
3080 q.addScalar(COUNT_COLUMN_NAME, Type.LONG);
3081
3082 QueryPos qPos = QueryPos.getInstance(q);
3083
3084 qPos.add(pk);
3085
3086 count = (Long)q.uniqueResult();
3087 }
3088 catch (Exception e) {
3089 throw processException(e);
3090 }
3091 finally {
3092 if (count == null) {
3093 count = Long.valueOf(0);
3094 }
3095
3096 FinderCacheUtil.putResult(FINDER_PATH_GET_ROLES_SIZE,
3097 finderArgs, count);
3098
3099 closeSession(session);
3100 }
3101 }
3102
3103 return count.intValue();
3104 }
3105
3106 public static final FinderPath FINDER_PATH_CONTAINS_ROLE = new FinderPath(com.liferay.portal.model.impl.RoleModelImpl.ENTITY_CACHE_ENABLED,
3107 GroupModelImpl.FINDER_CACHE_ENABLED_GROUPS_ROLES, "Groups_Roles",
3108 "containsRole",
3109 new String[] { Long.class.getName(), Long.class.getName() });
3110
3111 public boolean containsRole(long pk, long rolePK) throws SystemException {
3112 Object[] finderArgs = new Object[] { new Long(pk), new Long(rolePK) };
3113
3114 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_ROLE,
3115 finderArgs, this);
3116
3117 if (value == null) {
3118 try {
3119 value = Boolean.valueOf(containsRole.contains(pk, rolePK));
3120 }
3121 catch (Exception e) {
3122 throw processException(e);
3123 }
3124 finally {
3125 if (value == null) {
3126 value = Boolean.FALSE;
3127 }
3128
3129 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_ROLE,
3130 finderArgs, value);
3131 }
3132 }
3133
3134 return value.booleanValue();
3135 }
3136
3137 public boolean containsRoles(long pk) throws SystemException {
3138 if (getRolesSize(pk) > 0) {
3139 return true;
3140 }
3141 else {
3142 return false;
3143 }
3144 }
3145
3146 public void addRole(long pk, long rolePK) throws SystemException {
3147 try {
3148 addRole.add(pk, rolePK);
3149 }
3150 catch (Exception e) {
3151 throw processException(e);
3152 }
3153 finally {
3154 FinderCacheUtil.clearCache("Groups_Roles");
3155 }
3156 }
3157
3158 public void addRole(long pk, com.liferay.portal.model.Role role)
3159 throws SystemException {
3160 try {
3161 addRole.add(pk, role.getPrimaryKey());
3162 }
3163 catch (Exception e) {
3164 throw processException(e);
3165 }
3166 finally {
3167 FinderCacheUtil.clearCache("Groups_Roles");
3168 }
3169 }
3170
3171 public void addRoles(long pk, long[] rolePKs) throws SystemException {
3172 try {
3173 for (long rolePK : rolePKs) {
3174 addRole.add(pk, rolePK);
3175 }
3176 }
3177 catch (Exception e) {
3178 throw processException(e);
3179 }
3180 finally {
3181 FinderCacheUtil.clearCache("Groups_Roles");
3182 }
3183 }
3184
3185 public void addRoles(long pk, List<com.liferay.portal.model.Role> roles)
3186 throws SystemException {
3187 try {
3188 for (com.liferay.portal.model.Role role : roles) {
3189 addRole.add(pk, role.getPrimaryKey());
3190 }
3191 }
3192 catch (Exception e) {
3193 throw processException(e);
3194 }
3195 finally {
3196 FinderCacheUtil.clearCache("Groups_Roles");
3197 }
3198 }
3199
3200 public void clearRoles(long pk) throws SystemException {
3201 try {
3202 clearRoles.clear(pk);
3203 }
3204 catch (Exception e) {
3205 throw processException(e);
3206 }
3207 finally {
3208 FinderCacheUtil.clearCache("Groups_Roles");
3209 }
3210 }
3211
3212 public void removeRole(long pk, long rolePK) throws SystemException {
3213 try {
3214 removeRole.remove(pk, rolePK);
3215 }
3216 catch (Exception e) {
3217 throw processException(e);
3218 }
3219 finally {
3220 FinderCacheUtil.clearCache("Groups_Roles");
3221 }
3222 }
3223
3224 public void removeRole(long pk, com.liferay.portal.model.Role role)
3225 throws SystemException {
3226 try {
3227 removeRole.remove(pk, role.getPrimaryKey());
3228 }
3229 catch (Exception e) {
3230 throw processException(e);
3231 }
3232 finally {
3233 FinderCacheUtil.clearCache("Groups_Roles");
3234 }
3235 }
3236
3237 public void removeRoles(long pk, long[] rolePKs) throws SystemException {
3238 try {
3239 for (long rolePK : rolePKs) {
3240 removeRole.remove(pk, rolePK);
3241 }
3242 }
3243 catch (Exception e) {
3244 throw processException(e);
3245 }
3246 finally {
3247 FinderCacheUtil.clearCache("Groups_Roles");
3248 }
3249 }
3250
3251 public void removeRoles(long pk, List<com.liferay.portal.model.Role> roles)
3252 throws SystemException {
3253 try {
3254 for (com.liferay.portal.model.Role role : roles) {
3255 removeRole.remove(pk, role.getPrimaryKey());
3256 }
3257 }
3258 catch (Exception e) {
3259 throw processException(e);
3260 }
3261 finally {
3262 FinderCacheUtil.clearCache("Groups_Roles");
3263 }
3264 }
3265
3266 public void setRoles(long pk, long[] rolePKs) throws SystemException {
3267 try {
3268 clearRoles.clear(pk);
3269
3270 for (long rolePK : rolePKs) {
3271 addRole.add(pk, rolePK);
3272 }
3273 }
3274 catch (Exception e) {
3275 throw processException(e);
3276 }
3277 finally {
3278 FinderCacheUtil.clearCache("Groups_Roles");
3279 }
3280 }
3281
3282 public void setRoles(long pk, List<com.liferay.portal.model.Role> roles)
3283 throws SystemException {
3284 try {
3285 clearRoles.clear(pk);
3286
3287 for (com.liferay.portal.model.Role role : roles) {
3288 addRole.add(pk, role.getPrimaryKey());
3289 }
3290 }
3291 catch (Exception e) {
3292 throw processException(e);
3293 }
3294 finally {
3295 FinderCacheUtil.clearCache("Groups_Roles");
3296 }
3297 }
3298
3299 public List<com.liferay.portal.model.UserGroup> getUserGroups(long pk)
3300 throws SystemException {
3301 return getUserGroups(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
3302 }
3303
3304 public List<com.liferay.portal.model.UserGroup> getUserGroups(long pk,
3305 int start, int end) throws SystemException {
3306 return getUserGroups(pk, start, end, null);
3307 }
3308
3309 public static final FinderPath FINDER_PATH_GET_USERGROUPS = new FinderPath(com.liferay.portal.model.impl.UserGroupModelImpl.ENTITY_CACHE_ENABLED,
3310 GroupModelImpl.FINDER_CACHE_ENABLED_GROUPS_USERGROUPS,
3311 "Groups_UserGroups", "getUserGroups",
3312 new String[] {
3313 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
3314 "com.liferay.portal.kernel.util.OrderByComparator"
3315 });
3316
3317 public List<com.liferay.portal.model.UserGroup> getUserGroups(long pk,
3318 int start, int end, OrderByComparator obc) throws SystemException {
3319 Object[] finderArgs = new Object[] {
3320 new Long(pk), String.valueOf(start), String.valueOf(end),
3321 String.valueOf(obc)
3322 };
3323
3324 List<com.liferay.portal.model.UserGroup> list = (List<com.liferay.portal.model.UserGroup>)FinderCacheUtil.getResult(FINDER_PATH_GET_USERGROUPS,
3325 finderArgs, this);
3326
3327 if (list == null) {
3328 Session session = null;
3329
3330 try {
3331 session = openSession();
3332
3333 StringBuilder sb = new StringBuilder();
3334
3335 sb.append(_SQL_GETUSERGROUPS);
3336
3337 if (obc != null) {
3338 sb.append("ORDER BY ");
3339 sb.append(obc.getOrderBy());
3340 }
3341
3342 else {
3343 sb.append("ORDER BY ");
3344
3345 sb.append("UserGroup.name ASC");
3346 }
3347
3348 String sql = sb.toString();
3349
3350 SQLQuery q = session.createSQLQuery(sql);
3351
3352 q.addEntity("UserGroup",
3353 com.liferay.portal.model.impl.UserGroupImpl.class);
3354
3355 QueryPos qPos = QueryPos.getInstance(q);
3356
3357 qPos.add(pk);
3358
3359 list = (List<com.liferay.portal.model.UserGroup>)QueryUtil.list(q,
3360 getDialect(), start, end);
3361 }
3362 catch (Exception e) {
3363 throw processException(e);
3364 }
3365 finally {
3366 if (list == null) {
3367 list = new ArrayList<com.liferay.portal.model.UserGroup>();
3368 }
3369
3370 userGroupPersistence.cacheResult(list);
3371
3372 FinderCacheUtil.putResult(FINDER_PATH_GET_USERGROUPS,
3373 finderArgs, list);
3374
3375 closeSession(session);
3376 }
3377 }
3378
3379 return list;
3380 }
3381
3382 public static final FinderPath FINDER_PATH_GET_USERGROUPS_SIZE = new FinderPath(com.liferay.portal.model.impl.UserGroupModelImpl.ENTITY_CACHE_ENABLED,
3383 GroupModelImpl.FINDER_CACHE_ENABLED_GROUPS_USERGROUPS,
3384 "Groups_UserGroups", "getUserGroupsSize",
3385 new String[] { Long.class.getName() });
3386
3387 public int getUserGroupsSize(long pk) throws SystemException {
3388 Object[] finderArgs = new Object[] { new Long(pk) };
3389
3390 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_USERGROUPS_SIZE,
3391 finderArgs, this);
3392
3393 if (count == null) {
3394 Session session = null;
3395
3396 try {
3397 session = openSession();
3398
3399 SQLQuery q = session.createSQLQuery(_SQL_GETUSERGROUPSSIZE);
3400
3401 q.addScalar(COUNT_COLUMN_NAME, Type.LONG);
3402
3403 QueryPos qPos = QueryPos.getInstance(q);
3404
3405 qPos.add(pk);
3406
3407 count = (Long)q.uniqueResult();
3408 }
3409 catch (Exception e) {
3410 throw processException(e);
3411 }
3412 finally {
3413 if (count == null) {
3414 count = Long.valueOf(0);
3415 }
3416
3417 FinderCacheUtil.putResult(FINDER_PATH_GET_USERGROUPS_SIZE,
3418 finderArgs, count);
3419
3420 closeSession(session);
3421 }
3422 }
3423
3424 return count.intValue();
3425 }
3426
3427 public static final FinderPath FINDER_PATH_CONTAINS_USERGROUP = new FinderPath(com.liferay.portal.model.impl.UserGroupModelImpl.ENTITY_CACHE_ENABLED,
3428 GroupModelImpl.FINDER_CACHE_ENABLED_GROUPS_USERGROUPS,
3429 "Groups_UserGroups", "containsUserGroup",
3430 new String[] { Long.class.getName(), Long.class.getName() });
3431
3432 public boolean containsUserGroup(long pk, long userGroupPK)
3433 throws SystemException {
3434 Object[] finderArgs = new Object[] { new Long(pk), new Long(userGroupPK) };
3435
3436 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_USERGROUP,
3437 finderArgs, this);
3438
3439 if (value == null) {
3440 try {
3441 value = Boolean.valueOf(containsUserGroup.contains(pk,
3442 userGroupPK));
3443 }
3444 catch (Exception e) {
3445 throw processException(e);
3446 }
3447 finally {
3448 if (value == null) {
3449 value = Boolean.FALSE;
3450 }
3451
3452 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_USERGROUP,
3453 finderArgs, value);
3454 }
3455 }
3456
3457 return value.booleanValue();
3458 }
3459
3460 public boolean containsUserGroups(long pk) throws SystemException {
3461 if (getUserGroupsSize(pk) > 0) {
3462 return true;
3463 }
3464 else {
3465 return false;
3466 }
3467 }
3468
3469 public void addUserGroup(long pk, long userGroupPK)
3470 throws SystemException {
3471 try {
3472 addUserGroup.add(pk, userGroupPK);
3473 }
3474 catch (Exception e) {
3475 throw processException(e);
3476 }
3477 finally {
3478 FinderCacheUtil.clearCache("Groups_UserGroups");
3479 }
3480 }
3481
3482 public void addUserGroup(long pk,
3483 com.liferay.portal.model.UserGroup userGroup) throws SystemException {
3484 try {
3485 addUserGroup.add(pk, userGroup.getPrimaryKey());
3486 }
3487 catch (Exception e) {
3488 throw processException(e);
3489 }
3490 finally {
3491 FinderCacheUtil.clearCache("Groups_UserGroups");
3492 }
3493 }
3494
3495 public void addUserGroups(long pk, long[] userGroupPKs)
3496 throws SystemException {
3497 try {
3498 for (long userGroupPK : userGroupPKs) {
3499 addUserGroup.add(pk, userGroupPK);
3500 }
3501 }
3502 catch (Exception e) {
3503 throw processException(e);
3504 }
3505 finally {
3506 FinderCacheUtil.clearCache("Groups_UserGroups");
3507 }
3508 }
3509
3510 public void addUserGroups(long pk,
3511 List<com.liferay.portal.model.UserGroup> userGroups)
3512 throws SystemException {
3513 try {
3514 for (com.liferay.portal.model.UserGroup userGroup : userGroups) {
3515 addUserGroup.add(pk, userGroup.getPrimaryKey());
3516 }
3517 }
3518 catch (Exception e) {
3519 throw processException(e);
3520 }
3521 finally {
3522 FinderCacheUtil.clearCache("Groups_UserGroups");
3523 }
3524 }
3525
3526 public void clearUserGroups(long pk) throws SystemException {
3527 try {
3528 clearUserGroups.clear(pk);
3529 }
3530 catch (Exception e) {
3531 throw processException(e);
3532 }
3533 finally {
3534 FinderCacheUtil.clearCache("Groups_UserGroups");
3535 }
3536 }
3537
3538 public void removeUserGroup(long pk, long userGroupPK)
3539 throws SystemException {
3540 try {
3541 removeUserGroup.remove(pk, userGroupPK);
3542 }
3543 catch (Exception e) {
3544 throw processException(e);
3545 }
3546 finally {
3547 FinderCacheUtil.clearCache("Groups_UserGroups");
3548 }
3549 }
3550
3551 public void removeUserGroup(long pk,
3552 com.liferay.portal.model.UserGroup userGroup) throws SystemException {
3553 try {
3554 removeUserGroup.remove(pk, userGroup.getPrimaryKey());
3555 }
3556 catch (Exception e) {
3557 throw processException(e);
3558 }
3559 finally {
3560 FinderCacheUtil.clearCache("Groups_UserGroups");
3561 }
3562 }
3563
3564 public void removeUserGroups(long pk, long[] userGroupPKs)
3565 throws SystemException {
3566 try {
3567 for (long userGroupPK : userGroupPKs) {
3568 removeUserGroup.remove(pk, userGroupPK);
3569 }
3570 }
3571 catch (Exception e) {
3572 throw processException(e);
3573 }
3574 finally {
3575 FinderCacheUtil.clearCache("Groups_UserGroups");
3576 }
3577 }
3578
3579 public void removeUserGroups(long pk,
3580 List<com.liferay.portal.model.UserGroup> userGroups)
3581 throws SystemException {
3582 try {
3583 for (com.liferay.portal.model.UserGroup userGroup : userGroups) {
3584 removeUserGroup.remove(pk, userGroup.getPrimaryKey());
3585 }
3586 }
3587 catch (Exception e) {
3588 throw processException(e);
3589 }
3590 finally {
3591 FinderCacheUtil.clearCache("Groups_UserGroups");
3592 }
3593 }
3594
3595 public void setUserGroups(long pk, long[] userGroupPKs)
3596 throws SystemException {
3597 try {
3598 clearUserGroups.clear(pk);
3599
3600 for (long userGroupPK : userGroupPKs) {
3601 addUserGroup.add(pk, userGroupPK);
3602 }
3603 }
3604 catch (Exception e) {
3605 throw processException(e);
3606 }
3607 finally {
3608 FinderCacheUtil.clearCache("Groups_UserGroups");
3609 }
3610 }
3611
3612 public void setUserGroups(long pk,
3613 List<com.liferay.portal.model.UserGroup> userGroups)
3614 throws SystemException {
3615 try {
3616 clearUserGroups.clear(pk);
3617
3618 for (com.liferay.portal.model.UserGroup userGroup : userGroups) {
3619 addUserGroup.add(pk, userGroup.getPrimaryKey());
3620 }
3621 }
3622 catch (Exception e) {
3623 throw processException(e);
3624 }
3625 finally {
3626 FinderCacheUtil.clearCache("Groups_UserGroups");
3627 }
3628 }
3629
3630 public List<com.liferay.portal.model.User> getUsers(long pk)
3631 throws SystemException {
3632 return getUsers(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
3633 }
3634
3635 public List<com.liferay.portal.model.User> getUsers(long pk, int start,
3636 int end) throws SystemException {
3637 return getUsers(pk, start, end, null);
3638 }
3639
3640 public static final FinderPath FINDER_PATH_GET_USERS = new FinderPath(com.liferay.portal.model.impl.UserModelImpl.ENTITY_CACHE_ENABLED,
3641 GroupModelImpl.FINDER_CACHE_ENABLED_USERS_GROUPS, "Users_Groups",
3642 "getUsers",
3643 new String[] {
3644 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
3645 "com.liferay.portal.kernel.util.OrderByComparator"
3646 });
3647
3648 public List<com.liferay.portal.model.User> getUsers(long pk, int start,
3649 int end, OrderByComparator obc) throws SystemException {
3650 Object[] finderArgs = new Object[] {
3651 new Long(pk), String.valueOf(start), String.valueOf(end),
3652 String.valueOf(obc)
3653 };
3654
3655 List<com.liferay.portal.model.User> list = (List<com.liferay.portal.model.User>)FinderCacheUtil.getResult(FINDER_PATH_GET_USERS,
3656 finderArgs, this);
3657
3658 if (list == null) {
3659 Session session = null;
3660
3661 try {
3662 session = openSession();
3663
3664 StringBuilder sb = new StringBuilder();
3665
3666 sb.append(_SQL_GETUSERS);
3667
3668 if (obc != null) {
3669 sb.append("ORDER BY ");
3670 sb.append(obc.getOrderBy());
3671 }
3672
3673 String sql = sb.toString();
3674
3675 SQLQuery q = session.createSQLQuery(sql);
3676
3677 q.addEntity("User_",
3678 com.liferay.portal.model.impl.UserImpl.class);
3679
3680 QueryPos qPos = QueryPos.getInstance(q);
3681
3682 qPos.add(pk);
3683
3684 list = (List<com.liferay.portal.model.User>)QueryUtil.list(q,
3685 getDialect(), start, end);
3686 }
3687 catch (Exception e) {
3688 throw processException(e);
3689 }
3690 finally {
3691 if (list == null) {
3692 list = new ArrayList<com.liferay.portal.model.User>();
3693 }
3694
3695 userPersistence.cacheResult(list);
3696
3697 FinderCacheUtil.putResult(FINDER_PATH_GET_USERS, finderArgs,
3698 list);
3699
3700 closeSession(session);
3701 }
3702 }
3703
3704 return list;
3705 }
3706
3707 public static final FinderPath FINDER_PATH_GET_USERS_SIZE = new FinderPath(com.liferay.portal.model.impl.UserModelImpl.ENTITY_CACHE_ENABLED,
3708 GroupModelImpl.FINDER_CACHE_ENABLED_USERS_GROUPS, "Users_Groups",
3709 "getUsersSize", new String[] { Long.class.getName() });
3710
3711 public int getUsersSize(long pk) throws SystemException {
3712 Object[] finderArgs = new Object[] { new Long(pk) };
3713
3714 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_USERS_SIZE,
3715 finderArgs, this);
3716
3717 if (count == null) {
3718 Session session = null;
3719
3720 try {
3721 session = openSession();
3722
3723 SQLQuery q = session.createSQLQuery(_SQL_GETUSERSSIZE);
3724
3725 q.addScalar(COUNT_COLUMN_NAME, Type.LONG);
3726
3727 QueryPos qPos = QueryPos.getInstance(q);
3728
3729 qPos.add(pk);
3730
3731 count = (Long)q.uniqueResult();
3732 }
3733 catch (Exception e) {
3734 throw processException(e);
3735 }
3736 finally {
3737 if (count == null) {
3738 count = Long.valueOf(0);
3739 }
3740
3741 FinderCacheUtil.putResult(FINDER_PATH_GET_USERS_SIZE,
3742 finderArgs, count);
3743
3744 closeSession(session);
3745 }
3746 }
3747
3748 return count.intValue();
3749 }
3750
3751 public static final FinderPath FINDER_PATH_CONTAINS_USER = new FinderPath(com.liferay.portal.model.impl.UserModelImpl.ENTITY_CACHE_ENABLED,
3752 GroupModelImpl.FINDER_CACHE_ENABLED_USERS_GROUPS, "Users_Groups",
3753 "containsUser",
3754 new String[] { Long.class.getName(), Long.class.getName() });
3755
3756 public boolean containsUser(long pk, long userPK) throws SystemException {
3757 Object[] finderArgs = new Object[] { new Long(pk), new Long(userPK) };
3758
3759 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_USER,
3760 finderArgs, this);
3761
3762 if (value == null) {
3763 try {
3764 value = Boolean.valueOf(containsUser.contains(pk, userPK));
3765 }
3766 catch (Exception e) {
3767 throw processException(e);
3768 }
3769 finally {
3770 if (value == null) {
3771 value = Boolean.FALSE;
3772 }
3773
3774 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_USER,
3775 finderArgs, value);
3776 }
3777 }
3778
3779 return value.booleanValue();
3780 }
3781
3782 public boolean containsUsers(long pk) throws SystemException {
3783 if (getUsersSize(pk) > 0) {
3784 return true;
3785 }
3786 else {
3787 return false;
3788 }
3789 }
3790
3791 public void addUser(long pk, long userPK) throws SystemException {
3792 try {
3793 addUser.add(pk, userPK);
3794 }
3795 catch (Exception e) {
3796 throw processException(e);
3797 }
3798 finally {
3799 FinderCacheUtil.clearCache("Users_Groups");
3800 }
3801 }
3802
3803 public void addUser(long pk, com.liferay.portal.model.User user)
3804 throws SystemException {
3805 try {
3806 addUser.add(pk, user.getPrimaryKey());
3807 }
3808 catch (Exception e) {
3809 throw processException(e);
3810 }
3811 finally {
3812 FinderCacheUtil.clearCache("Users_Groups");
3813 }
3814 }
3815
3816 public void addUsers(long pk, long[] userPKs) throws SystemException {
3817 try {
3818 for (long userPK : userPKs) {
3819 addUser.add(pk, userPK);
3820 }
3821 }
3822 catch (Exception e) {
3823 throw processException(e);
3824 }
3825 finally {
3826 FinderCacheUtil.clearCache("Users_Groups");
3827 }
3828 }
3829
3830 public void addUsers(long pk, List<com.liferay.portal.model.User> users)
3831 throws SystemException {
3832 try {
3833 for (com.liferay.portal.model.User user : users) {
3834 addUser.add(pk, user.getPrimaryKey());
3835 }
3836 }
3837 catch (Exception e) {
3838 throw processException(e);
3839 }
3840 finally {
3841 FinderCacheUtil.clearCache("Users_Groups");
3842 }
3843 }
3844
3845 public void clearUsers(long pk) throws SystemException {
3846 try {
3847 clearUsers.clear(pk);
3848 }
3849 catch (Exception e) {
3850 throw processException(e);
3851 }
3852 finally {
3853 FinderCacheUtil.clearCache("Users_Groups");
3854 }
3855 }
3856
3857 public void removeUser(long pk, long userPK) throws SystemException {
3858 try {
3859 removeUser.remove(pk, userPK);
3860 }
3861 catch (Exception e) {
3862 throw processException(e);
3863 }
3864 finally {
3865 FinderCacheUtil.clearCache("Users_Groups");
3866 }
3867 }
3868
3869 public void removeUser(long pk, com.liferay.portal.model.User user)
3870 throws SystemException {
3871 try {
3872 removeUser.remove(pk, user.getPrimaryKey());
3873 }
3874 catch (Exception e) {
3875 throw processException(e);
3876 }
3877 finally {
3878 FinderCacheUtil.clearCache("Users_Groups");
3879 }
3880 }
3881
3882 public void removeUsers(long pk, long[] userPKs) throws SystemException {
3883 try {
3884 for (long userPK : userPKs) {
3885 removeUser.remove(pk, userPK);
3886 }
3887 }
3888 catch (Exception e) {
3889 throw processException(e);
3890 }
3891 finally {
3892 FinderCacheUtil.clearCache("Users_Groups");
3893 }
3894 }
3895
3896 public void removeUsers(long pk, List<com.liferay.portal.model.User> users)
3897 throws SystemException {
3898 try {
3899 for (com.liferay.portal.model.User user : users) {
3900 removeUser.remove(pk, user.getPrimaryKey());
3901 }
3902 }
3903 catch (Exception e) {
3904 throw processException(e);
3905 }
3906 finally {
3907 FinderCacheUtil.clearCache("Users_Groups");
3908 }
3909 }
3910
3911 public void setUsers(long pk, long[] userPKs) throws SystemException {
3912 try {
3913 clearUsers.clear(pk);
3914
3915 for (long userPK : userPKs) {
3916 addUser.add(pk, userPK);
3917 }
3918 }
3919 catch (Exception e) {
3920 throw processException(e);
3921 }
3922 finally {
3923 FinderCacheUtil.clearCache("Users_Groups");
3924 }
3925 }
3926
3927 public void setUsers(long pk, List<com.liferay.portal.model.User> users)
3928 throws SystemException {
3929 try {
3930 clearUsers.clear(pk);
3931
3932 for (com.liferay.portal.model.User user : users) {
3933 addUser.add(pk, user.getPrimaryKey());
3934 }
3935 }
3936 catch (Exception e) {
3937 throw processException(e);
3938 }
3939 finally {
3940 FinderCacheUtil.clearCache("Users_Groups");
3941 }
3942 }
3943
3944 public void afterPropertiesSet() {
3945 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
3946 com.liferay.portal.util.PropsUtil.get(
3947 "value.object.listener.com.liferay.portal.model.Group")));
3948
3949 if (listenerClassNames.length > 0) {
3950 try {
3951 List<ModelListener<Group>> listenersList = new ArrayList<ModelListener<Group>>();
3952
3953 for (String listenerClassName : listenerClassNames) {
3954 listenersList.add((ModelListener<Group>)Class.forName(
3955 listenerClassName).newInstance());
3956 }
3957
3958 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3959 }
3960 catch (Exception e) {
3961 _log.error(e);
3962 }
3963 }
3964
3965 containsOrganization = new ContainsOrganization(this);
3966
3967 addOrganization = new AddOrganization(this);
3968 clearOrganizations = new ClearOrganizations(this);
3969 removeOrganization = new RemoveOrganization(this);
3970
3971 containsPermission = new ContainsPermission(this);
3972
3973 addPermission = new AddPermission(this);
3974 clearPermissions = new ClearPermissions(this);
3975 removePermission = new RemovePermission(this);
3976
3977 containsRole = new ContainsRole(this);
3978
3979 addRole = new AddRole(this);
3980 clearRoles = new ClearRoles(this);
3981 removeRole = new RemoveRole(this);
3982
3983 containsUserGroup = new ContainsUserGroup(this);
3984
3985 addUserGroup = new AddUserGroup(this);
3986 clearUserGroups = new ClearUserGroups(this);
3987 removeUserGroup = new RemoveUserGroup(this);
3988
3989 containsUser = new ContainsUser(this);
3990
3991 addUser = new AddUser(this);
3992 clearUsers = new ClearUsers(this);
3993 removeUser = new RemoveUser(this);
3994 }
3995
3996 @BeanReference(name = "com.liferay.portal.service.persistence.AccountPersistence.impl")
3997 protected com.liferay.portal.service.persistence.AccountPersistence accountPersistence;
3998 @BeanReference(name = "com.liferay.portal.service.persistence.AddressPersistence.impl")
3999 protected com.liferay.portal.service.persistence.AddressPersistence addressPersistence;
4000 @BeanReference(name = "com.liferay.portal.service.persistence.BrowserTrackerPersistence.impl")
4001 protected com.liferay.portal.service.persistence.BrowserTrackerPersistence browserTrackerPersistence;
4002 @BeanReference(name = "com.liferay.portal.service.persistence.ClassNamePersistence.impl")
4003 protected com.liferay.portal.service.persistence.ClassNamePersistence classNamePersistence;
4004 @BeanReference(name = "com.liferay.portal.service.persistence.CompanyPersistence.impl")
4005 protected com.liferay.portal.service.persistence.CompanyPersistence companyPersistence;
4006 @BeanReference(name = "com.liferay.portal.service.persistence.ContactPersistence.impl")
4007 protected com.liferay.portal.service.persistence.ContactPersistence contactPersistence;
4008 @BeanReference(name = "com.liferay.portal.service.persistence.CountryPersistence.impl")
4009 protected com.liferay.portal.service.persistence.CountryPersistence countryPersistence;
4010 @BeanReference(name = "com.liferay.portal.service.persistence.EmailAddressPersistence.impl")
4011 protected com.liferay.portal.service.persistence.EmailAddressPersistence emailAddressPersistence;
4012 @BeanReference(name = "com.liferay.portal.service.persistence.GroupPersistence.impl")
4013 protected com.liferay.portal.service.persistence.GroupPersistence groupPersistence;
4014 @BeanReference(name = "com.liferay.portal.service.persistence.ImagePersistence.impl")
4015 protected com.liferay.portal.service.persistence.ImagePersistence imagePersistence;
4016 @BeanReference(name = "com.liferay.portal.service.persistence.LayoutPersistence.impl")
4017 protected com.liferay.portal.service.persistence.LayoutPersistence layoutPersistence;
4018 @BeanReference(name = "com.liferay.portal.service.persistence.LayoutSetPersistence.impl")
4019 protected com.liferay.portal.service.persistence.LayoutSetPersistence layoutSetPersistence;
4020 @BeanReference(name = "com.liferay.portal.service.persistence.ListTypePersistence.impl")
4021 protected com.liferay.portal.service.persistence.ListTypePersistence listTypePersistence;
4022 @BeanReference(name = "com.liferay.portal.service.persistence.MembershipRequestPersistence.impl")
4023 protected com.liferay.portal.service.persistence.MembershipRequestPersistence membershipRequestPersistence;
4024 @BeanReference(name = "com.liferay.portal.service.persistence.OrganizationPersistence.impl")
4025 protected com.liferay.portal.service.persistence.OrganizationPersistence organizationPersistence;
4026 @BeanReference(name = "com.liferay.portal.service.persistence.OrgGroupPermissionPersistence.impl")
4027 protected com.liferay.portal.service.persistence.OrgGroupPermissionPersistence orgGroupPermissionPersistence;
4028 @BeanReference(name = "com.liferay.portal.service.persistence.OrgGroupRolePersistence.impl")
4029 protected com.liferay.portal.service.persistence.OrgGroupRolePersistence orgGroupRolePersistence;
4030 @BeanReference(name = "com.liferay.portal.service.persistence.OrgLaborPersistence.impl")
4031 protected com.liferay.portal.service.persistence.OrgLaborPersistence orgLaborPersistence;
4032 @BeanReference(name = "com.liferay.portal.service.persistence.PasswordPolicyPersistence.impl")
4033 protected com.liferay.portal.service.persistence.PasswordPolicyPersistence passwordPolicyPersistence;
4034 @BeanReference(name = "com.liferay.portal.service.persistence.PasswordPolicyRelPersistence.impl")
4035 protected com.liferay.portal.service.persistence.PasswordPolicyRelPersistence passwordPolicyRelPersistence;
4036 @BeanReference(name = "com.liferay.portal.service.persistence.PasswordTrackerPersistence.impl")
4037 protected com.liferay.portal.service.persistence.PasswordTrackerPersistence passwordTrackerPersistence;
4038 @BeanReference(name = "com.liferay.portal.service.persistence.PermissionPersistence.impl")
4039 protected com.liferay.portal.service.persistence.PermissionPersistence permissionPersistence;
4040 @BeanReference(name = "com.liferay.portal.service.persistence.PhonePersistence.impl")
4041 protected com.liferay.portal.service.persistence.PhonePersistence phonePersistence;
4042 @BeanReference(name = "com.liferay.portal.service.persistence.PluginSettingPersistence.impl")
4043 protected com.liferay.portal.service.persistence.PluginSettingPersistence pluginSettingPersistence;
4044 @BeanReference(name = "com.liferay.portal.service.persistence.PortletPersistence.impl")
4045 protected com.liferay.portal.service.persistence.PortletPersistence portletPersistence;
4046 @BeanReference(name = "com.liferay.portal.service.persistence.PortletItemPersistence.impl")
4047 protected com.liferay.portal.service.persistence.PortletItemPersistence portletItemPersistence;
4048 @BeanReference(name = "com.liferay.portal.service.persistence.PortletPreferencesPersistence.impl")
4049 protected com.liferay.portal.service.persistence.PortletPreferencesPersistence portletPreferencesPersistence;
4050 @BeanReference(name = "com.liferay.portal.service.persistence.RegionPersistence.impl")
4051 protected com.liferay.portal.service.persistence.RegionPersistence regionPersistence;
4052 @BeanReference(name = "com.liferay.portal.service.persistence.ReleasePersistence.impl")
4053 protected com.liferay.portal.service.persistence.ReleasePersistence releasePersistence;
4054 @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePersistence.impl")
4055 protected com.liferay.portal.service.persistence.ResourcePersistence resourcePersistence;
4056 @BeanReference(name = "com.liferay.portal.service.persistence.ResourceActionPersistence.impl")
4057 protected com.liferay.portal.service.persistence.ResourceActionPersistence resourceActionPersistence;
4058 @BeanReference(name = "com.liferay.portal.service.persistence.ResourceCodePersistence.impl")
4059 protected com.liferay.portal.service.persistence.ResourceCodePersistence resourceCodePersistence;
4060 @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePermissionPersistence.impl")
4061 protected com.liferay.portal.service.persistence.ResourcePermissionPersistence resourcePermissionPersistence;
4062 @BeanReference(name = "com.liferay.portal.service.persistence.RolePersistence.impl")
4063 protected com.liferay.portal.service.persistence.RolePersistence rolePersistence;
4064 @BeanReference(name = "com.liferay.portal.service.persistence.ServiceComponentPersistence.impl")
4065 protected com.liferay.portal.service.persistence.ServiceComponentPersistence serviceComponentPersistence;
4066 @BeanReference(name = "com.liferay.portal.service.persistence.ShardPersistence.impl")
4067 protected com.liferay.portal.service.persistence.ShardPersistence shardPersistence;
4068 @BeanReference(name = "com.liferay.portal.service.persistence.SubscriptionPersistence.impl")
4069 protected com.liferay.portal.service.persistence.SubscriptionPersistence subscriptionPersistence;
4070 @BeanReference(name = "com.liferay.portal.service.persistence.UserPersistence.impl")
4071 protected com.liferay.portal.service.persistence.UserPersistence userPersistence;
4072 @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupPersistence.impl")
4073 protected com.liferay.portal.service.persistence.UserGroupPersistence userGroupPersistence;
4074 @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupRolePersistence.impl")
4075 protected com.liferay.portal.service.persistence.UserGroupRolePersistence userGroupRolePersistence;
4076 @BeanReference(name = "com.liferay.portal.service.persistence.UserIdMapperPersistence.impl")
4077 protected com.liferay.portal.service.persistence.UserIdMapperPersistence userIdMapperPersistence;
4078 @BeanReference(name = "com.liferay.portal.service.persistence.UserTrackerPersistence.impl")
4079 protected com.liferay.portal.service.persistence.UserTrackerPersistence userTrackerPersistence;
4080 @BeanReference(name = "com.liferay.portal.service.persistence.UserTrackerPathPersistence.impl")
4081 protected com.liferay.portal.service.persistence.UserTrackerPathPersistence userTrackerPathPersistence;
4082 @BeanReference(name = "com.liferay.portal.service.persistence.WebDAVPropsPersistence.impl")
4083 protected com.liferay.portal.service.persistence.WebDAVPropsPersistence webDAVPropsPersistence;
4084 @BeanReference(name = "com.liferay.portal.service.persistence.WebsitePersistence.impl")
4085 protected com.liferay.portal.service.persistence.WebsitePersistence websitePersistence;
4086 @BeanReference(name = "com.liferay.portlet.blogs.service.persistence.BlogsEntryPersistence.impl")
4087 protected com.liferay.portlet.blogs.service.persistence.BlogsEntryPersistence blogsEntryPersistence;
4088 @BeanReference(name = "com.liferay.portlet.blogs.service.persistence.BlogsStatsUserPersistence.impl")
4089 protected com.liferay.portlet.blogs.service.persistence.BlogsStatsUserPersistence blogsStatsUserPersistence;
4090 @BeanReference(name = "com.liferay.portlet.bookmarks.service.persistence.BookmarksFolderPersistence.impl")
4091 protected com.liferay.portlet.bookmarks.service.persistence.BookmarksFolderPersistence bookmarksFolderPersistence;
4092 @BeanReference(name = "com.liferay.portlet.calendar.service.persistence.CalEventPersistence.impl")
4093 protected com.liferay.portlet.calendar.service.persistence.CalEventPersistence calEventPersistence;
4094 @BeanReference(name = "com.liferay.portlet.documentlibrary.service.persistence.DLFolderPersistence.impl")
4095 protected com.liferay.portlet.documentlibrary.service.persistence.DLFolderPersistence dlFolderPersistence;
4096 @BeanReference(name = "com.liferay.portlet.imagegallery.service.persistence.IGFolderPersistence.impl")
4097 protected com.liferay.portlet.imagegallery.service.persistence.IGFolderPersistence igFolderPersistence;
4098 @BeanReference(name = "com.liferay.portlet.journal.service.persistence.JournalArticlePersistence.impl")
4099 protected com.liferay.portlet.journal.service.persistence.JournalArticlePersistence journalArticlePersistence;
4100 @BeanReference(name = "com.liferay.portlet.journal.service.persistence.JournalStructurePersistence.impl")
4101 protected com.liferay.portlet.journal.service.persistence.JournalStructurePersistence journalStructurePersistence;
4102 @BeanReference(name = "com.liferay.portlet.journal.service.persistence.JournalTemplatePersistence.impl")
4103 protected com.liferay.portlet.journal.service.persistence.JournalTemplatePersistence journalTemplatePersistence;
4104 @BeanReference(name = "com.liferay.portlet.messageboards.service.persistence.MBBanPersistence.impl")
4105 protected com.liferay.portlet.messageboards.service.persistence.MBBanPersistence mbBanPersistence;
4106 @BeanReference(name = "com.liferay.portlet.messageboards.service.persistence.MBCategoryPersistence.impl")
4107 protected com.liferay.portlet.messageboards.service.persistence.MBCategoryPersistence mbCategoryPersistence;
4108 @BeanReference(name = "com.liferay.portlet.messageboards.service.persistence.MBStatsUserPersistence.impl")
4109 protected com.liferay.portlet.messageboards.service.persistence.MBStatsUserPersistence mbStatsUserPersistence;
4110 @BeanReference(name = "com.liferay.portlet.polls.service.persistence.PollsQuestionPersistence.impl")
4111 protected com.liferay.portlet.polls.service.persistence.PollsQuestionPersistence pollsQuestionPersistence;
4112 @BeanReference(name = "com.liferay.portlet.shopping.service.persistence.ShoppingCartPersistence.impl")
4113 protected com.liferay.portlet.shopping.service.persistence.ShoppingCartPersistence shoppingCartPersistence;
4114 @BeanReference(name = "com.liferay.portlet.shopping.service.persistence.ShoppingCategoryPersistence.impl")
4115 protected com.liferay.portlet.shopping.service.persistence.ShoppingCategoryPersistence shoppingCategoryPersistence;
4116 @BeanReference(name = "com.liferay.portlet.shopping.service.persistence.ShoppingCouponPersistence.impl")
4117 protected com.liferay.portlet.shopping.service.persistence.ShoppingCouponPersistence shoppingCouponPersistence;
4118 @BeanReference(name = "com.liferay.portlet.shopping.service.persistence.ShoppingOrderPersistence.impl")
4119 protected com.liferay.portlet.shopping.service.persistence.ShoppingOrderPersistence shoppingOrderPersistence;
4120 @BeanReference(name = "com.liferay.portlet.softwarecatalog.service.persistence.SCFrameworkVersionPersistence.impl")
4121 protected com.liferay.portlet.softwarecatalog.service.persistence.SCFrameworkVersionPersistence scFrameworkVersionPersistence;
4122 @BeanReference(name = "com.liferay.portlet.softwarecatalog.service.persistence.SCProductEntryPersistence.impl")
4123 protected com.liferay.portlet.softwarecatalog.service.persistence.SCProductEntryPersistence scProductEntryPersistence;
4124 @BeanReference(name = "com.liferay.portlet.tasks.service.persistence.TasksProposalPersistence.impl")
4125 protected com.liferay.portlet.tasks.service.persistence.TasksProposalPersistence tasksProposalPersistence;
4126 @BeanReference(name = "com.liferay.portlet.wiki.service.persistence.WikiNodePersistence.impl")
4127 protected com.liferay.portlet.wiki.service.persistence.WikiNodePersistence wikiNodePersistence;
4128 protected ContainsOrganization containsOrganization;
4129 protected AddOrganization addOrganization;
4130 protected ClearOrganizations clearOrganizations;
4131 protected RemoveOrganization removeOrganization;
4132 protected ContainsPermission containsPermission;
4133 protected AddPermission addPermission;
4134 protected ClearPermissions clearPermissions;
4135 protected RemovePermission removePermission;
4136 protected ContainsRole containsRole;
4137 protected AddRole addRole;
4138 protected ClearRoles clearRoles;
4139 protected RemoveRole removeRole;
4140 protected ContainsUserGroup containsUserGroup;
4141 protected AddUserGroup addUserGroup;
4142 protected ClearUserGroups clearUserGroups;
4143 protected RemoveUserGroup removeUserGroup;
4144 protected ContainsUser containsUser;
4145 protected AddUser addUser;
4146 protected ClearUsers clearUsers;
4147 protected RemoveUser removeUser;
4148
4149 protected class ContainsOrganization {
4150 protected ContainsOrganization(GroupPersistenceImpl persistenceImpl) {
4151 super();
4152
4153 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
4154 _SQL_CONTAINSORGANIZATION,
4155 new int[] { Types.BIGINT, Types.BIGINT }, RowMapper.COUNT);
4156 }
4157
4158 protected boolean contains(long groupId, long organizationId) {
4159 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
4160 new Long(groupId), new Long(organizationId)
4161 });
4162
4163 if (results.size() > 0) {
4164 Integer count = results.get(0);
4165
4166 if (count.intValue() > 0) {
4167 return true;
4168 }
4169 }
4170
4171 return false;
4172 }
4173
4174 private MappingSqlQuery _mappingSqlQuery;
4175 }
4176
4177 protected class AddOrganization {
4178 protected AddOrganization(GroupPersistenceImpl persistenceImpl) {
4179 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
4180 "INSERT INTO Groups_Orgs (groupId, organizationId) VALUES (?, ?)",
4181 new int[] { Types.BIGINT, Types.BIGINT });
4182 _persistenceImpl = persistenceImpl;
4183 }
4184
4185 protected void add(long groupId, long organizationId) {
4186 if (!_persistenceImpl.containsOrganization.contains(groupId,
4187 organizationId)) {
4188 _sqlUpdate.update(new Object[] {
4189 new Long(groupId), new Long(organizationId)
4190 });
4191 }
4192 }
4193
4194 private SqlUpdate _sqlUpdate;
4195 private GroupPersistenceImpl _persistenceImpl;
4196 }
4197
4198 protected class ClearOrganizations {
4199 protected ClearOrganizations(GroupPersistenceImpl persistenceImpl) {
4200 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
4201 "DELETE FROM Groups_Orgs WHERE groupId = ?",
4202 new int[] { Types.BIGINT });
4203 }
4204
4205 protected void clear(long groupId) {
4206 _sqlUpdate.update(new Object[] { new Long(groupId) });
4207 }
4208
4209 private SqlUpdate _sqlUpdate;
4210 }
4211
4212 protected class RemoveOrganization {
4213 protected RemoveOrganization(GroupPersistenceImpl persistenceImpl) {
4214 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
4215 "DELETE FROM Groups_Orgs WHERE groupId = ? AND organizationId = ?",
4216 new int[] { Types.BIGINT, Types.BIGINT });
4217 }
4218
4219 protected void remove(long groupId, long organizationId) {
4220 _sqlUpdate.update(new Object[] {
4221 new Long(groupId), new Long(organizationId)
4222 });
4223 }
4224
4225 private SqlUpdate _sqlUpdate;
4226 }
4227
4228 protected class ContainsPermission {
4229 protected ContainsPermission(GroupPersistenceImpl persistenceImpl) {
4230 super();
4231
4232 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
4233 _SQL_CONTAINSPERMISSION,
4234 new int[] { Types.BIGINT, Types.BIGINT }, RowMapper.COUNT);
4235 }
4236
4237 protected boolean contains(long groupId, long permissionId) {
4238 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
4239 new Long(groupId), new Long(permissionId)
4240 });
4241
4242 if (results.size() > 0) {
4243 Integer count = results.get(0);
4244
4245 if (count.intValue() > 0) {
4246 return true;
4247 }
4248 }
4249
4250 return false;
4251 }
4252
4253 private MappingSqlQuery _mappingSqlQuery;
4254 }
4255
4256 protected class AddPermission {
4257 protected AddPermission(GroupPersistenceImpl persistenceImpl) {
4258 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
4259 "INSERT INTO Groups_Permissions (groupId, permissionId) VALUES (?, ?)",
4260 new int[] { Types.BIGINT, Types.BIGINT });
4261 _persistenceImpl = persistenceImpl;
4262 }
4263
4264 protected void add(long groupId, long permissionId) {
4265 if (!_persistenceImpl.containsPermission.contains(groupId,
4266 permissionId)) {
4267 _sqlUpdate.update(new Object[] {
4268 new Long(groupId), new Long(permissionId)
4269 });
4270 }
4271 }
4272
4273 private SqlUpdate _sqlUpdate;
4274 private GroupPersistenceImpl _persistenceImpl;
4275 }
4276
4277 protected class ClearPermissions {
4278 protected ClearPermissions(GroupPersistenceImpl persistenceImpl) {
4279 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
4280 "DELETE FROM Groups_Permissions WHERE groupId = ?",
4281 new int[] { Types.BIGINT });
4282 }
4283
4284 protected void clear(long groupId) {
4285 _sqlUpdate.update(new Object[] { new Long(groupId) });
4286 }
4287
4288 private SqlUpdate _sqlUpdate;
4289 }
4290
4291 protected class RemovePermission {
4292 protected RemovePermission(GroupPersistenceImpl persistenceImpl) {
4293 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
4294 "DELETE FROM Groups_Permissions WHERE groupId = ? AND permissionId = ?",
4295 new int[] { Types.BIGINT, Types.BIGINT });
4296 }
4297
4298 protected void remove(long groupId, long permissionId) {
4299 _sqlUpdate.update(new Object[] {
4300 new Long(groupId), new Long(permissionId)
4301 });
4302 }
4303
4304 private SqlUpdate _sqlUpdate;
4305 }
4306
4307 protected class ContainsRole {
4308 protected ContainsRole(GroupPersistenceImpl persistenceImpl) {
4309 super();
4310
4311 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
4312 _SQL_CONTAINSROLE,
4313 new int[] { Types.BIGINT, Types.BIGINT }, RowMapper.COUNT);
4314 }
4315
4316 protected boolean contains(long groupId, long roleId) {
4317 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
4318 new Long(groupId), new Long(roleId)
4319 });
4320
4321 if (results.size() > 0) {
4322 Integer count = results.get(0);
4323
4324 if (count.intValue() > 0) {
4325 return true;
4326 }
4327 }
4328
4329 return false;
4330 }
4331
4332 private MappingSqlQuery _mappingSqlQuery;
4333 }
4334
4335 protected class AddRole {
4336 protected AddRole(GroupPersistenceImpl persistenceImpl) {
4337 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
4338 "INSERT INTO Groups_Roles (groupId, roleId) VALUES (?, ?)",
4339 new int[] { Types.BIGINT, Types.BIGINT });
4340 _persistenceImpl = persistenceImpl;
4341 }
4342
4343 protected void add(long groupId, long roleId) {
4344 if (!_persistenceImpl.containsRole.contains(groupId, roleId)) {
4345 _sqlUpdate.update(new Object[] {
4346 new Long(groupId), new Long(roleId)
4347 });
4348 }
4349 }
4350
4351 private SqlUpdate _sqlUpdate;
4352 private GroupPersistenceImpl _persistenceImpl;
4353 }
4354
4355 protected class ClearRoles {
4356 protected ClearRoles(GroupPersistenceImpl persistenceImpl) {
4357 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
4358 "DELETE FROM Groups_Roles WHERE groupId = ?",
4359 new int[] { Types.BIGINT });
4360 }
4361
4362 protected void clear(long groupId) {
4363 _sqlUpdate.update(new Object[] { new Long(groupId) });
4364 }
4365
4366 private SqlUpdate _sqlUpdate;
4367 }
4368
4369 protected class RemoveRole {
4370 protected RemoveRole(GroupPersistenceImpl persistenceImpl) {
4371 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
4372 "DELETE FROM Groups_Roles WHERE groupId = ? AND roleId = ?",
4373 new int[] { Types.BIGINT, Types.BIGINT });
4374 }
4375
4376 protected void remove(long groupId, long roleId) {
4377 _sqlUpdate.update(new Object[] { new Long(groupId), new Long(roleId) });
4378 }
4379
4380 private SqlUpdate _sqlUpdate;
4381 }
4382
4383 protected class ContainsUserGroup {
4384 protected ContainsUserGroup(GroupPersistenceImpl persistenceImpl) {
4385 super();
4386
4387 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
4388 _SQL_CONTAINSUSERGROUP,
4389 new int[] { Types.BIGINT, Types.BIGINT }, RowMapper.COUNT);
4390 }
4391
4392 protected boolean contains(long groupId, long userGroupId) {
4393 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
4394 new Long(groupId), new Long(userGroupId)
4395 });
4396
4397 if (results.size() > 0) {
4398 Integer count = results.get(0);
4399
4400 if (count.intValue() > 0) {
4401 return true;
4402 }
4403 }
4404
4405 return false;
4406 }
4407
4408 private MappingSqlQuery _mappingSqlQuery;
4409 }
4410
4411 protected class AddUserGroup {
4412 protected AddUserGroup(GroupPersistenceImpl persistenceImpl) {
4413 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
4414 "INSERT INTO Groups_UserGroups (groupId, userGroupId) VALUES (?, ?)",
4415 new int[] { Types.BIGINT, Types.BIGINT });
4416 _persistenceImpl = persistenceImpl;
4417 }
4418
4419 protected void add(long groupId, long userGroupId) {
4420 if (!_persistenceImpl.containsUserGroup.contains(groupId,
4421 userGroupId)) {
4422 _sqlUpdate.update(new Object[] {
4423 new Long(groupId), new Long(userGroupId)
4424 });
4425 }
4426 }
4427
4428 private SqlUpdate _sqlUpdate;
4429 private GroupPersistenceImpl _persistenceImpl;
4430 }
4431
4432 protected class ClearUserGroups {
4433 protected ClearUserGroups(GroupPersistenceImpl persistenceImpl) {
4434 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
4435 "DELETE FROM Groups_UserGroups WHERE groupId = ?",
4436 new int[] { Types.BIGINT });
4437 }
4438
4439 protected void clear(long groupId) {
4440 _sqlUpdate.update(new Object[] { new Long(groupId) });
4441 }
4442
4443 private SqlUpdate _sqlUpdate;
4444 }
4445
4446 protected class RemoveUserGroup {
4447 protected RemoveUserGroup(GroupPersistenceImpl persistenceImpl) {
4448 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
4449 "DELETE FROM Groups_UserGroups WHERE groupId = ? AND userGroupId = ?",
4450 new int[] { Types.BIGINT, Types.BIGINT });
4451 }
4452
4453 protected void remove(long groupId, long userGroupId) {
4454 _sqlUpdate.update(new Object[] {
4455 new Long(groupId), new Long(userGroupId)
4456 });
4457 }
4458
4459 private SqlUpdate _sqlUpdate;
4460 }
4461
4462 protected class ContainsUser {
4463 protected ContainsUser(GroupPersistenceImpl persistenceImpl) {
4464 super();
4465
4466 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
4467 _SQL_CONTAINSUSER,
4468 new int[] { Types.BIGINT, Types.BIGINT }, RowMapper.COUNT);
4469 }
4470
4471 protected boolean contains(long groupId, long userId) {
4472 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
4473 new Long(groupId), new Long(userId)
4474 });
4475
4476 if (results.size() > 0) {
4477 Integer count = results.get(0);
4478
4479 if (count.intValue() > 0) {
4480 return true;
4481 }
4482 }
4483
4484 return false;
4485 }
4486
4487 private MappingSqlQuery _mappingSqlQuery;
4488 }
4489
4490 protected class AddUser {
4491 protected AddUser(GroupPersistenceImpl persistenceImpl) {
4492 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
4493 "INSERT INTO Users_Groups (groupId, userId) VALUES (?, ?)",
4494 new int[] { Types.BIGINT, Types.BIGINT });
4495 _persistenceImpl = persistenceImpl;
4496 }
4497
4498 protected void add(long groupId, long userId) {
4499 if (!_persistenceImpl.containsUser.contains(groupId, userId)) {
4500 _sqlUpdate.update(new Object[] {
4501 new Long(groupId), new Long(userId)
4502 });
4503 }
4504 }
4505
4506 private SqlUpdate _sqlUpdate;
4507 private GroupPersistenceImpl _persistenceImpl;
4508 }
4509
4510 protected class ClearUsers {
4511 protected ClearUsers(GroupPersistenceImpl persistenceImpl) {
4512 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
4513 "DELETE FROM Users_Groups WHERE groupId = ?",
4514 new int[] { Types.BIGINT });
4515 }
4516
4517 protected void clear(long groupId) {
4518 _sqlUpdate.update(new Object[] { new Long(groupId) });
4519 }
4520
4521 private SqlUpdate _sqlUpdate;
4522 }
4523
4524 protected class RemoveUser {
4525 protected RemoveUser(GroupPersistenceImpl persistenceImpl) {
4526 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
4527 "DELETE FROM Users_Groups WHERE groupId = ? AND userId = ?",
4528 new int[] { Types.BIGINT, Types.BIGINT });
4529 }
4530
4531 protected void remove(long groupId, long userId) {
4532 _sqlUpdate.update(new Object[] { new Long(groupId), new Long(userId) });
4533 }
4534
4535 private SqlUpdate _sqlUpdate;
4536 }
4537
4538 private static final String _SQL_GETORGANIZATIONS = "SELECT {Organization_.*} FROM Organization_ INNER JOIN Groups_Orgs ON (Groups_Orgs.organizationId = Organization_.organizationId) WHERE (Groups_Orgs.groupId = ?)";
4539 private static final String _SQL_GETORGANIZATIONSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM Groups_Orgs WHERE groupId = ?";
4540 private static final String _SQL_CONTAINSORGANIZATION = "SELECT COUNT(*) AS COUNT_VALUE FROM Groups_Orgs WHERE groupId = ? AND organizationId = ?";
4541 private static final String _SQL_GETPERMISSIONS = "SELECT {Permission_.*} FROM Permission_ INNER JOIN Groups_Permissions ON (Groups_Permissions.permissionId = Permission_.permissionId) WHERE (Groups_Permissions.groupId = ?)";
4542 private static final String _SQL_GETPERMISSIONSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM Groups_Permissions WHERE groupId = ?";
4543 private static final String _SQL_CONTAINSPERMISSION = "SELECT COUNT(*) AS COUNT_VALUE FROM Groups_Permissions WHERE groupId = ? AND permissionId = ?";
4544 private static final String _SQL_GETROLES = "SELECT {Role_.*} FROM Role_ INNER JOIN Groups_Roles ON (Groups_Roles.roleId = Role_.roleId) WHERE (Groups_Roles.groupId = ?)";
4545 private static final String _SQL_GETROLESSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM Groups_Roles WHERE groupId = ?";
4546 private static final String _SQL_CONTAINSROLE = "SELECT COUNT(*) AS COUNT_VALUE FROM Groups_Roles WHERE groupId = ? AND roleId = ?";
4547 private static final String _SQL_GETUSERGROUPS = "SELECT {UserGroup.*} FROM UserGroup INNER JOIN Groups_UserGroups ON (Groups_UserGroups.userGroupId = UserGroup.userGroupId) WHERE (Groups_UserGroups.groupId = ?)";
4548 private static final String _SQL_GETUSERGROUPSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM Groups_UserGroups WHERE groupId = ?";
4549 private static final String _SQL_CONTAINSUSERGROUP = "SELECT COUNT(*) AS COUNT_VALUE FROM Groups_UserGroups WHERE groupId = ? AND userGroupId = ?";
4550 private static final String _SQL_GETUSERS = "SELECT {User_.*} FROM User_ INNER JOIN Users_Groups ON (Users_Groups.userId = User_.userId) WHERE (Users_Groups.groupId = ?)";
4551 private static final String _SQL_GETUSERSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM Users_Groups WHERE groupId = ?";
4552 private static final String _SQL_CONTAINSUSER = "SELECT COUNT(*) AS COUNT_VALUE FROM Users_Groups WHERE groupId = ? AND userId = ?";
4553 private static Log _log = LogFactoryUtil.getLog(GroupPersistenceImpl.class);
4554}