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