001
014
015 package com.liferay.portal.service.persistence;
016
017 import com.liferay.portal.NoSuchGroupException;
018 import com.liferay.portal.NoSuchModelException;
019 import com.liferay.portal.kernel.annotation.BeanReference;
020 import com.liferay.portal.kernel.cache.CacheRegistryUtil;
021 import com.liferay.portal.kernel.dao.jdbc.MappingSqlQuery;
022 import com.liferay.portal.kernel.dao.jdbc.MappingSqlQueryFactoryUtil;
023 import com.liferay.portal.kernel.dao.jdbc.RowMapper;
024 import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
025 import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
026 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
027 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
028 import com.liferay.portal.kernel.dao.orm.FinderPath;
029 import com.liferay.portal.kernel.dao.orm.Query;
030 import com.liferay.portal.kernel.dao.orm.QueryPos;
031 import com.liferay.portal.kernel.dao.orm.QueryUtil;
032 import com.liferay.portal.kernel.dao.orm.SQLQuery;
033 import com.liferay.portal.kernel.dao.orm.Session;
034 import com.liferay.portal.kernel.exception.SystemException;
035 import com.liferay.portal.kernel.log.Log;
036 import com.liferay.portal.kernel.log.LogFactoryUtil;
037 import com.liferay.portal.kernel.util.GetterUtil;
038 import com.liferay.portal.kernel.util.InstanceFactory;
039 import com.liferay.portal.kernel.util.OrderByComparator;
040 import com.liferay.portal.kernel.util.SetUtil;
041 import com.liferay.portal.kernel.util.StringBundler;
042 import com.liferay.portal.kernel.util.StringPool;
043 import com.liferay.portal.kernel.util.StringUtil;
044 import com.liferay.portal.kernel.util.Validator;
045 import com.liferay.portal.model.Group;
046 import com.liferay.portal.model.ModelListener;
047 import com.liferay.portal.model.impl.GroupImpl;
048 import com.liferay.portal.model.impl.GroupModelImpl;
049 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
050
051 import com.liferay.portlet.asset.service.persistence.AssetEntryPersistence;
052 import com.liferay.portlet.blogs.service.persistence.BlogsEntryPersistence;
053 import com.liferay.portlet.blogs.service.persistence.BlogsStatsUserPersistence;
054 import com.liferay.portlet.bookmarks.service.persistence.BookmarksFolderPersistence;
055 import com.liferay.portlet.calendar.service.persistence.CalEventPersistence;
056 import com.liferay.portlet.documentlibrary.service.persistence.DLFolderPersistence;
057 import com.liferay.portlet.imagegallery.service.persistence.IGFolderPersistence;
058 import com.liferay.portlet.journal.service.persistence.JournalArticlePersistence;
059 import com.liferay.portlet.journal.service.persistence.JournalStructurePersistence;
060 import com.liferay.portlet.journal.service.persistence.JournalTemplatePersistence;
061 import com.liferay.portlet.messageboards.service.persistence.MBBanPersistence;
062 import com.liferay.portlet.messageboards.service.persistence.MBCategoryPersistence;
063 import com.liferay.portlet.messageboards.service.persistence.MBStatsUserPersistence;
064 import com.liferay.portlet.polls.service.persistence.PollsQuestionPersistence;
065 import com.liferay.portlet.shopping.service.persistence.ShoppingCartPersistence;
066 import com.liferay.portlet.shopping.service.persistence.ShoppingCategoryPersistence;
067 import com.liferay.portlet.shopping.service.persistence.ShoppingCouponPersistence;
068 import com.liferay.portlet.shopping.service.persistence.ShoppingOrderPersistence;
069 import com.liferay.portlet.softwarecatalog.service.persistence.SCFrameworkVersionPersistence;
070 import com.liferay.portlet.softwarecatalog.service.persistence.SCProductEntryPersistence;
071 import com.liferay.portlet.tasks.service.persistence.TasksProposalPersistence;
072 import com.liferay.portlet.wiki.service.persistence.WikiNodePersistence;
073
074 import java.io.Serializable;
075
076 import java.util.ArrayList;
077 import java.util.Collections;
078 import java.util.List;
079 import java.util.Set;
080
081
097 public class GroupPersistenceImpl extends BasePersistenceImpl<Group>
098 implements GroupPersistence {
099 public static final String FINDER_CLASS_NAME_ENTITY = GroupImpl.class.getName();
100 public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
101 ".List";
102 public static final FinderPath FINDER_PATH_FIND_BY_COMPANYID = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
103 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
104 "findByCompanyId",
105 new String[] {
106 Long.class.getName(),
107
108 "java.lang.Integer", "java.lang.Integer",
109 "com.liferay.portal.kernel.util.OrderByComparator"
110 });
111 public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
112 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
113 "countByCompanyId", new String[] { Long.class.getName() });
114 public static final FinderPath FINDER_PATH_FETCH_BY_LIVEGROUPID = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
115 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
116 "fetchByLiveGroupId", new String[] { Long.class.getName() });
117 public static final FinderPath FINDER_PATH_COUNT_BY_LIVEGROUPID = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
118 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
119 "countByLiveGroupId", new String[] { Long.class.getName() });
120 public static final FinderPath FINDER_PATH_FETCH_BY_C_N = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
121 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
122 "fetchByC_N",
123 new String[] { Long.class.getName(), String.class.getName() });
124 public static final FinderPath FINDER_PATH_COUNT_BY_C_N = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
125 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
126 "countByC_N",
127 new String[] { Long.class.getName(), String.class.getName() });
128 public static final FinderPath FINDER_PATH_FETCH_BY_C_F = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
129 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
130 "fetchByC_F",
131 new String[] { Long.class.getName(), String.class.getName() });
132 public static final FinderPath FINDER_PATH_COUNT_BY_C_F = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
133 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
134 "countByC_F",
135 new String[] { Long.class.getName(), String.class.getName() });
136 public static final FinderPath FINDER_PATH_FIND_BY_T_A = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
137 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
138 "findByT_A",
139 new String[] {
140 Integer.class.getName(), Boolean.class.getName(),
141
142 "java.lang.Integer", "java.lang.Integer",
143 "com.liferay.portal.kernel.util.OrderByComparator"
144 });
145 public static final FinderPath FINDER_PATH_COUNT_BY_T_A = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
146 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
147 "countByT_A",
148 new String[] { Integer.class.getName(), Boolean.class.getName() });
149 public static final FinderPath FINDER_PATH_FETCH_BY_C_C_C = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
150 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
151 "fetchByC_C_C",
152 new String[] {
153 Long.class.getName(), Long.class.getName(), Long.class.getName()
154 });
155 public static final FinderPath FINDER_PATH_COUNT_BY_C_C_C = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
156 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
157 "countByC_C_C",
158 new String[] {
159 Long.class.getName(), Long.class.getName(), Long.class.getName()
160 });
161 public static final FinderPath FINDER_PATH_FETCH_BY_C_L_N = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
162 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
163 "fetchByC_L_N",
164 new String[] {
165 Long.class.getName(), Long.class.getName(),
166 String.class.getName()
167 });
168 public static final FinderPath FINDER_PATH_COUNT_BY_C_L_N = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
169 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
170 "countByC_L_N",
171 new String[] {
172 Long.class.getName(), Long.class.getName(),
173 String.class.getName()
174 });
175 public static final FinderPath FINDER_PATH_FETCH_BY_C_C_L_N = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
176 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
177 "fetchByC_C_L_N",
178 new String[] {
179 Long.class.getName(), Long.class.getName(), Long.class.getName(),
180 String.class.getName()
181 });
182 public static final FinderPath FINDER_PATH_COUNT_BY_C_C_L_N = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
183 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
184 "countByC_C_L_N",
185 new String[] {
186 Long.class.getName(), Long.class.getName(), Long.class.getName(),
187 String.class.getName()
188 });
189 public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
190 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
191 "findAll", new String[0]);
192 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(GroupModelImpl.ENTITY_CACHE_ENABLED,
193 GroupModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
194 "countAll", new String[0]);
195
196
201 public void cacheResult(Group group) {
202 EntityCacheUtil.putResult(GroupModelImpl.ENTITY_CACHE_ENABLED,
203 GroupImpl.class, group.getPrimaryKey(), group);
204
205 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LIVEGROUPID,
206 new Object[] { new Long(group.getLiveGroupId()) }, group);
207
208 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_N,
209 new Object[] { new Long(group.getCompanyId()), group.getName() },
210 group);
211
212 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_F,
213 new Object[] { new Long(group.getCompanyId()), group.getFriendlyURL() },
214 group);
215
216 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C_C,
217 new Object[] {
218 new Long(group.getCompanyId()), new Long(group.getClassNameId()),
219 new Long(group.getClassPK())
220 }, group);
221
222 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_L_N,
223 new Object[] {
224 new Long(group.getCompanyId()), new Long(group.getLiveGroupId()),
225
226 group.getName()
227 }, group);
228
229 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C_L_N,
230 new Object[] {
231 new Long(group.getCompanyId()), new Long(group.getClassNameId()),
232 new Long(group.getLiveGroupId()),
233
234 group.getName()
235 }, group);
236 }
237
238
243 public void cacheResult(List<Group> groups) {
244 for (Group group : groups) {
245 if (EntityCacheUtil.getResult(GroupModelImpl.ENTITY_CACHE_ENABLED,
246 GroupImpl.class, group.getPrimaryKey(), this) == null) {
247 cacheResult(group);
248 }
249 }
250 }
251
252
259 public void clearCache() {
260 CacheRegistryUtil.clear(GroupImpl.class.getName());
261 EntityCacheUtil.clearCache(GroupImpl.class.getName());
262 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
263 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
264 }
265
266
273 public void clearCache(Group group) {
274 EntityCacheUtil.removeResult(GroupModelImpl.ENTITY_CACHE_ENABLED,
275 GroupImpl.class, group.getPrimaryKey());
276
277 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_LIVEGROUPID,
278 new Object[] { new Long(group.getLiveGroupId()) });
279
280 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_N,
281 new Object[] { new Long(group.getCompanyId()), group.getName() });
282
283 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_F,
284 new Object[] { new Long(group.getCompanyId()), group.getFriendlyURL() });
285
286 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C_C,
287 new Object[] {
288 new Long(group.getCompanyId()), new Long(group.getClassNameId()),
289 new Long(group.getClassPK())
290 });
291
292 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_L_N,
293 new Object[] {
294 new Long(group.getCompanyId()), new Long(group.getLiveGroupId()),
295
296 group.getName()
297 });
298
299 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C_L_N,
300 new Object[] {
301 new Long(group.getCompanyId()), new Long(group.getClassNameId()),
302 new Long(group.getLiveGroupId()),
303
304 group.getName()
305 });
306 }
307
308
314 public Group create(long groupId) {
315 Group group = new GroupImpl();
316
317 group.setNew(true);
318 group.setPrimaryKey(groupId);
319
320 return group;
321 }
322
323
331 public Group remove(Serializable primaryKey)
332 throws NoSuchModelException, SystemException {
333 return remove(((Long)primaryKey).longValue());
334 }
335
336
344 public Group remove(long groupId)
345 throws NoSuchGroupException, SystemException {
346 Session session = null;
347
348 try {
349 session = openSession();
350
351 Group group = (Group)session.get(GroupImpl.class, new Long(groupId));
352
353 if (group == null) {
354 if (_log.isWarnEnabled()) {
355 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + groupId);
356 }
357
358 throw new NoSuchGroupException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
359 groupId);
360 }
361
362 return remove(group);
363 }
364 catch (NoSuchGroupException nsee) {
365 throw nsee;
366 }
367 catch (Exception e) {
368 throw processException(e);
369 }
370 finally {
371 closeSession(session);
372 }
373 }
374
375 protected Group removeImpl(Group group) throws SystemException {
376 group = toUnwrappedModel(group);
377
378 try {
379 clearOrganizations.clear(group.getPrimaryKey());
380 }
381 catch (Exception e) {
382 throw processException(e);
383 }
384 finally {
385 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ORGS_NAME);
386 }
387
388 try {
389 clearPermissions.clear(group.getPrimaryKey());
390 }
391 catch (Exception e) {
392 throw processException(e);
393 }
394 finally {
395 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_PERMISSIONS_NAME);
396 }
397
398 try {
399 clearRoles.clear(group.getPrimaryKey());
400 }
401 catch (Exception e) {
402 throw processException(e);
403 }
404 finally {
405 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ROLES_NAME);
406 }
407
408 try {
409 clearUserGroups.clear(group.getPrimaryKey());
410 }
411 catch (Exception e) {
412 throw processException(e);
413 }
414 finally {
415 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_USERGROUPS_NAME);
416 }
417
418 try {
419 clearUsers.clear(group.getPrimaryKey());
420 }
421 catch (Exception e) {
422 throw processException(e);
423 }
424 finally {
425 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
426 }
427
428 Session session = null;
429
430 try {
431 session = openSession();
432
433 BatchSessionUtil.delete(session, group);
434 }
435 catch (Exception e) {
436 throw processException(e);
437 }
438 finally {
439 closeSession(session);
440 }
441
442 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
443
444 GroupModelImpl groupModelImpl = (GroupModelImpl)group;
445
446 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_LIVEGROUPID,
447 new Object[] { new Long(groupModelImpl.getLiveGroupId()) });
448
449 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_N,
450 new Object[] {
451 new Long(groupModelImpl.getCompanyId()),
452
453 groupModelImpl.getName()
454 });
455
456 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_F,
457 new Object[] {
458 new Long(groupModelImpl.getCompanyId()),
459
460 groupModelImpl.getFriendlyURL()
461 });
462
463 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C_C,
464 new Object[] {
465 new Long(groupModelImpl.getCompanyId()),
466 new Long(groupModelImpl.getClassNameId()),
467 new Long(groupModelImpl.getClassPK())
468 });
469
470 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_L_N,
471 new Object[] {
472 new Long(groupModelImpl.getCompanyId()),
473 new Long(groupModelImpl.getLiveGroupId()),
474
475 groupModelImpl.getName()
476 });
477
478 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C_L_N,
479 new Object[] {
480 new Long(groupModelImpl.getCompanyId()),
481 new Long(groupModelImpl.getClassNameId()),
482 new Long(groupModelImpl.getLiveGroupId()),
483
484 groupModelImpl.getName()
485 });
486
487 EntityCacheUtil.removeResult(GroupModelImpl.ENTITY_CACHE_ENABLED,
488 GroupImpl.class, group.getPrimaryKey());
489
490 return group;
491 }
492
493 public Group updateImpl(com.liferay.portal.model.Group group, boolean merge)
494 throws SystemException {
495 group = toUnwrappedModel(group);
496
497 boolean isNew = group.isNew();
498
499 GroupModelImpl groupModelImpl = (GroupModelImpl)group;
500
501 Session session = null;
502
503 try {
504 session = openSession();
505
506 BatchSessionUtil.update(session, group, merge);
507
508 group.setNew(false);
509 }
510 catch (Exception e) {
511 throw processException(e);
512 }
513 finally {
514 closeSession(session);
515 }
516
517 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
518
519 EntityCacheUtil.putResult(GroupModelImpl.ENTITY_CACHE_ENABLED,
520 GroupImpl.class, group.getPrimaryKey(), group);
521
522 if (!isNew &&
523 (group.getLiveGroupId() != groupModelImpl.getOriginalLiveGroupId())) {
524 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_LIVEGROUPID,
525 new Object[] { new Long(groupModelImpl.getOriginalLiveGroupId()) });
526 }
527
528 if (isNew ||
529 (group.getLiveGroupId() != groupModelImpl.getOriginalLiveGroupId())) {
530 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LIVEGROUPID,
531 new Object[] { new Long(group.getLiveGroupId()) }, group);
532 }
533
534 if (!isNew &&
535 ((group.getCompanyId() != groupModelImpl.getOriginalCompanyId()) ||
536 !Validator.equals(group.getName(),
537 groupModelImpl.getOriginalName()))) {
538 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_N,
539 new Object[] {
540 new Long(groupModelImpl.getOriginalCompanyId()),
541
542 groupModelImpl.getOriginalName()
543 });
544 }
545
546 if (isNew ||
547 ((group.getCompanyId() != groupModelImpl.getOriginalCompanyId()) ||
548 !Validator.equals(group.getName(),
549 groupModelImpl.getOriginalName()))) {
550 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_N,
551 new Object[] { new Long(group.getCompanyId()), group.getName() },
552 group);
553 }
554
555 if (!isNew &&
556 ((group.getCompanyId() != groupModelImpl.getOriginalCompanyId()) ||
557 !Validator.equals(group.getFriendlyURL(),
558 groupModelImpl.getOriginalFriendlyURL()))) {
559 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_F,
560 new Object[] {
561 new Long(groupModelImpl.getOriginalCompanyId()),
562
563 groupModelImpl.getOriginalFriendlyURL()
564 });
565 }
566
567 if (isNew ||
568 ((group.getCompanyId() != groupModelImpl.getOriginalCompanyId()) ||
569 !Validator.equals(group.getFriendlyURL(),
570 groupModelImpl.getOriginalFriendlyURL()))) {
571 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_F,
572 new Object[] {
573 new Long(group.getCompanyId()),
574
575 group.getFriendlyURL()
576 }, group);
577 }
578
579 if (!isNew &&
580 ((group.getCompanyId() != groupModelImpl.getOriginalCompanyId()) ||
581 (group.getClassNameId() != groupModelImpl.getOriginalClassNameId()) ||
582 (group.getClassPK() != groupModelImpl.getOriginalClassPK()))) {
583 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C_C,
584 new Object[] {
585 new Long(groupModelImpl.getOriginalCompanyId()),
586 new Long(groupModelImpl.getOriginalClassNameId()),
587 new Long(groupModelImpl.getOriginalClassPK())
588 });
589 }
590
591 if (isNew ||
592 ((group.getCompanyId() != groupModelImpl.getOriginalCompanyId()) ||
593 (group.getClassNameId() != groupModelImpl.getOriginalClassNameId()) ||
594 (group.getClassPK() != groupModelImpl.getOriginalClassPK()))) {
595 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C_C,
596 new Object[] {
597 new Long(group.getCompanyId()),
598 new Long(group.getClassNameId()),
599 new Long(group.getClassPK())
600 }, group);
601 }
602
603 if (!isNew &&
604 ((group.getCompanyId() != groupModelImpl.getOriginalCompanyId()) ||
605 (group.getLiveGroupId() != groupModelImpl.getOriginalLiveGroupId()) ||
606 !Validator.equals(group.getName(),
607 groupModelImpl.getOriginalName()))) {
608 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_L_N,
609 new Object[] {
610 new Long(groupModelImpl.getOriginalCompanyId()),
611 new Long(groupModelImpl.getOriginalLiveGroupId()),
612
613 groupModelImpl.getOriginalName()
614 });
615 }
616
617 if (isNew ||
618 ((group.getCompanyId() != groupModelImpl.getOriginalCompanyId()) ||
619 (group.getLiveGroupId() != groupModelImpl.getOriginalLiveGroupId()) ||
620 !Validator.equals(group.getName(),
621 groupModelImpl.getOriginalName()))) {
622 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_L_N,
623 new Object[] {
624 new Long(group.getCompanyId()),
625 new Long(group.getLiveGroupId()),
626
627 group.getName()
628 }, group);
629 }
630
631 if (!isNew &&
632 ((group.getCompanyId() != groupModelImpl.getOriginalCompanyId()) ||
633 (group.getClassNameId() != groupModelImpl.getOriginalClassNameId()) ||
634 (group.getLiveGroupId() != groupModelImpl.getOriginalLiveGroupId()) ||
635 !Validator.equals(group.getName(),
636 groupModelImpl.getOriginalName()))) {
637 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C_L_N,
638 new Object[] {
639 new Long(groupModelImpl.getOriginalCompanyId()),
640 new Long(groupModelImpl.getOriginalClassNameId()),
641 new Long(groupModelImpl.getOriginalLiveGroupId()),
642
643 groupModelImpl.getOriginalName()
644 });
645 }
646
647 if (isNew ||
648 ((group.getCompanyId() != groupModelImpl.getOriginalCompanyId()) ||
649 (group.getClassNameId() != groupModelImpl.getOriginalClassNameId()) ||
650 (group.getLiveGroupId() != groupModelImpl.getOriginalLiveGroupId()) ||
651 !Validator.equals(group.getName(),
652 groupModelImpl.getOriginalName()))) {
653 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C_L_N,
654 new Object[] {
655 new Long(group.getCompanyId()),
656 new Long(group.getClassNameId()),
657 new Long(group.getLiveGroupId()),
658
659 group.getName()
660 }, group);
661 }
662
663 return group;
664 }
665
666 protected Group toUnwrappedModel(Group group) {
667 if (group instanceof GroupImpl) {
668 return group;
669 }
670
671 GroupImpl groupImpl = new GroupImpl();
672
673 groupImpl.setNew(group.isNew());
674 groupImpl.setPrimaryKey(group.getPrimaryKey());
675
676 groupImpl.setGroupId(group.getGroupId());
677 groupImpl.setCompanyId(group.getCompanyId());
678 groupImpl.setCreatorUserId(group.getCreatorUserId());
679 groupImpl.setClassNameId(group.getClassNameId());
680 groupImpl.setClassPK(group.getClassPK());
681 groupImpl.setParentGroupId(group.getParentGroupId());
682 groupImpl.setLiveGroupId(group.getLiveGroupId());
683 groupImpl.setName(group.getName());
684 groupImpl.setDescription(group.getDescription());
685 groupImpl.setType(group.getType());
686 groupImpl.setTypeSettings(group.getTypeSettings());
687 groupImpl.setFriendlyURL(group.getFriendlyURL());
688 groupImpl.setActive(group.isActive());
689
690 return groupImpl;
691 }
692
693
701 public Group findByPrimaryKey(Serializable primaryKey)
702 throws NoSuchModelException, SystemException {
703 return findByPrimaryKey(((Long)primaryKey).longValue());
704 }
705
706
714 public Group findByPrimaryKey(long groupId)
715 throws NoSuchGroupException, SystemException {
716 Group group = fetchByPrimaryKey(groupId);
717
718 if (group == null) {
719 if (_log.isWarnEnabled()) {
720 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + groupId);
721 }
722
723 throw new NoSuchGroupException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
724 groupId);
725 }
726
727 return group;
728 }
729
730
737 public Group fetchByPrimaryKey(Serializable primaryKey)
738 throws SystemException {
739 return fetchByPrimaryKey(((Long)primaryKey).longValue());
740 }
741
742
749 public Group fetchByPrimaryKey(long groupId) throws SystemException {
750 Group group = (Group)EntityCacheUtil.getResult(GroupModelImpl.ENTITY_CACHE_ENABLED,
751 GroupImpl.class, groupId, this);
752
753 if (group == null) {
754 Session session = null;
755
756 try {
757 session = openSession();
758
759 group = (Group)session.get(GroupImpl.class, new Long(groupId));
760 }
761 catch (Exception e) {
762 throw processException(e);
763 }
764 finally {
765 if (group != null) {
766 cacheResult(group);
767 }
768
769 closeSession(session);
770 }
771 }
772
773 return group;
774 }
775
776
783 public List<Group> findByCompanyId(long companyId)
784 throws SystemException {
785 return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
786 null);
787 }
788
789
802 public List<Group> findByCompanyId(long companyId, int start, int end)
803 throws SystemException {
804 return findByCompanyId(companyId, start, end, null);
805 }
806
807
821 public List<Group> findByCompanyId(long companyId, int start, int end,
822 OrderByComparator orderByComparator) throws SystemException {
823 Object[] finderArgs = new Object[] {
824 companyId,
825
826 String.valueOf(start), String.valueOf(end),
827 String.valueOf(orderByComparator)
828 };
829
830 List<Group> list = (List<Group>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_COMPANYID,
831 finderArgs, this);
832
833 if (list == null) {
834 StringBundler query = null;
835
836 if (orderByComparator != null) {
837 query = new StringBundler(3 +
838 (orderByComparator.getOrderByFields().length * 3));
839 }
840 else {
841 query = new StringBundler(3);
842 }
843
844 query.append(_SQL_SELECT_GROUP__WHERE);
845
846 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
847
848 if (orderByComparator != null) {
849 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
850 orderByComparator);
851 }
852
853 else {
854 query.append(GroupModelImpl.ORDER_BY_JPQL);
855 }
856
857 String sql = query.toString();
858
859 Session session = null;
860
861 try {
862 session = openSession();
863
864 Query q = session.createQuery(sql);
865
866 QueryPos qPos = QueryPos.getInstance(q);
867
868 qPos.add(companyId);
869
870 list = (List<Group>)QueryUtil.list(q, getDialect(), start, end);
871 }
872 catch (Exception e) {
873 throw processException(e);
874 }
875 finally {
876 if (list == null) {
877 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_COMPANYID,
878 finderArgs);
879 }
880 else {
881 cacheResult(list);
882
883 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_COMPANYID,
884 finderArgs, list);
885 }
886
887 closeSession(session);
888 }
889 }
890
891 return list;
892 }
893
894
907 public Group findByCompanyId_First(long companyId,
908 OrderByComparator orderByComparator)
909 throws NoSuchGroupException, SystemException {
910 List<Group> list = findByCompanyId(companyId, 0, 1, orderByComparator);
911
912 if (list.isEmpty()) {
913 StringBundler msg = new StringBundler(4);
914
915 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
916
917 msg.append("companyId=");
918 msg.append(companyId);
919
920 msg.append(StringPool.CLOSE_CURLY_BRACE);
921
922 throw new NoSuchGroupException(msg.toString());
923 }
924 else {
925 return list.get(0);
926 }
927 }
928
929
942 public Group findByCompanyId_Last(long companyId,
943 OrderByComparator orderByComparator)
944 throws NoSuchGroupException, SystemException {
945 int count = countByCompanyId(companyId);
946
947 List<Group> list = findByCompanyId(companyId, count - 1, count,
948 orderByComparator);
949
950 if (list.isEmpty()) {
951 StringBundler msg = new StringBundler(4);
952
953 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
954
955 msg.append("companyId=");
956 msg.append(companyId);
957
958 msg.append(StringPool.CLOSE_CURLY_BRACE);
959
960 throw new NoSuchGroupException(msg.toString());
961 }
962 else {
963 return list.get(0);
964 }
965 }
966
967
981 public Group[] findByCompanyId_PrevAndNext(long groupId, long companyId,
982 OrderByComparator orderByComparator)
983 throws NoSuchGroupException, SystemException {
984 Group group = findByPrimaryKey(groupId);
985
986 Session session = null;
987
988 try {
989 session = openSession();
990
991 Group[] array = new GroupImpl[3];
992
993 array[0] = getByCompanyId_PrevAndNext(session, group, companyId,
994 orderByComparator, true);
995
996 array[1] = group;
997
998 array[2] = getByCompanyId_PrevAndNext(session, group, companyId,
999 orderByComparator, false);
1000
1001 return array;
1002 }
1003 catch (Exception e) {
1004 throw processException(e);
1005 }
1006 finally {
1007 closeSession(session);
1008 }
1009 }
1010
1011 protected Group getByCompanyId_PrevAndNext(Session session, Group group,
1012 long companyId, OrderByComparator orderByComparator, boolean previous) {
1013 StringBundler query = null;
1014
1015 if (orderByComparator != null) {
1016 query = new StringBundler(6 +
1017 (orderByComparator.getOrderByFields().length * 6));
1018 }
1019 else {
1020 query = new StringBundler(3);
1021 }
1022
1023 query.append(_SQL_SELECT_GROUP__WHERE);
1024
1025 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1026
1027 if (orderByComparator != null) {
1028 String[] orderByFields = orderByComparator.getOrderByFields();
1029
1030 if (orderByFields.length > 0) {
1031 query.append(WHERE_AND);
1032 }
1033
1034 for (int i = 0; i < orderByFields.length; i++) {
1035 query.append(_ORDER_BY_ENTITY_ALIAS);
1036 query.append(orderByFields[i]);
1037
1038 if ((i + 1) < orderByFields.length) {
1039 if (orderByComparator.isAscending() ^ previous) {
1040 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1041 }
1042 else {
1043 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1044 }
1045 }
1046 else {
1047 if (orderByComparator.isAscending() ^ previous) {
1048 query.append(WHERE_GREATER_THAN);
1049 }
1050 else {
1051 query.append(WHERE_LESSER_THAN);
1052 }
1053 }
1054 }
1055
1056 query.append(ORDER_BY_CLAUSE);
1057
1058 for (int i = 0; i < orderByFields.length; i++) {
1059 query.append(_ORDER_BY_ENTITY_ALIAS);
1060 query.append(orderByFields[i]);
1061
1062 if ((i + 1) < orderByFields.length) {
1063 if (orderByComparator.isAscending() ^ previous) {
1064 query.append(ORDER_BY_ASC_HAS_NEXT);
1065 }
1066 else {
1067 query.append(ORDER_BY_DESC_HAS_NEXT);
1068 }
1069 }
1070 else {
1071 if (orderByComparator.isAscending() ^ previous) {
1072 query.append(ORDER_BY_ASC);
1073 }
1074 else {
1075 query.append(ORDER_BY_DESC);
1076 }
1077 }
1078 }
1079 }
1080
1081 else {
1082 query.append(GroupModelImpl.ORDER_BY_JPQL);
1083 }
1084
1085 String sql = query.toString();
1086
1087 Query q = session.createQuery(sql);
1088
1089 q.setFirstResult(0);
1090 q.setMaxResults(2);
1091
1092 QueryPos qPos = QueryPos.getInstance(q);
1093
1094 qPos.add(companyId);
1095
1096 if (orderByComparator != null) {
1097 Object[] values = orderByComparator.getOrderByValues(group);
1098
1099 for (Object value : values) {
1100 qPos.add(value);
1101 }
1102 }
1103
1104 List<Group> list = q.list();
1105
1106 if (list.size() == 2) {
1107 return list.get(1);
1108 }
1109 else {
1110 return null;
1111 }
1112 }
1113
1114
1122 public Group findByLiveGroupId(long liveGroupId)
1123 throws NoSuchGroupException, SystemException {
1124 Group group = fetchByLiveGroupId(liveGroupId);
1125
1126 if (group == null) {
1127 StringBundler msg = new StringBundler(4);
1128
1129 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1130
1131 msg.append("liveGroupId=");
1132 msg.append(liveGroupId);
1133
1134 msg.append(StringPool.CLOSE_CURLY_BRACE);
1135
1136 if (_log.isWarnEnabled()) {
1137 _log.warn(msg.toString());
1138 }
1139
1140 throw new NoSuchGroupException(msg.toString());
1141 }
1142
1143 return group;
1144 }
1145
1146
1153 public Group fetchByLiveGroupId(long liveGroupId) throws SystemException {
1154 return fetchByLiveGroupId(liveGroupId, true);
1155 }
1156
1157
1164 public Group fetchByLiveGroupId(long liveGroupId, boolean retrieveFromCache)
1165 throws SystemException {
1166 Object[] finderArgs = new Object[] { liveGroupId };
1167
1168 Object result = null;
1169
1170 if (retrieveFromCache) {
1171 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_LIVEGROUPID,
1172 finderArgs, this);
1173 }
1174
1175 if (result == null) {
1176 StringBundler query = new StringBundler(3);
1177
1178 query.append(_SQL_SELECT_GROUP__WHERE);
1179
1180 query.append(_FINDER_COLUMN_LIVEGROUPID_LIVEGROUPID_2);
1181
1182 query.append(GroupModelImpl.ORDER_BY_JPQL);
1183
1184 String sql = query.toString();
1185
1186 Session session = null;
1187
1188 try {
1189 session = openSession();
1190
1191 Query q = session.createQuery(sql);
1192
1193 QueryPos qPos = QueryPos.getInstance(q);
1194
1195 qPos.add(liveGroupId);
1196
1197 List<Group> list = q.list();
1198
1199 result = list;
1200
1201 Group group = null;
1202
1203 if (list.isEmpty()) {
1204 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LIVEGROUPID,
1205 finderArgs, list);
1206 }
1207 else {
1208 group = list.get(0);
1209
1210 cacheResult(group);
1211
1212 if ((group.getLiveGroupId() != liveGroupId)) {
1213 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LIVEGROUPID,
1214 finderArgs, group);
1215 }
1216 }
1217
1218 return group;
1219 }
1220 catch (Exception e) {
1221 throw processException(e);
1222 }
1223 finally {
1224 if (result == null) {
1225 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_LIVEGROUPID,
1226 finderArgs);
1227 }
1228
1229 closeSession(session);
1230 }
1231 }
1232 else {
1233 if (result instanceof List<?>) {
1234 return null;
1235 }
1236 else {
1237 return (Group)result;
1238 }
1239 }
1240 }
1241
1242
1251 public Group findByC_N(long companyId, String name)
1252 throws NoSuchGroupException, SystemException {
1253 Group group = fetchByC_N(companyId, name);
1254
1255 if (group == null) {
1256 StringBundler msg = new StringBundler(6);
1257
1258 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1259
1260 msg.append("companyId=");
1261 msg.append(companyId);
1262
1263 msg.append(", name=");
1264 msg.append(name);
1265
1266 msg.append(StringPool.CLOSE_CURLY_BRACE);
1267
1268 if (_log.isWarnEnabled()) {
1269 _log.warn(msg.toString());
1270 }
1271
1272 throw new NoSuchGroupException(msg.toString());
1273 }
1274
1275 return group;
1276 }
1277
1278
1286 public Group fetchByC_N(long companyId, String name)
1287 throws SystemException {
1288 return fetchByC_N(companyId, name, true);
1289 }
1290
1291
1299 public Group fetchByC_N(long companyId, String name,
1300 boolean retrieveFromCache) throws SystemException {
1301 Object[] finderArgs = new Object[] { companyId, name };
1302
1303 Object result = null;
1304
1305 if (retrieveFromCache) {
1306 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_N,
1307 finderArgs, this);
1308 }
1309
1310 if (result == null) {
1311 StringBundler query = new StringBundler(4);
1312
1313 query.append(_SQL_SELECT_GROUP__WHERE);
1314
1315 query.append(_FINDER_COLUMN_C_N_COMPANYID_2);
1316
1317 if (name == null) {
1318 query.append(_FINDER_COLUMN_C_N_NAME_1);
1319 }
1320 else {
1321 if (name.equals(StringPool.BLANK)) {
1322 query.append(_FINDER_COLUMN_C_N_NAME_3);
1323 }
1324 else {
1325 query.append(_FINDER_COLUMN_C_N_NAME_2);
1326 }
1327 }
1328
1329 query.append(GroupModelImpl.ORDER_BY_JPQL);
1330
1331 String sql = query.toString();
1332
1333 Session session = null;
1334
1335 try {
1336 session = openSession();
1337
1338 Query q = session.createQuery(sql);
1339
1340 QueryPos qPos = QueryPos.getInstance(q);
1341
1342 qPos.add(companyId);
1343
1344 if (name != null) {
1345 qPos.add(name);
1346 }
1347
1348 List<Group> list = q.list();
1349
1350 result = list;
1351
1352 Group group = null;
1353
1354 if (list.isEmpty()) {
1355 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_N,
1356 finderArgs, list);
1357 }
1358 else {
1359 group = list.get(0);
1360
1361 cacheResult(group);
1362
1363 if ((group.getCompanyId() != companyId) ||
1364 (group.getName() == null) ||
1365 !group.getName().equals(name)) {
1366 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_N,
1367 finderArgs, group);
1368 }
1369 }
1370
1371 return group;
1372 }
1373 catch (Exception e) {
1374 throw processException(e);
1375 }
1376 finally {
1377 if (result == null) {
1378 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_N,
1379 finderArgs);
1380 }
1381
1382 closeSession(session);
1383 }
1384 }
1385 else {
1386 if (result instanceof List<?>) {
1387 return null;
1388 }
1389 else {
1390 return (Group)result;
1391 }
1392 }
1393 }
1394
1395
1404 public Group findByC_F(long companyId, String friendlyURL)
1405 throws NoSuchGroupException, SystemException {
1406 Group group = fetchByC_F(companyId, friendlyURL);
1407
1408 if (group == null) {
1409 StringBundler msg = new StringBundler(6);
1410
1411 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1412
1413 msg.append("companyId=");
1414 msg.append(companyId);
1415
1416 msg.append(", friendlyURL=");
1417 msg.append(friendlyURL);
1418
1419 msg.append(StringPool.CLOSE_CURLY_BRACE);
1420
1421 if (_log.isWarnEnabled()) {
1422 _log.warn(msg.toString());
1423 }
1424
1425 throw new NoSuchGroupException(msg.toString());
1426 }
1427
1428 return group;
1429 }
1430
1431
1439 public Group fetchByC_F(long companyId, String friendlyURL)
1440 throws SystemException {
1441 return fetchByC_F(companyId, friendlyURL, true);
1442 }
1443
1444
1452 public Group fetchByC_F(long companyId, String friendlyURL,
1453 boolean retrieveFromCache) throws SystemException {
1454 Object[] finderArgs = new Object[] { companyId, friendlyURL };
1455
1456 Object result = null;
1457
1458 if (retrieveFromCache) {
1459 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_F,
1460 finderArgs, this);
1461 }
1462
1463 if (result == null) {
1464 StringBundler query = new StringBundler(4);
1465
1466 query.append(_SQL_SELECT_GROUP__WHERE);
1467
1468 query.append(_FINDER_COLUMN_C_F_COMPANYID_2);
1469
1470 if (friendlyURL == null) {
1471 query.append(_FINDER_COLUMN_C_F_FRIENDLYURL_1);
1472 }
1473 else {
1474 if (friendlyURL.equals(StringPool.BLANK)) {
1475 query.append(_FINDER_COLUMN_C_F_FRIENDLYURL_3);
1476 }
1477 else {
1478 query.append(_FINDER_COLUMN_C_F_FRIENDLYURL_2);
1479 }
1480 }
1481
1482 query.append(GroupModelImpl.ORDER_BY_JPQL);
1483
1484 String sql = query.toString();
1485
1486 Session session = null;
1487
1488 try {
1489 session = openSession();
1490
1491 Query q = session.createQuery(sql);
1492
1493 QueryPos qPos = QueryPos.getInstance(q);
1494
1495 qPos.add(companyId);
1496
1497 if (friendlyURL != null) {
1498 qPos.add(friendlyURL);
1499 }
1500
1501 List<Group> list = q.list();
1502
1503 result = list;
1504
1505 Group group = null;
1506
1507 if (list.isEmpty()) {
1508 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_F,
1509 finderArgs, list);
1510 }
1511 else {
1512 group = list.get(0);
1513
1514 cacheResult(group);
1515
1516 if ((group.getCompanyId() != companyId) ||
1517 (group.getFriendlyURL() == null) ||
1518 !group.getFriendlyURL().equals(friendlyURL)) {
1519 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_F,
1520 finderArgs, group);
1521 }
1522 }
1523
1524 return group;
1525 }
1526 catch (Exception e) {
1527 throw processException(e);
1528 }
1529 finally {
1530 if (result == null) {
1531 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_F,
1532 finderArgs);
1533 }
1534
1535 closeSession(session);
1536 }
1537 }
1538 else {
1539 if (result instanceof List<?>) {
1540 return null;
1541 }
1542 else {
1543 return (Group)result;
1544 }
1545 }
1546 }
1547
1548
1556 public List<Group> findByT_A(int type, boolean active)
1557 throws SystemException {
1558 return findByT_A(type, active, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1559 null);
1560 }
1561
1562
1576 public List<Group> findByT_A(int type, boolean active, int start, int end)
1577 throws SystemException {
1578 return findByT_A(type, active, start, end, null);
1579 }
1580
1581
1596 public List<Group> findByT_A(int type, boolean active, int start, int end,
1597 OrderByComparator orderByComparator) throws SystemException {
1598 Object[] finderArgs = new Object[] {
1599 type, active,
1600
1601 String.valueOf(start), String.valueOf(end),
1602 String.valueOf(orderByComparator)
1603 };
1604
1605 List<Group> list = (List<Group>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_T_A,
1606 finderArgs, this);
1607
1608 if (list == null) {
1609 StringBundler query = null;
1610
1611 if (orderByComparator != null) {
1612 query = new StringBundler(4 +
1613 (orderByComparator.getOrderByFields().length * 3));
1614 }
1615 else {
1616 query = new StringBundler(4);
1617 }
1618
1619 query.append(_SQL_SELECT_GROUP__WHERE);
1620
1621 query.append(_FINDER_COLUMN_T_A_TYPE_2);
1622
1623 query.append(_FINDER_COLUMN_T_A_ACTIVE_2);
1624
1625 if (orderByComparator != null) {
1626 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1627 orderByComparator);
1628 }
1629
1630 else {
1631 query.append(GroupModelImpl.ORDER_BY_JPQL);
1632 }
1633
1634 String sql = query.toString();
1635
1636 Session session = null;
1637
1638 try {
1639 session = openSession();
1640
1641 Query q = session.createQuery(sql);
1642
1643 QueryPos qPos = QueryPos.getInstance(q);
1644
1645 qPos.add(type);
1646
1647 qPos.add(active);
1648
1649 list = (List<Group>)QueryUtil.list(q, getDialect(), start, end);
1650 }
1651 catch (Exception e) {
1652 throw processException(e);
1653 }
1654 finally {
1655 if (list == null) {
1656 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_T_A,
1657 finderArgs);
1658 }
1659 else {
1660 cacheResult(list);
1661
1662 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_T_A,
1663 finderArgs, list);
1664 }
1665
1666 closeSession(session);
1667 }
1668 }
1669
1670 return list;
1671 }
1672
1673
1687 public Group findByT_A_First(int type, boolean active,
1688 OrderByComparator orderByComparator)
1689 throws NoSuchGroupException, SystemException {
1690 List<Group> list = findByT_A(type, active, 0, 1, orderByComparator);
1691
1692 if (list.isEmpty()) {
1693 StringBundler msg = new StringBundler(6);
1694
1695 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1696
1697 msg.append("type=");
1698 msg.append(type);
1699
1700 msg.append(", active=");
1701 msg.append(active);
1702
1703 msg.append(StringPool.CLOSE_CURLY_BRACE);
1704
1705 throw new NoSuchGroupException(msg.toString());
1706 }
1707 else {
1708 return list.get(0);
1709 }
1710 }
1711
1712
1726 public Group findByT_A_Last(int type, boolean active,
1727 OrderByComparator orderByComparator)
1728 throws NoSuchGroupException, SystemException {
1729 int count = countByT_A(type, active);
1730
1731 List<Group> list = findByT_A(type, active, count - 1, count,
1732 orderByComparator);
1733
1734 if (list.isEmpty()) {
1735 StringBundler msg = new StringBundler(6);
1736
1737 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1738
1739 msg.append("type=");
1740 msg.append(type);
1741
1742 msg.append(", active=");
1743 msg.append(active);
1744
1745 msg.append(StringPool.CLOSE_CURLY_BRACE);
1746
1747 throw new NoSuchGroupException(msg.toString());
1748 }
1749 else {
1750 return list.get(0);
1751 }
1752 }
1753
1754
1769 public Group[] findByT_A_PrevAndNext(long groupId, int type,
1770 boolean active, OrderByComparator orderByComparator)
1771 throws NoSuchGroupException, SystemException {
1772 Group group = findByPrimaryKey(groupId);
1773
1774 Session session = null;
1775
1776 try {
1777 session = openSession();
1778
1779 Group[] array = new GroupImpl[3];
1780
1781 array[0] = getByT_A_PrevAndNext(session, group, type, active,
1782 orderByComparator, true);
1783
1784 array[1] = group;
1785
1786 array[2] = getByT_A_PrevAndNext(session, group, type, active,
1787 orderByComparator, false);
1788
1789 return array;
1790 }
1791 catch (Exception e) {
1792 throw processException(e);
1793 }
1794 finally {
1795 closeSession(session);
1796 }
1797 }
1798
1799 protected Group getByT_A_PrevAndNext(Session session, Group group,
1800 int type, boolean active, OrderByComparator orderByComparator,
1801 boolean previous) {
1802 StringBundler query = null;
1803
1804 if (orderByComparator != null) {
1805 query = new StringBundler(6 +
1806 (orderByComparator.getOrderByFields().length * 6));
1807 }
1808 else {
1809 query = new StringBundler(3);
1810 }
1811
1812 query.append(_SQL_SELECT_GROUP__WHERE);
1813
1814 query.append(_FINDER_COLUMN_T_A_TYPE_2);
1815
1816 query.append(_FINDER_COLUMN_T_A_ACTIVE_2);
1817
1818 if (orderByComparator != null) {
1819 String[] orderByFields = orderByComparator.getOrderByFields();
1820
1821 if (orderByFields.length > 0) {
1822 query.append(WHERE_AND);
1823 }
1824
1825 for (int i = 0; i < orderByFields.length; i++) {
1826 query.append(_ORDER_BY_ENTITY_ALIAS);
1827 query.append(orderByFields[i]);
1828
1829 if ((i + 1) < orderByFields.length) {
1830 if (orderByComparator.isAscending() ^ previous) {
1831 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1832 }
1833 else {
1834 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1835 }
1836 }
1837 else {
1838 if (orderByComparator.isAscending() ^ previous) {
1839 query.append(WHERE_GREATER_THAN);
1840 }
1841 else {
1842 query.append(WHERE_LESSER_THAN);
1843 }
1844 }
1845 }
1846
1847 query.append(ORDER_BY_CLAUSE);
1848
1849 for (int i = 0; i < orderByFields.length; i++) {
1850 query.append(_ORDER_BY_ENTITY_ALIAS);
1851 query.append(orderByFields[i]);
1852
1853 if ((i + 1) < orderByFields.length) {
1854 if (orderByComparator.isAscending() ^ previous) {
1855 query.append(ORDER_BY_ASC_HAS_NEXT);
1856 }
1857 else {
1858 query.append(ORDER_BY_DESC_HAS_NEXT);
1859 }
1860 }
1861 else {
1862 if (orderByComparator.isAscending() ^ previous) {
1863 query.append(ORDER_BY_ASC);
1864 }
1865 else {
1866 query.append(ORDER_BY_DESC);
1867 }
1868 }
1869 }
1870 }
1871
1872 else {
1873 query.append(GroupModelImpl.ORDER_BY_JPQL);
1874 }
1875
1876 String sql = query.toString();
1877
1878 Query q = session.createQuery(sql);
1879
1880 q.setFirstResult(0);
1881 q.setMaxResults(2);
1882
1883 QueryPos qPos = QueryPos.getInstance(q);
1884
1885 qPos.add(type);
1886
1887 qPos.add(active);
1888
1889 if (orderByComparator != null) {
1890 Object[] values = orderByComparator.getOrderByValues(group);
1891
1892 for (Object value : values) {
1893 qPos.add(value);
1894 }
1895 }
1896
1897 List<Group> list = q.list();
1898
1899 if (list.size() == 2) {
1900 return list.get(1);
1901 }
1902 else {
1903 return null;
1904 }
1905 }
1906
1907
1917 public Group findByC_C_C(long companyId, long classNameId, long classPK)
1918 throws NoSuchGroupException, SystemException {
1919 Group group = fetchByC_C_C(companyId, classNameId, classPK);
1920
1921 if (group == null) {
1922 StringBundler msg = new StringBundler(8);
1923
1924 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1925
1926 msg.append("companyId=");
1927 msg.append(companyId);
1928
1929 msg.append(", classNameId=");
1930 msg.append(classNameId);
1931
1932 msg.append(", classPK=");
1933 msg.append(classPK);
1934
1935 msg.append(StringPool.CLOSE_CURLY_BRACE);
1936
1937 if (_log.isWarnEnabled()) {
1938 _log.warn(msg.toString());
1939 }
1940
1941 throw new NoSuchGroupException(msg.toString());
1942 }
1943
1944 return group;
1945 }
1946
1947
1956 public Group fetchByC_C_C(long companyId, long classNameId, long classPK)
1957 throws SystemException {
1958 return fetchByC_C_C(companyId, classNameId, classPK, true);
1959 }
1960
1961
1970 public Group fetchByC_C_C(long companyId, long classNameId, long classPK,
1971 boolean retrieveFromCache) throws SystemException {
1972 Object[] finderArgs = new Object[] { companyId, classNameId, classPK };
1973
1974 Object result = null;
1975
1976 if (retrieveFromCache) {
1977 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_C_C,
1978 finderArgs, this);
1979 }
1980
1981 if (result == null) {
1982 StringBundler query = new StringBundler(5);
1983
1984 query.append(_SQL_SELECT_GROUP__WHERE);
1985
1986 query.append(_FINDER_COLUMN_C_C_C_COMPANYID_2);
1987
1988 query.append(_FINDER_COLUMN_C_C_C_CLASSNAMEID_2);
1989
1990 query.append(_FINDER_COLUMN_C_C_C_CLASSPK_2);
1991
1992 query.append(GroupModelImpl.ORDER_BY_JPQL);
1993
1994 String sql = query.toString();
1995
1996 Session session = null;
1997
1998 try {
1999 session = openSession();
2000
2001 Query q = session.createQuery(sql);
2002
2003 QueryPos qPos = QueryPos.getInstance(q);
2004
2005 qPos.add(companyId);
2006
2007 qPos.add(classNameId);
2008
2009 qPos.add(classPK);
2010
2011 List<Group> list = q.list();
2012
2013 result = list;
2014
2015 Group group = null;
2016
2017 if (list.isEmpty()) {
2018 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C_C,
2019 finderArgs, list);
2020 }
2021 else {
2022 group = list.get(0);
2023
2024 cacheResult(group);
2025
2026 if ((group.getCompanyId() != companyId) ||
2027 (group.getClassNameId() != classNameId) ||
2028 (group.getClassPK() != classPK)) {
2029 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C_C,
2030 finderArgs, group);
2031 }
2032 }
2033
2034 return group;
2035 }
2036 catch (Exception e) {
2037 throw processException(e);
2038 }
2039 finally {
2040 if (result == null) {
2041 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C_C,
2042 finderArgs);
2043 }
2044
2045 closeSession(session);
2046 }
2047 }
2048 else {
2049 if (result instanceof List<?>) {
2050 return null;
2051 }
2052 else {
2053 return (Group)result;
2054 }
2055 }
2056 }
2057
2058
2068 public Group findByC_L_N(long companyId, long liveGroupId, String name)
2069 throws NoSuchGroupException, SystemException {
2070 Group group = fetchByC_L_N(companyId, liveGroupId, name);
2071
2072 if (group == null) {
2073 StringBundler msg = new StringBundler(8);
2074
2075 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2076
2077 msg.append("companyId=");
2078 msg.append(companyId);
2079
2080 msg.append(", liveGroupId=");
2081 msg.append(liveGroupId);
2082
2083 msg.append(", name=");
2084 msg.append(name);
2085
2086 msg.append(StringPool.CLOSE_CURLY_BRACE);
2087
2088 if (_log.isWarnEnabled()) {
2089 _log.warn(msg.toString());
2090 }
2091
2092 throw new NoSuchGroupException(msg.toString());
2093 }
2094
2095 return group;
2096 }
2097
2098
2107 public Group fetchByC_L_N(long companyId, long liveGroupId, String name)
2108 throws SystemException {
2109 return fetchByC_L_N(companyId, liveGroupId, name, true);
2110 }
2111
2112
2121 public Group fetchByC_L_N(long companyId, long liveGroupId, String name,
2122 boolean retrieveFromCache) throws SystemException {
2123 Object[] finderArgs = new Object[] { companyId, liveGroupId, name };
2124
2125 Object result = null;
2126
2127 if (retrieveFromCache) {
2128 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_L_N,
2129 finderArgs, this);
2130 }
2131
2132 if (result == null) {
2133 StringBundler query = new StringBundler(5);
2134
2135 query.append(_SQL_SELECT_GROUP__WHERE);
2136
2137 query.append(_FINDER_COLUMN_C_L_N_COMPANYID_2);
2138
2139 query.append(_FINDER_COLUMN_C_L_N_LIVEGROUPID_2);
2140
2141 if (name == null) {
2142 query.append(_FINDER_COLUMN_C_L_N_NAME_1);
2143 }
2144 else {
2145 if (name.equals(StringPool.BLANK)) {
2146 query.append(_FINDER_COLUMN_C_L_N_NAME_3);
2147 }
2148 else {
2149 query.append(_FINDER_COLUMN_C_L_N_NAME_2);
2150 }
2151 }
2152
2153 query.append(GroupModelImpl.ORDER_BY_JPQL);
2154
2155 String sql = query.toString();
2156
2157 Session session = null;
2158
2159 try {
2160 session = openSession();
2161
2162 Query q = session.createQuery(sql);
2163
2164 QueryPos qPos = QueryPos.getInstance(q);
2165
2166 qPos.add(companyId);
2167
2168 qPos.add(liveGroupId);
2169
2170 if (name != null) {
2171 qPos.add(name);
2172 }
2173
2174 List<Group> list = q.list();
2175
2176 result = list;
2177
2178 Group group = null;
2179
2180 if (list.isEmpty()) {
2181 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_L_N,
2182 finderArgs, list);
2183 }
2184 else {
2185 group = list.get(0);
2186
2187 cacheResult(group);
2188
2189 if ((group.getCompanyId() != companyId) ||
2190 (group.getLiveGroupId() != liveGroupId) ||
2191 (group.getName() == null) ||
2192 !group.getName().equals(name)) {
2193 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_L_N,
2194 finderArgs, group);
2195 }
2196 }
2197
2198 return group;
2199 }
2200 catch (Exception e) {
2201 throw processException(e);
2202 }
2203 finally {
2204 if (result == null) {
2205 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_L_N,
2206 finderArgs);
2207 }
2208
2209 closeSession(session);
2210 }
2211 }
2212 else {
2213 if (result instanceof List<?>) {
2214 return null;
2215 }
2216 else {
2217 return (Group)result;
2218 }
2219 }
2220 }
2221
2222
2233 public Group findByC_C_L_N(long companyId, long classNameId,
2234 long liveGroupId, String name)
2235 throws NoSuchGroupException, SystemException {
2236 Group group = fetchByC_C_L_N(companyId, classNameId, liveGroupId, name);
2237
2238 if (group == null) {
2239 StringBundler msg = new StringBundler(10);
2240
2241 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2242
2243 msg.append("companyId=");
2244 msg.append(companyId);
2245
2246 msg.append(", classNameId=");
2247 msg.append(classNameId);
2248
2249 msg.append(", liveGroupId=");
2250 msg.append(liveGroupId);
2251
2252 msg.append(", name=");
2253 msg.append(name);
2254
2255 msg.append(StringPool.CLOSE_CURLY_BRACE);
2256
2257 if (_log.isWarnEnabled()) {
2258 _log.warn(msg.toString());
2259 }
2260
2261 throw new NoSuchGroupException(msg.toString());
2262 }
2263
2264 return group;
2265 }
2266
2267
2277 public Group fetchByC_C_L_N(long companyId, long classNameId,
2278 long liveGroupId, String name) throws SystemException {
2279 return fetchByC_C_L_N(companyId, classNameId, liveGroupId, name, true);
2280 }
2281
2282
2292 public Group fetchByC_C_L_N(long companyId, long classNameId,
2293 long liveGroupId, String name, boolean retrieveFromCache)
2294 throws SystemException {
2295 Object[] finderArgs = new Object[] {
2296 companyId, classNameId, liveGroupId, name
2297 };
2298
2299 Object result = null;
2300
2301 if (retrieveFromCache) {
2302 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_C_L_N,
2303 finderArgs, this);
2304 }
2305
2306 if (result == null) {
2307 StringBundler query = new StringBundler(6);
2308
2309 query.append(_SQL_SELECT_GROUP__WHERE);
2310
2311 query.append(_FINDER_COLUMN_C_C_L_N_COMPANYID_2);
2312
2313 query.append(_FINDER_COLUMN_C_C_L_N_CLASSNAMEID_2);
2314
2315 query.append(_FINDER_COLUMN_C_C_L_N_LIVEGROUPID_2);
2316
2317 if (name == null) {
2318 query.append(_FINDER_COLUMN_C_C_L_N_NAME_1);
2319 }
2320 else {
2321 if (name.equals(StringPool.BLANK)) {
2322 query.append(_FINDER_COLUMN_C_C_L_N_NAME_3);
2323 }
2324 else {
2325 query.append(_FINDER_COLUMN_C_C_L_N_NAME_2);
2326 }
2327 }
2328
2329 query.append(GroupModelImpl.ORDER_BY_JPQL);
2330
2331 String sql = query.toString();
2332
2333 Session session = null;
2334
2335 try {
2336 session = openSession();
2337
2338 Query q = session.createQuery(sql);
2339
2340 QueryPos qPos = QueryPos.getInstance(q);
2341
2342 qPos.add(companyId);
2343
2344 qPos.add(classNameId);
2345
2346 qPos.add(liveGroupId);
2347
2348 if (name != null) {
2349 qPos.add(name);
2350 }
2351
2352 List<Group> list = q.list();
2353
2354 result = list;
2355
2356 Group group = null;
2357
2358 if (list.isEmpty()) {
2359 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C_L_N,
2360 finderArgs, list);
2361 }
2362 else {
2363 group = list.get(0);
2364
2365 cacheResult(group);
2366
2367 if ((group.getCompanyId() != companyId) ||
2368 (group.getClassNameId() != classNameId) ||
2369 (group.getLiveGroupId() != liveGroupId) ||
2370 (group.getName() == null) ||
2371 !group.getName().equals(name)) {
2372 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C_L_N,
2373 finderArgs, group);
2374 }
2375 }
2376
2377 return group;
2378 }
2379 catch (Exception e) {
2380 throw processException(e);
2381 }
2382 finally {
2383 if (result == null) {
2384 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C_L_N,
2385 finderArgs);
2386 }
2387
2388 closeSession(session);
2389 }
2390 }
2391 else {
2392 if (result instanceof List<?>) {
2393 return null;
2394 }
2395 else {
2396 return (Group)result;
2397 }
2398 }
2399 }
2400
2401
2407 public List<Group> findAll() throws SystemException {
2408 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2409 }
2410
2411
2423 public List<Group> findAll(int start, int end) throws SystemException {
2424 return findAll(start, end, null);
2425 }
2426
2427
2440 public List<Group> findAll(int start, int end,
2441 OrderByComparator orderByComparator) throws SystemException {
2442 Object[] finderArgs = new Object[] {
2443 String.valueOf(start), String.valueOf(end),
2444 String.valueOf(orderByComparator)
2445 };
2446
2447 List<Group> list = (List<Group>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
2448 finderArgs, this);
2449
2450 if (list == null) {
2451 StringBundler query = null;
2452 String sql = null;
2453
2454 if (orderByComparator != null) {
2455 query = new StringBundler(2 +
2456 (orderByComparator.getOrderByFields().length * 3));
2457
2458 query.append(_SQL_SELECT_GROUP_);
2459
2460 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2461 orderByComparator);
2462
2463 sql = query.toString();
2464 }
2465 else {
2466 sql = _SQL_SELECT_GROUP_.concat(GroupModelImpl.ORDER_BY_JPQL);
2467 }
2468
2469 Session session = null;
2470
2471 try {
2472 session = openSession();
2473
2474 Query q = session.createQuery(sql);
2475
2476 if (orderByComparator == null) {
2477 list = (List<Group>)QueryUtil.list(q, getDialect(), start,
2478 end, false);
2479
2480 Collections.sort(list);
2481 }
2482 else {
2483 list = (List<Group>)QueryUtil.list(q, getDialect(), start,
2484 end);
2485 }
2486 }
2487 catch (Exception e) {
2488 throw processException(e);
2489 }
2490 finally {
2491 if (list == null) {
2492 FinderCacheUtil.removeResult(FINDER_PATH_FIND_ALL,
2493 finderArgs);
2494 }
2495 else {
2496 cacheResult(list);
2497
2498 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs,
2499 list);
2500 }
2501
2502 closeSession(session);
2503 }
2504 }
2505
2506 return list;
2507 }
2508
2509
2515 public void removeByCompanyId(long companyId) throws SystemException {
2516 for (Group group : findByCompanyId(companyId)) {
2517 remove(group);
2518 }
2519 }
2520
2521
2527 public void removeByLiveGroupId(long liveGroupId)
2528 throws NoSuchGroupException, SystemException {
2529 Group group = findByLiveGroupId(liveGroupId);
2530
2531 remove(group);
2532 }
2533
2534
2541 public void removeByC_N(long companyId, String name)
2542 throws NoSuchGroupException, SystemException {
2543 Group group = findByC_N(companyId, name);
2544
2545 remove(group);
2546 }
2547
2548
2555 public void removeByC_F(long companyId, String friendlyURL)
2556 throws NoSuchGroupException, SystemException {
2557 Group group = findByC_F(companyId, friendlyURL);
2558
2559 remove(group);
2560 }
2561
2562
2569 public void removeByT_A(int type, boolean active) throws SystemException {
2570 for (Group group : findByT_A(type, active)) {
2571 remove(group);
2572 }
2573 }
2574
2575
2583 public void removeByC_C_C(long companyId, long classNameId, long classPK)
2584 throws NoSuchGroupException, SystemException {
2585 Group group = findByC_C_C(companyId, classNameId, classPK);
2586
2587 remove(group);
2588 }
2589
2590
2598 public void removeByC_L_N(long companyId, long liveGroupId, String name)
2599 throws NoSuchGroupException, SystemException {
2600 Group group = findByC_L_N(companyId, liveGroupId, name);
2601
2602 remove(group);
2603 }
2604
2605
2614 public void removeByC_C_L_N(long companyId, long classNameId,
2615 long liveGroupId, String name)
2616 throws NoSuchGroupException, SystemException {
2617 Group group = findByC_C_L_N(companyId, classNameId, liveGroupId, name);
2618
2619 remove(group);
2620 }
2621
2622
2627 public void removeAll() throws SystemException {
2628 for (Group group : findAll()) {
2629 remove(group);
2630 }
2631 }
2632
2633
2640 public int countByCompanyId(long companyId) throws SystemException {
2641 Object[] finderArgs = new Object[] { companyId };
2642
2643 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
2644 finderArgs, this);
2645
2646 if (count == null) {
2647 StringBundler query = new StringBundler(2);
2648
2649 query.append(_SQL_COUNT_GROUP__WHERE);
2650
2651 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
2652
2653 String sql = query.toString();
2654
2655 Session session = null;
2656
2657 try {
2658 session = openSession();
2659
2660 Query q = session.createQuery(sql);
2661
2662 QueryPos qPos = QueryPos.getInstance(q);
2663
2664 qPos.add(companyId);
2665
2666 count = (Long)q.uniqueResult();
2667 }
2668 catch (Exception e) {
2669 throw processException(e);
2670 }
2671 finally {
2672 if (count == null) {
2673 count = Long.valueOf(0);
2674 }
2675
2676 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
2677 finderArgs, count);
2678
2679 closeSession(session);
2680 }
2681 }
2682
2683 return count.intValue();
2684 }
2685
2686
2693 public int countByLiveGroupId(long liveGroupId) throws SystemException {
2694 Object[] finderArgs = new Object[] { liveGroupId };
2695
2696 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_LIVEGROUPID,
2697 finderArgs, this);
2698
2699 if (count == null) {
2700 StringBundler query = new StringBundler(2);
2701
2702 query.append(_SQL_COUNT_GROUP__WHERE);
2703
2704 query.append(_FINDER_COLUMN_LIVEGROUPID_LIVEGROUPID_2);
2705
2706 String sql = query.toString();
2707
2708 Session session = null;
2709
2710 try {
2711 session = openSession();
2712
2713 Query q = session.createQuery(sql);
2714
2715 QueryPos qPos = QueryPos.getInstance(q);
2716
2717 qPos.add(liveGroupId);
2718
2719 count = (Long)q.uniqueResult();
2720 }
2721 catch (Exception e) {
2722 throw processException(e);
2723 }
2724 finally {
2725 if (count == null) {
2726 count = Long.valueOf(0);
2727 }
2728
2729 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_LIVEGROUPID,
2730 finderArgs, count);
2731
2732 closeSession(session);
2733 }
2734 }
2735
2736 return count.intValue();
2737 }
2738
2739
2747 public int countByC_N(long companyId, String name)
2748 throws SystemException {
2749 Object[] finderArgs = new Object[] { companyId, name };
2750
2751 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_N,
2752 finderArgs, this);
2753
2754 if (count == null) {
2755 StringBundler query = new StringBundler(3);
2756
2757 query.append(_SQL_COUNT_GROUP__WHERE);
2758
2759 query.append(_FINDER_COLUMN_C_N_COMPANYID_2);
2760
2761 if (name == null) {
2762 query.append(_FINDER_COLUMN_C_N_NAME_1);
2763 }
2764 else {
2765 if (name.equals(StringPool.BLANK)) {
2766 query.append(_FINDER_COLUMN_C_N_NAME_3);
2767 }
2768 else {
2769 query.append(_FINDER_COLUMN_C_N_NAME_2);
2770 }
2771 }
2772
2773 String sql = query.toString();
2774
2775 Session session = null;
2776
2777 try {
2778 session = openSession();
2779
2780 Query q = session.createQuery(sql);
2781
2782 QueryPos qPos = QueryPos.getInstance(q);
2783
2784 qPos.add(companyId);
2785
2786 if (name != null) {
2787 qPos.add(name);
2788 }
2789
2790 count = (Long)q.uniqueResult();
2791 }
2792 catch (Exception e) {
2793 throw processException(e);
2794 }
2795 finally {
2796 if (count == null) {
2797 count = Long.valueOf(0);
2798 }
2799
2800 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_N, finderArgs,
2801 count);
2802
2803 closeSession(session);
2804 }
2805 }
2806
2807 return count.intValue();
2808 }
2809
2810
2818 public int countByC_F(long companyId, String friendlyURL)
2819 throws SystemException {
2820 Object[] finderArgs = new Object[] { companyId, friendlyURL };
2821
2822 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_F,
2823 finderArgs, this);
2824
2825 if (count == null) {
2826 StringBundler query = new StringBundler(3);
2827
2828 query.append(_SQL_COUNT_GROUP__WHERE);
2829
2830 query.append(_FINDER_COLUMN_C_F_COMPANYID_2);
2831
2832 if (friendlyURL == null) {
2833 query.append(_FINDER_COLUMN_C_F_FRIENDLYURL_1);
2834 }
2835 else {
2836 if (friendlyURL.equals(StringPool.BLANK)) {
2837 query.append(_FINDER_COLUMN_C_F_FRIENDLYURL_3);
2838 }
2839 else {
2840 query.append(_FINDER_COLUMN_C_F_FRIENDLYURL_2);
2841 }
2842 }
2843
2844 String sql = query.toString();
2845
2846 Session session = null;
2847
2848 try {
2849 session = openSession();
2850
2851 Query q = session.createQuery(sql);
2852
2853 QueryPos qPos = QueryPos.getInstance(q);
2854
2855 qPos.add(companyId);
2856
2857 if (friendlyURL != null) {
2858 qPos.add(friendlyURL);
2859 }
2860
2861 count = (Long)q.uniqueResult();
2862 }
2863 catch (Exception e) {
2864 throw processException(e);
2865 }
2866 finally {
2867 if (count == null) {
2868 count = Long.valueOf(0);
2869 }
2870
2871 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_F, finderArgs,
2872 count);
2873
2874 closeSession(session);
2875 }
2876 }
2877
2878 return count.intValue();
2879 }
2880
2881
2889 public int countByT_A(int type, boolean active) throws SystemException {
2890 Object[] finderArgs = new Object[] { type, active };
2891
2892 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_T_A,
2893 finderArgs, this);
2894
2895 if (count == null) {
2896 StringBundler query = new StringBundler(3);
2897
2898 query.append(_SQL_COUNT_GROUP__WHERE);
2899
2900 query.append(_FINDER_COLUMN_T_A_TYPE_2);
2901
2902 query.append(_FINDER_COLUMN_T_A_ACTIVE_2);
2903
2904 String sql = query.toString();
2905
2906 Session session = null;
2907
2908 try {
2909 session = openSession();
2910
2911 Query q = session.createQuery(sql);
2912
2913 QueryPos qPos = QueryPos.getInstance(q);
2914
2915 qPos.add(type);
2916
2917 qPos.add(active);
2918
2919 count = (Long)q.uniqueResult();
2920 }
2921 catch (Exception e) {
2922 throw processException(e);
2923 }
2924 finally {
2925 if (count == null) {
2926 count = Long.valueOf(0);
2927 }
2928
2929 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_T_A, finderArgs,
2930 count);
2931
2932 closeSession(session);
2933 }
2934 }
2935
2936 return count.intValue();
2937 }
2938
2939
2948 public int countByC_C_C(long companyId, long classNameId, long classPK)
2949 throws SystemException {
2950 Object[] finderArgs = new Object[] { companyId, classNameId, classPK };
2951
2952 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C_C,
2953 finderArgs, this);
2954
2955 if (count == null) {
2956 StringBundler query = new StringBundler(4);
2957
2958 query.append(_SQL_COUNT_GROUP__WHERE);
2959
2960 query.append(_FINDER_COLUMN_C_C_C_COMPANYID_2);
2961
2962 query.append(_FINDER_COLUMN_C_C_C_CLASSNAMEID_2);
2963
2964 query.append(_FINDER_COLUMN_C_C_C_CLASSPK_2);
2965
2966 String sql = query.toString();
2967
2968 Session session = null;
2969
2970 try {
2971 session = openSession();
2972
2973 Query q = session.createQuery(sql);
2974
2975 QueryPos qPos = QueryPos.getInstance(q);
2976
2977 qPos.add(companyId);
2978
2979 qPos.add(classNameId);
2980
2981 qPos.add(classPK);
2982
2983 count = (Long)q.uniqueResult();
2984 }
2985 catch (Exception e) {
2986 throw processException(e);
2987 }
2988 finally {
2989 if (count == null) {
2990 count = Long.valueOf(0);
2991 }
2992
2993 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C_C,
2994 finderArgs, count);
2995
2996 closeSession(session);
2997 }
2998 }
2999
3000 return count.intValue();
3001 }
3002
3003
3012 public int countByC_L_N(long companyId, long liveGroupId, String name)
3013 throws SystemException {
3014 Object[] finderArgs = new Object[] { companyId, liveGroupId, name };
3015
3016 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_L_N,
3017 finderArgs, this);
3018
3019 if (count == null) {
3020 StringBundler query = new StringBundler(4);
3021
3022 query.append(_SQL_COUNT_GROUP__WHERE);
3023
3024 query.append(_FINDER_COLUMN_C_L_N_COMPANYID_2);
3025
3026 query.append(_FINDER_COLUMN_C_L_N_LIVEGROUPID_2);
3027
3028 if (name == null) {
3029 query.append(_FINDER_COLUMN_C_L_N_NAME_1);
3030 }
3031 else {
3032 if (name.equals(StringPool.BLANK)) {
3033 query.append(_FINDER_COLUMN_C_L_N_NAME_3);
3034 }
3035 else {
3036 query.append(_FINDER_COLUMN_C_L_N_NAME_2);
3037 }
3038 }
3039
3040 String sql = query.toString();
3041
3042 Session session = null;
3043
3044 try {
3045 session = openSession();
3046
3047 Query q = session.createQuery(sql);
3048
3049 QueryPos qPos = QueryPos.getInstance(q);
3050
3051 qPos.add(companyId);
3052
3053 qPos.add(liveGroupId);
3054
3055 if (name != null) {
3056 qPos.add(name);
3057 }
3058
3059 count = (Long)q.uniqueResult();
3060 }
3061 catch (Exception e) {
3062 throw processException(e);
3063 }
3064 finally {
3065 if (count == null) {
3066 count = Long.valueOf(0);
3067 }
3068
3069 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_L_N,
3070 finderArgs, count);
3071
3072 closeSession(session);
3073 }
3074 }
3075
3076 return count.intValue();
3077 }
3078
3079
3089 public int countByC_C_L_N(long companyId, long classNameId,
3090 long liveGroupId, String name) throws SystemException {
3091 Object[] finderArgs = new Object[] {
3092 companyId, classNameId, liveGroupId, name
3093 };
3094
3095 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C_L_N,
3096 finderArgs, this);
3097
3098 if (count == null) {
3099 StringBundler query = new StringBundler(5);
3100
3101 query.append(_SQL_COUNT_GROUP__WHERE);
3102
3103 query.append(_FINDER_COLUMN_C_C_L_N_COMPANYID_2);
3104
3105 query.append(_FINDER_COLUMN_C_C_L_N_CLASSNAMEID_2);
3106
3107 query.append(_FINDER_COLUMN_C_C_L_N_LIVEGROUPID_2);
3108
3109 if (name == null) {
3110 query.append(_FINDER_COLUMN_C_C_L_N_NAME_1);
3111 }
3112 else {
3113 if (name.equals(StringPool.BLANK)) {
3114 query.append(_FINDER_COLUMN_C_C_L_N_NAME_3);
3115 }
3116 else {
3117 query.append(_FINDER_COLUMN_C_C_L_N_NAME_2);
3118 }
3119 }
3120
3121 String sql = query.toString();
3122
3123 Session session = null;
3124
3125 try {
3126 session = openSession();
3127
3128 Query q = session.createQuery(sql);
3129
3130 QueryPos qPos = QueryPos.getInstance(q);
3131
3132 qPos.add(companyId);
3133
3134 qPos.add(classNameId);
3135
3136 qPos.add(liveGroupId);
3137
3138 if (name != null) {
3139 qPos.add(name);
3140 }
3141
3142 count = (Long)q.uniqueResult();
3143 }
3144 catch (Exception e) {
3145 throw processException(e);
3146 }
3147 finally {
3148 if (count == null) {
3149 count = Long.valueOf(0);
3150 }
3151
3152 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C_L_N,
3153 finderArgs, count);
3154
3155 closeSession(session);
3156 }
3157 }
3158
3159 return count.intValue();
3160 }
3161
3162
3168 public int countAll() throws SystemException {
3169 Object[] finderArgs = new Object[0];
3170
3171 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3172 finderArgs, this);
3173
3174 if (count == null) {
3175 Session session = null;
3176
3177 try {
3178 session = openSession();
3179
3180 Query q = session.createQuery(_SQL_COUNT_GROUP_);
3181
3182 count = (Long)q.uniqueResult();
3183 }
3184 catch (Exception e) {
3185 throw processException(e);
3186 }
3187 finally {
3188 if (count == null) {
3189 count = Long.valueOf(0);
3190 }
3191
3192 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
3193 count);
3194
3195 closeSession(session);
3196 }
3197 }
3198
3199 return count.intValue();
3200 }
3201
3202
3209 public List<com.liferay.portal.model.Organization> getOrganizations(long pk)
3210 throws SystemException {
3211 return getOrganizations(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
3212 }
3213
3214
3227 public List<com.liferay.portal.model.Organization> getOrganizations(
3228 long pk, int start, int end) throws SystemException {
3229 return getOrganizations(pk, start, end, null);
3230 }
3231
3232 public static final FinderPath FINDER_PATH_GET_ORGANIZATIONS = new FinderPath(com.liferay.portal.model.impl.OrganizationModelImpl.ENTITY_CACHE_ENABLED,
3233 GroupModelImpl.FINDER_CACHE_ENABLED_GROUPS_ORGS,
3234 GroupModelImpl.MAPPING_TABLE_GROUPS_ORGS_NAME, "getOrganizations",
3235 new String[] {
3236 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
3237 "com.liferay.portal.kernel.util.OrderByComparator"
3238 });
3239
3240
3254 public List<com.liferay.portal.model.Organization> getOrganizations(
3255 long pk, int start, int end, OrderByComparator orderByComparator)
3256 throws SystemException {
3257 Object[] finderArgs = new Object[] {
3258 pk, String.valueOf(start), String.valueOf(end),
3259 String.valueOf(orderByComparator)
3260 };
3261
3262 List<com.liferay.portal.model.Organization> list = (List<com.liferay.portal.model.Organization>)FinderCacheUtil.getResult(FINDER_PATH_GET_ORGANIZATIONS,
3263 finderArgs, this);
3264
3265 if (list == null) {
3266 Session session = null;
3267
3268 try {
3269 session = openSession();
3270
3271 String sql = null;
3272
3273 if (orderByComparator != null) {
3274 sql = _SQL_GETORGANIZATIONS.concat(ORDER_BY_CLAUSE)
3275 .concat(orderByComparator.getOrderBy());
3276 }
3277 else {
3278 sql = _SQL_GETORGANIZATIONS.concat(com.liferay.portal.model.impl.OrganizationModelImpl.ORDER_BY_SQL);
3279 }
3280
3281 SQLQuery q = session.createSQLQuery(sql);
3282
3283 q.addEntity("Organization_",
3284 com.liferay.portal.model.impl.OrganizationImpl.class);
3285
3286 QueryPos qPos = QueryPos.getInstance(q);
3287
3288 qPos.add(pk);
3289
3290 list = (List<com.liferay.portal.model.Organization>)QueryUtil.list(q,
3291 getDialect(), start, end);
3292 }
3293 catch (Exception e) {
3294 throw processException(e);
3295 }
3296 finally {
3297 if (list == null) {
3298 FinderCacheUtil.removeResult(FINDER_PATH_GET_ORGANIZATIONS,
3299 finderArgs);
3300 }
3301 else {
3302 organizationPersistence.cacheResult(list);
3303
3304 FinderCacheUtil.putResult(FINDER_PATH_GET_ORGANIZATIONS,
3305 finderArgs, list);
3306 }
3307
3308 closeSession(session);
3309 }
3310 }
3311
3312 return list;
3313 }
3314
3315 public static final FinderPath FINDER_PATH_GET_ORGANIZATIONS_SIZE = new FinderPath(com.liferay.portal.model.impl.OrganizationModelImpl.ENTITY_CACHE_ENABLED,
3316 GroupModelImpl.FINDER_CACHE_ENABLED_GROUPS_ORGS,
3317 GroupModelImpl.MAPPING_TABLE_GROUPS_ORGS_NAME,
3318 "getOrganizationsSize", new String[] { Long.class.getName() });
3319
3320
3327 public int getOrganizationsSize(long pk) throws SystemException {
3328 Object[] finderArgs = new Object[] { pk };
3329
3330 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_ORGANIZATIONS_SIZE,
3331 finderArgs, this);
3332
3333 if (count == null) {
3334 Session session = null;
3335
3336 try {
3337 session = openSession();
3338
3339 SQLQuery q = session.createSQLQuery(_SQL_GETORGANIZATIONSSIZE);
3340
3341 q.addScalar(COUNT_COLUMN_NAME,
3342 com.liferay.portal.kernel.dao.orm.Type.LONG);
3343
3344 QueryPos qPos = QueryPos.getInstance(q);
3345
3346 qPos.add(pk);
3347
3348 count = (Long)q.uniqueResult();
3349 }
3350 catch (Exception e) {
3351 throw processException(e);
3352 }
3353 finally {
3354 if (count == null) {
3355 count = Long.valueOf(0);
3356 }
3357
3358 FinderCacheUtil.putResult(FINDER_PATH_GET_ORGANIZATIONS_SIZE,
3359 finderArgs, count);
3360
3361 closeSession(session);
3362 }
3363 }
3364
3365 return count.intValue();
3366 }
3367
3368 public static final FinderPath FINDER_PATH_CONTAINS_ORGANIZATION = new FinderPath(com.liferay.portal.model.impl.OrganizationModelImpl.ENTITY_CACHE_ENABLED,
3369 GroupModelImpl.FINDER_CACHE_ENABLED_GROUPS_ORGS,
3370 GroupModelImpl.MAPPING_TABLE_GROUPS_ORGS_NAME,
3371 "containsOrganization",
3372 new String[] { Long.class.getName(), Long.class.getName() });
3373
3374
3382 public boolean containsOrganization(long pk, long organizationPK)
3383 throws SystemException {
3384 Object[] finderArgs = new Object[] { pk, organizationPK };
3385
3386 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_ORGANIZATION,
3387 finderArgs, this);
3388
3389 if (value == null) {
3390 try {
3391 value = Boolean.valueOf(containsOrganization.contains(pk,
3392 organizationPK));
3393 }
3394 catch (Exception e) {
3395 throw processException(e);
3396 }
3397 finally {
3398 if (value == null) {
3399 value = Boolean.FALSE;
3400 }
3401
3402 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_ORGANIZATION,
3403 finderArgs, value);
3404 }
3405 }
3406
3407 return value.booleanValue();
3408 }
3409
3410
3417 public boolean containsOrganizations(long pk) throws SystemException {
3418 if (getOrganizationsSize(pk) > 0) {
3419 return true;
3420 }
3421 else {
3422 return false;
3423 }
3424 }
3425
3426
3433 public void addOrganization(long pk, long organizationPK)
3434 throws SystemException {
3435 try {
3436 addOrganization.add(pk, organizationPK);
3437 }
3438 catch (Exception e) {
3439 throw processException(e);
3440 }
3441 finally {
3442 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ORGS_NAME);
3443 }
3444 }
3445
3446
3453 public void addOrganization(long pk,
3454 com.liferay.portal.model.Organization organization)
3455 throws SystemException {
3456 try {
3457 addOrganization.add(pk, organization.getPrimaryKey());
3458 }
3459 catch (Exception e) {
3460 throw processException(e);
3461 }
3462 finally {
3463 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ORGS_NAME);
3464 }
3465 }
3466
3467
3474 public void addOrganizations(long pk, long[] organizationPKs)
3475 throws SystemException {
3476 try {
3477 for (long organizationPK : organizationPKs) {
3478 addOrganization.add(pk, organizationPK);
3479 }
3480 }
3481 catch (Exception e) {
3482 throw processException(e);
3483 }
3484 finally {
3485 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ORGS_NAME);
3486 }
3487 }
3488
3489
3496 public void addOrganizations(long pk,
3497 List<com.liferay.portal.model.Organization> organizations)
3498 throws SystemException {
3499 try {
3500 for (com.liferay.portal.model.Organization organization : organizations) {
3501 addOrganization.add(pk, organization.getPrimaryKey());
3502 }
3503 }
3504 catch (Exception e) {
3505 throw processException(e);
3506 }
3507 finally {
3508 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ORGS_NAME);
3509 }
3510 }
3511
3512
3518 public void clearOrganizations(long pk) throws SystemException {
3519 try {
3520 clearOrganizations.clear(pk);
3521 }
3522 catch (Exception e) {
3523 throw processException(e);
3524 }
3525 finally {
3526 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ORGS_NAME);
3527 }
3528 }
3529
3530
3537 public void removeOrganization(long pk, long organizationPK)
3538 throws SystemException {
3539 try {
3540 removeOrganization.remove(pk, organizationPK);
3541 }
3542 catch (Exception e) {
3543 throw processException(e);
3544 }
3545 finally {
3546 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ORGS_NAME);
3547 }
3548 }
3549
3550
3557 public void removeOrganization(long pk,
3558 com.liferay.portal.model.Organization organization)
3559 throws SystemException {
3560 try {
3561 removeOrganization.remove(pk, organization.getPrimaryKey());
3562 }
3563 catch (Exception e) {
3564 throw processException(e);
3565 }
3566 finally {
3567 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ORGS_NAME);
3568 }
3569 }
3570
3571
3578 public void removeOrganizations(long pk, long[] organizationPKs)
3579 throws SystemException {
3580 try {
3581 for (long organizationPK : organizationPKs) {
3582 removeOrganization.remove(pk, organizationPK);
3583 }
3584 }
3585 catch (Exception e) {
3586 throw processException(e);
3587 }
3588 finally {
3589 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ORGS_NAME);
3590 }
3591 }
3592
3593
3600 public void removeOrganizations(long pk,
3601 List<com.liferay.portal.model.Organization> organizations)
3602 throws SystemException {
3603 try {
3604 for (com.liferay.portal.model.Organization organization : organizations) {
3605 removeOrganization.remove(pk, organization.getPrimaryKey());
3606 }
3607 }
3608 catch (Exception e) {
3609 throw processException(e);
3610 }
3611 finally {
3612 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ORGS_NAME);
3613 }
3614 }
3615
3616
3623 public void setOrganizations(long pk, long[] organizationPKs)
3624 throws SystemException {
3625 try {
3626 Set<Long> organizationPKSet = SetUtil.fromArray(organizationPKs);
3627
3628 List<com.liferay.portal.model.Organization> organizations = getOrganizations(pk);
3629
3630 for (com.liferay.portal.model.Organization organization : organizations) {
3631 if (!organizationPKSet.remove(organization.getPrimaryKey())) {
3632 removeOrganization.remove(pk, organization.getPrimaryKey());
3633 }
3634 }
3635
3636 for (Long organizationPK : organizationPKSet) {
3637 addOrganization.add(pk, organizationPK);
3638 }
3639 }
3640 catch (Exception e) {
3641 throw processException(e);
3642 }
3643 finally {
3644 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ORGS_NAME);
3645 }
3646 }
3647
3648
3655 public void setOrganizations(long pk,
3656 List<com.liferay.portal.model.Organization> organizations)
3657 throws SystemException {
3658 try {
3659 long[] organizationPKs = new long[organizations.size()];
3660
3661 for (int i = 0; i < organizations.size(); i++) {
3662 com.liferay.portal.model.Organization organization = organizations.get(i);
3663
3664 organizationPKs[i] = organization.getPrimaryKey();
3665 }
3666
3667 setOrganizations(pk, organizationPKs);
3668 }
3669 catch (Exception e) {
3670 throw processException(e);
3671 }
3672 finally {
3673 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ORGS_NAME);
3674 }
3675 }
3676
3677
3684 public List<com.liferay.portal.model.Permission> getPermissions(long pk)
3685 throws SystemException {
3686 return getPermissions(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
3687 }
3688
3689
3702 public List<com.liferay.portal.model.Permission> getPermissions(long pk,
3703 int start, int end) throws SystemException {
3704 return getPermissions(pk, start, end, null);
3705 }
3706
3707 public static final FinderPath FINDER_PATH_GET_PERMISSIONS = new FinderPath(com.liferay.portal.model.impl.PermissionModelImpl.ENTITY_CACHE_ENABLED,
3708 GroupModelImpl.FINDER_CACHE_ENABLED_GROUPS_PERMISSIONS,
3709 GroupModelImpl.MAPPING_TABLE_GROUPS_PERMISSIONS_NAME,
3710 "getPermissions",
3711 new String[] {
3712 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
3713 "com.liferay.portal.kernel.util.OrderByComparator"
3714 });
3715
3716
3730 public List<com.liferay.portal.model.Permission> getPermissions(long pk,
3731 int start, int end, OrderByComparator orderByComparator)
3732 throws SystemException {
3733 Object[] finderArgs = new Object[] {
3734 pk, String.valueOf(start), String.valueOf(end),
3735 String.valueOf(orderByComparator)
3736 };
3737
3738 List<com.liferay.portal.model.Permission> list = (List<com.liferay.portal.model.Permission>)FinderCacheUtil.getResult(FINDER_PATH_GET_PERMISSIONS,
3739 finderArgs, this);
3740
3741 if (list == null) {
3742 Session session = null;
3743
3744 try {
3745 session = openSession();
3746
3747 String sql = null;
3748
3749 if (orderByComparator != null) {
3750 sql = _SQL_GETPERMISSIONS.concat(ORDER_BY_CLAUSE)
3751 .concat(orderByComparator.getOrderBy());
3752 }
3753 else {
3754 sql = _SQL_GETPERMISSIONS;
3755 }
3756
3757 SQLQuery q = session.createSQLQuery(sql);
3758
3759 q.addEntity("Permission_",
3760 com.liferay.portal.model.impl.PermissionImpl.class);
3761
3762 QueryPos qPos = QueryPos.getInstance(q);
3763
3764 qPos.add(pk);
3765
3766 list = (List<com.liferay.portal.model.Permission>)QueryUtil.list(q,
3767 getDialect(), start, end);
3768 }
3769 catch (Exception e) {
3770 throw processException(e);
3771 }
3772 finally {
3773 if (list == null) {
3774 FinderCacheUtil.removeResult(FINDER_PATH_GET_PERMISSIONS,
3775 finderArgs);
3776 }
3777 else {
3778 permissionPersistence.cacheResult(list);
3779
3780 FinderCacheUtil.putResult(FINDER_PATH_GET_PERMISSIONS,
3781 finderArgs, list);
3782 }
3783
3784 closeSession(session);
3785 }
3786 }
3787
3788 return list;
3789 }
3790
3791 public static final FinderPath FINDER_PATH_GET_PERMISSIONS_SIZE = new FinderPath(com.liferay.portal.model.impl.PermissionModelImpl.ENTITY_CACHE_ENABLED,
3792 GroupModelImpl.FINDER_CACHE_ENABLED_GROUPS_PERMISSIONS,
3793 GroupModelImpl.MAPPING_TABLE_GROUPS_PERMISSIONS_NAME,
3794 "getPermissionsSize", new String[] { Long.class.getName() });
3795
3796
3803 public int getPermissionsSize(long pk) throws SystemException {
3804 Object[] finderArgs = new Object[] { pk };
3805
3806 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_PERMISSIONS_SIZE,
3807 finderArgs, this);
3808
3809 if (count == null) {
3810 Session session = null;
3811
3812 try {
3813 session = openSession();
3814
3815 SQLQuery q = session.createSQLQuery(_SQL_GETPERMISSIONSSIZE);
3816
3817 q.addScalar(COUNT_COLUMN_NAME,
3818 com.liferay.portal.kernel.dao.orm.Type.LONG);
3819
3820 QueryPos qPos = QueryPos.getInstance(q);
3821
3822 qPos.add(pk);
3823
3824 count = (Long)q.uniqueResult();
3825 }
3826 catch (Exception e) {
3827 throw processException(e);
3828 }
3829 finally {
3830 if (count == null) {
3831 count = Long.valueOf(0);
3832 }
3833
3834 FinderCacheUtil.putResult(FINDER_PATH_GET_PERMISSIONS_SIZE,
3835 finderArgs, count);
3836
3837 closeSession(session);
3838 }
3839 }
3840
3841 return count.intValue();
3842 }
3843
3844 public static final FinderPath FINDER_PATH_CONTAINS_PERMISSION = new FinderPath(com.liferay.portal.model.impl.PermissionModelImpl.ENTITY_CACHE_ENABLED,
3845 GroupModelImpl.FINDER_CACHE_ENABLED_GROUPS_PERMISSIONS,
3846 GroupModelImpl.MAPPING_TABLE_GROUPS_PERMISSIONS_NAME,
3847 "containsPermission",
3848 new String[] { Long.class.getName(), Long.class.getName() });
3849
3850
3858 public boolean containsPermission(long pk, long permissionPK)
3859 throws SystemException {
3860 Object[] finderArgs = new Object[] { pk, permissionPK };
3861
3862 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_PERMISSION,
3863 finderArgs, this);
3864
3865 if (value == null) {
3866 try {
3867 value = Boolean.valueOf(containsPermission.contains(pk,
3868 permissionPK));
3869 }
3870 catch (Exception e) {
3871 throw processException(e);
3872 }
3873 finally {
3874 if (value == null) {
3875 value = Boolean.FALSE;
3876 }
3877
3878 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_PERMISSION,
3879 finderArgs, value);
3880 }
3881 }
3882
3883 return value.booleanValue();
3884 }
3885
3886
3893 public boolean containsPermissions(long pk) throws SystemException {
3894 if (getPermissionsSize(pk) > 0) {
3895 return true;
3896 }
3897 else {
3898 return false;
3899 }
3900 }
3901
3902
3909 public void addPermission(long pk, long permissionPK)
3910 throws SystemException {
3911 try {
3912 addPermission.add(pk, permissionPK);
3913 }
3914 catch (Exception e) {
3915 throw processException(e);
3916 }
3917 finally {
3918 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_PERMISSIONS_NAME);
3919 }
3920 }
3921
3922
3929 public void addPermission(long pk,
3930 com.liferay.portal.model.Permission permission)
3931 throws SystemException {
3932 try {
3933 addPermission.add(pk, permission.getPrimaryKey());
3934 }
3935 catch (Exception e) {
3936 throw processException(e);
3937 }
3938 finally {
3939 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_PERMISSIONS_NAME);
3940 }
3941 }
3942
3943
3950 public void addPermissions(long pk, long[] permissionPKs)
3951 throws SystemException {
3952 try {
3953 for (long permissionPK : permissionPKs) {
3954 addPermission.add(pk, permissionPK);
3955 }
3956 }
3957 catch (Exception e) {
3958 throw processException(e);
3959 }
3960 finally {
3961 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_PERMISSIONS_NAME);
3962 }
3963 }
3964
3965
3972 public void addPermissions(long pk,
3973 List<com.liferay.portal.model.Permission> permissions)
3974 throws SystemException {
3975 try {
3976 for (com.liferay.portal.model.Permission permission : permissions) {
3977 addPermission.add(pk, permission.getPrimaryKey());
3978 }
3979 }
3980 catch (Exception e) {
3981 throw processException(e);
3982 }
3983 finally {
3984 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_PERMISSIONS_NAME);
3985 }
3986 }
3987
3988
3994 public void clearPermissions(long pk) throws SystemException {
3995 try {
3996 clearPermissions.clear(pk);
3997 }
3998 catch (Exception e) {
3999 throw processException(e);
4000 }
4001 finally {
4002 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_PERMISSIONS_NAME);
4003 }
4004 }
4005
4006
4013 public void removePermission(long pk, long permissionPK)
4014 throws SystemException {
4015 try {
4016 removePermission.remove(pk, permissionPK);
4017 }
4018 catch (Exception e) {
4019 throw processException(e);
4020 }
4021 finally {
4022 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_PERMISSIONS_NAME);
4023 }
4024 }
4025
4026
4033 public void removePermission(long pk,
4034 com.liferay.portal.model.Permission permission)
4035 throws SystemException {
4036 try {
4037 removePermission.remove(pk, permission.getPrimaryKey());
4038 }
4039 catch (Exception e) {
4040 throw processException(e);
4041 }
4042 finally {
4043 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_PERMISSIONS_NAME);
4044 }
4045 }
4046
4047
4054 public void removePermissions(long pk, long[] permissionPKs)
4055 throws SystemException {
4056 try {
4057 for (long permissionPK : permissionPKs) {
4058 removePermission.remove(pk, permissionPK);
4059 }
4060 }
4061 catch (Exception e) {
4062 throw processException(e);
4063 }
4064 finally {
4065 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_PERMISSIONS_NAME);
4066 }
4067 }
4068
4069
4076 public void removePermissions(long pk,
4077 List<com.liferay.portal.model.Permission> permissions)
4078 throws SystemException {
4079 try {
4080 for (com.liferay.portal.model.Permission permission : permissions) {
4081 removePermission.remove(pk, permission.getPrimaryKey());
4082 }
4083 }
4084 catch (Exception e) {
4085 throw processException(e);
4086 }
4087 finally {
4088 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_PERMISSIONS_NAME);
4089 }
4090 }
4091
4092
4099 public void setPermissions(long pk, long[] permissionPKs)
4100 throws SystemException {
4101 try {
4102 Set<Long> permissionPKSet = SetUtil.fromArray(permissionPKs);
4103
4104 List<com.liferay.portal.model.Permission> permissions = getPermissions(pk);
4105
4106 for (com.liferay.portal.model.Permission permission : permissions) {
4107 if (!permissionPKSet.remove(permission.getPrimaryKey())) {
4108 removePermission.remove(pk, permission.getPrimaryKey());
4109 }
4110 }
4111
4112 for (Long permissionPK : permissionPKSet) {
4113 addPermission.add(pk, permissionPK);
4114 }
4115 }
4116 catch (Exception e) {
4117 throw processException(e);
4118 }
4119 finally {
4120 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_PERMISSIONS_NAME);
4121 }
4122 }
4123
4124
4131 public void setPermissions(long pk,
4132 List<com.liferay.portal.model.Permission> permissions)
4133 throws SystemException {
4134 try {
4135 long[] permissionPKs = new long[permissions.size()];
4136
4137 for (int i = 0; i < permissions.size(); i++) {
4138 com.liferay.portal.model.Permission permission = permissions.get(i);
4139
4140 permissionPKs[i] = permission.getPrimaryKey();
4141 }
4142
4143 setPermissions(pk, permissionPKs);
4144 }
4145 catch (Exception e) {
4146 throw processException(e);
4147 }
4148 finally {
4149 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_PERMISSIONS_NAME);
4150 }
4151 }
4152
4153
4160 public List<com.liferay.portal.model.Role> getRoles(long pk)
4161 throws SystemException {
4162 return getRoles(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
4163 }
4164
4165
4178 public List<com.liferay.portal.model.Role> getRoles(long pk, int start,
4179 int end) throws SystemException {
4180 return getRoles(pk, start, end, null);
4181 }
4182
4183 public static final FinderPath FINDER_PATH_GET_ROLES = new FinderPath(com.liferay.portal.model.impl.RoleModelImpl.ENTITY_CACHE_ENABLED,
4184 GroupModelImpl.FINDER_CACHE_ENABLED_GROUPS_ROLES,
4185 GroupModelImpl.MAPPING_TABLE_GROUPS_ROLES_NAME, "getRoles",
4186 new String[] {
4187 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
4188 "com.liferay.portal.kernel.util.OrderByComparator"
4189 });
4190
4191
4205 public List<com.liferay.portal.model.Role> getRoles(long pk, int start,
4206 int end, OrderByComparator orderByComparator) throws SystemException {
4207 Object[] finderArgs = new Object[] {
4208 pk, String.valueOf(start), String.valueOf(end),
4209 String.valueOf(orderByComparator)
4210 };
4211
4212 List<com.liferay.portal.model.Role> list = (List<com.liferay.portal.model.Role>)FinderCacheUtil.getResult(FINDER_PATH_GET_ROLES,
4213 finderArgs, this);
4214
4215 if (list == null) {
4216 Session session = null;
4217
4218 try {
4219 session = openSession();
4220
4221 String sql = null;
4222
4223 if (orderByComparator != null) {
4224 sql = _SQL_GETROLES.concat(ORDER_BY_CLAUSE)
4225 .concat(orderByComparator.getOrderBy());
4226 }
4227 else {
4228 sql = _SQL_GETROLES.concat(com.liferay.portal.model.impl.RoleModelImpl.ORDER_BY_SQL);
4229 }
4230
4231 SQLQuery q = session.createSQLQuery(sql);
4232
4233 q.addEntity("Role_",
4234 com.liferay.portal.model.impl.RoleImpl.class);
4235
4236 QueryPos qPos = QueryPos.getInstance(q);
4237
4238 qPos.add(pk);
4239
4240 list = (List<com.liferay.portal.model.Role>)QueryUtil.list(q,
4241 getDialect(), start, end);
4242 }
4243 catch (Exception e) {
4244 throw processException(e);
4245 }
4246 finally {
4247 if (list == null) {
4248 FinderCacheUtil.removeResult(FINDER_PATH_GET_ROLES,
4249 finderArgs);
4250 }
4251 else {
4252 rolePersistence.cacheResult(list);
4253
4254 FinderCacheUtil.putResult(FINDER_PATH_GET_ROLES,
4255 finderArgs, list);
4256 }
4257
4258 closeSession(session);
4259 }
4260 }
4261
4262 return list;
4263 }
4264
4265 public static final FinderPath FINDER_PATH_GET_ROLES_SIZE = new FinderPath(com.liferay.portal.model.impl.RoleModelImpl.ENTITY_CACHE_ENABLED,
4266 GroupModelImpl.FINDER_CACHE_ENABLED_GROUPS_ROLES,
4267 GroupModelImpl.MAPPING_TABLE_GROUPS_ROLES_NAME, "getRolesSize",
4268 new String[] { Long.class.getName() });
4269
4270
4277 public int getRolesSize(long pk) throws SystemException {
4278 Object[] finderArgs = new Object[] { pk };
4279
4280 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_ROLES_SIZE,
4281 finderArgs, this);
4282
4283 if (count == null) {
4284 Session session = null;
4285
4286 try {
4287 session = openSession();
4288
4289 SQLQuery q = session.createSQLQuery(_SQL_GETROLESSIZE);
4290
4291 q.addScalar(COUNT_COLUMN_NAME,
4292 com.liferay.portal.kernel.dao.orm.Type.LONG);
4293
4294 QueryPos qPos = QueryPos.getInstance(q);
4295
4296 qPos.add(pk);
4297
4298 count = (Long)q.uniqueResult();
4299 }
4300 catch (Exception e) {
4301 throw processException(e);
4302 }
4303 finally {
4304 if (count == null) {
4305 count = Long.valueOf(0);
4306 }
4307
4308 FinderCacheUtil.putResult(FINDER_PATH_GET_ROLES_SIZE,
4309 finderArgs, count);
4310
4311 closeSession(session);
4312 }
4313 }
4314
4315 return count.intValue();
4316 }
4317
4318 public static final FinderPath FINDER_PATH_CONTAINS_ROLE = new FinderPath(com.liferay.portal.model.impl.RoleModelImpl.ENTITY_CACHE_ENABLED,
4319 GroupModelImpl.FINDER_CACHE_ENABLED_GROUPS_ROLES,
4320 GroupModelImpl.MAPPING_TABLE_GROUPS_ROLES_NAME, "containsRole",
4321 new String[] { Long.class.getName(), Long.class.getName() });
4322
4323
4331 public boolean containsRole(long pk, long rolePK) throws SystemException {
4332 Object[] finderArgs = new Object[] { pk, rolePK };
4333
4334 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_ROLE,
4335 finderArgs, this);
4336
4337 if (value == null) {
4338 try {
4339 value = Boolean.valueOf(containsRole.contains(pk, rolePK));
4340 }
4341 catch (Exception e) {
4342 throw processException(e);
4343 }
4344 finally {
4345 if (value == null) {
4346 value = Boolean.FALSE;
4347 }
4348
4349 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_ROLE,
4350 finderArgs, value);
4351 }
4352 }
4353
4354 return value.booleanValue();
4355 }
4356
4357
4364 public boolean containsRoles(long pk) throws SystemException {
4365 if (getRolesSize(pk) > 0) {
4366 return true;
4367 }
4368 else {
4369 return false;
4370 }
4371 }
4372
4373
4380 public void addRole(long pk, long rolePK) throws SystemException {
4381 try {
4382 addRole.add(pk, rolePK);
4383 }
4384 catch (Exception e) {
4385 throw processException(e);
4386 }
4387 finally {
4388 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ROLES_NAME);
4389 }
4390 }
4391
4392
4399 public void addRole(long pk, com.liferay.portal.model.Role role)
4400 throws SystemException {
4401 try {
4402 addRole.add(pk, role.getPrimaryKey());
4403 }
4404 catch (Exception e) {
4405 throw processException(e);
4406 }
4407 finally {
4408 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ROLES_NAME);
4409 }
4410 }
4411
4412
4419 public void addRoles(long pk, long[] rolePKs) throws SystemException {
4420 try {
4421 for (long rolePK : rolePKs) {
4422 addRole.add(pk, rolePK);
4423 }
4424 }
4425 catch (Exception e) {
4426 throw processException(e);
4427 }
4428 finally {
4429 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ROLES_NAME);
4430 }
4431 }
4432
4433
4440 public void addRoles(long pk, List<com.liferay.portal.model.Role> roles)
4441 throws SystemException {
4442 try {
4443 for (com.liferay.portal.model.Role role : roles) {
4444 addRole.add(pk, role.getPrimaryKey());
4445 }
4446 }
4447 catch (Exception e) {
4448 throw processException(e);
4449 }
4450 finally {
4451 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ROLES_NAME);
4452 }
4453 }
4454
4455
4461 public void clearRoles(long pk) throws SystemException {
4462 try {
4463 clearRoles.clear(pk);
4464 }
4465 catch (Exception e) {
4466 throw processException(e);
4467 }
4468 finally {
4469 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ROLES_NAME);
4470 }
4471 }
4472
4473
4480 public void removeRole(long pk, long rolePK) throws SystemException {
4481 try {
4482 removeRole.remove(pk, rolePK);
4483 }
4484 catch (Exception e) {
4485 throw processException(e);
4486 }
4487 finally {
4488 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ROLES_NAME);
4489 }
4490 }
4491
4492
4499 public void removeRole(long pk, com.liferay.portal.model.Role role)
4500 throws SystemException {
4501 try {
4502 removeRole.remove(pk, role.getPrimaryKey());
4503 }
4504 catch (Exception e) {
4505 throw processException(e);
4506 }
4507 finally {
4508 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ROLES_NAME);
4509 }
4510 }
4511
4512
4519 public void removeRoles(long pk, long[] rolePKs) throws SystemException {
4520 try {
4521 for (long rolePK : rolePKs) {
4522 removeRole.remove(pk, rolePK);
4523 }
4524 }
4525 catch (Exception e) {
4526 throw processException(e);
4527 }
4528 finally {
4529 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ROLES_NAME);
4530 }
4531 }
4532
4533
4540 public void removeRoles(long pk, List<com.liferay.portal.model.Role> roles)
4541 throws SystemException {
4542 try {
4543 for (com.liferay.portal.model.Role role : roles) {
4544 removeRole.remove(pk, role.getPrimaryKey());
4545 }
4546 }
4547 catch (Exception e) {
4548 throw processException(e);
4549 }
4550 finally {
4551 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ROLES_NAME);
4552 }
4553 }
4554
4555
4562 public void setRoles(long pk, long[] rolePKs) throws SystemException {
4563 try {
4564 Set<Long> rolePKSet = SetUtil.fromArray(rolePKs);
4565
4566 List<com.liferay.portal.model.Role> roles = getRoles(pk);
4567
4568 for (com.liferay.portal.model.Role role : roles) {
4569 if (!rolePKSet.remove(role.getPrimaryKey())) {
4570 removeRole.remove(pk, role.getPrimaryKey());
4571 }
4572 }
4573
4574 for (Long rolePK : rolePKSet) {
4575 addRole.add(pk, rolePK);
4576 }
4577 }
4578 catch (Exception e) {
4579 throw processException(e);
4580 }
4581 finally {
4582 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ROLES_NAME);
4583 }
4584 }
4585
4586
4593 public void setRoles(long pk, List<com.liferay.portal.model.Role> roles)
4594 throws SystemException {
4595 try {
4596 long[] rolePKs = new long[roles.size()];
4597
4598 for (int i = 0; i < roles.size(); i++) {
4599 com.liferay.portal.model.Role role = roles.get(i);
4600
4601 rolePKs[i] = role.getPrimaryKey();
4602 }
4603
4604 setRoles(pk, rolePKs);
4605 }
4606 catch (Exception e) {
4607 throw processException(e);
4608 }
4609 finally {
4610 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ROLES_NAME);
4611 }
4612 }
4613
4614
4621 public List<com.liferay.portal.model.UserGroup> getUserGroups(long pk)
4622 throws SystemException {
4623 return getUserGroups(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
4624 }
4625
4626
4639 public List<com.liferay.portal.model.UserGroup> getUserGroups(long pk,
4640 int start, int end) throws SystemException {
4641 return getUserGroups(pk, start, end, null);
4642 }
4643
4644 public static final FinderPath FINDER_PATH_GET_USERGROUPS = new FinderPath(com.liferay.portal.model.impl.UserGroupModelImpl.ENTITY_CACHE_ENABLED,
4645 GroupModelImpl.FINDER_CACHE_ENABLED_GROUPS_USERGROUPS,
4646 GroupModelImpl.MAPPING_TABLE_GROUPS_USERGROUPS_NAME,
4647 "getUserGroups",
4648 new String[] {
4649 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
4650 "com.liferay.portal.kernel.util.OrderByComparator"
4651 });
4652
4653
4667 public List<com.liferay.portal.model.UserGroup> getUserGroups(long pk,
4668 int start, int end, OrderByComparator orderByComparator)
4669 throws SystemException {
4670 Object[] finderArgs = new Object[] {
4671 pk, String.valueOf(start), String.valueOf(end),
4672 String.valueOf(orderByComparator)
4673 };
4674
4675 List<com.liferay.portal.model.UserGroup> list = (List<com.liferay.portal.model.UserGroup>)FinderCacheUtil.getResult(FINDER_PATH_GET_USERGROUPS,
4676 finderArgs, this);
4677
4678 if (list == null) {
4679 Session session = null;
4680
4681 try {
4682 session = openSession();
4683
4684 String sql = null;
4685
4686 if (orderByComparator != null) {
4687 sql = _SQL_GETUSERGROUPS.concat(ORDER_BY_CLAUSE)
4688 .concat(orderByComparator.getOrderBy());
4689 }
4690 else {
4691 sql = _SQL_GETUSERGROUPS.concat(com.liferay.portal.model.impl.UserGroupModelImpl.ORDER_BY_SQL);
4692 }
4693
4694 SQLQuery q = session.createSQLQuery(sql);
4695
4696 q.addEntity("UserGroup",
4697 com.liferay.portal.model.impl.UserGroupImpl.class);
4698
4699 QueryPos qPos = QueryPos.getInstance(q);
4700
4701 qPos.add(pk);
4702
4703 list = (List<com.liferay.portal.model.UserGroup>)QueryUtil.list(q,
4704 getDialect(), start, end);
4705 }
4706 catch (Exception e) {
4707 throw processException(e);
4708 }
4709 finally {
4710 if (list == null) {
4711 FinderCacheUtil.removeResult(FINDER_PATH_GET_USERGROUPS,
4712 finderArgs);
4713 }
4714 else {
4715 userGroupPersistence.cacheResult(list);
4716
4717 FinderCacheUtil.putResult(FINDER_PATH_GET_USERGROUPS,
4718 finderArgs, list);
4719 }
4720
4721 closeSession(session);
4722 }
4723 }
4724
4725 return list;
4726 }
4727
4728 public static final FinderPath FINDER_PATH_GET_USERGROUPS_SIZE = new FinderPath(com.liferay.portal.model.impl.UserGroupModelImpl.ENTITY_CACHE_ENABLED,
4729 GroupModelImpl.FINDER_CACHE_ENABLED_GROUPS_USERGROUPS,
4730 GroupModelImpl.MAPPING_TABLE_GROUPS_USERGROUPS_NAME,
4731 "getUserGroupsSize", new String[] { Long.class.getName() });
4732
4733
4740 public int getUserGroupsSize(long pk) throws SystemException {
4741 Object[] finderArgs = new Object[] { pk };
4742
4743 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_USERGROUPS_SIZE,
4744 finderArgs, this);
4745
4746 if (count == null) {
4747 Session session = null;
4748
4749 try {
4750 session = openSession();
4751
4752 SQLQuery q = session.createSQLQuery(_SQL_GETUSERGROUPSSIZE);
4753
4754 q.addScalar(COUNT_COLUMN_NAME,
4755 com.liferay.portal.kernel.dao.orm.Type.LONG);
4756
4757 QueryPos qPos = QueryPos.getInstance(q);
4758
4759 qPos.add(pk);
4760
4761 count = (Long)q.uniqueResult();
4762 }
4763 catch (Exception e) {
4764 throw processException(e);
4765 }
4766 finally {
4767 if (count == null) {
4768 count = Long.valueOf(0);
4769 }
4770
4771 FinderCacheUtil.putResult(FINDER_PATH_GET_USERGROUPS_SIZE,
4772 finderArgs, count);
4773
4774 closeSession(session);
4775 }
4776 }
4777
4778 return count.intValue();
4779 }
4780
4781 public static final FinderPath FINDER_PATH_CONTAINS_USERGROUP = new FinderPath(com.liferay.portal.model.impl.UserGroupModelImpl.ENTITY_CACHE_ENABLED,
4782 GroupModelImpl.FINDER_CACHE_ENABLED_GROUPS_USERGROUPS,
4783 GroupModelImpl.MAPPING_TABLE_GROUPS_USERGROUPS_NAME,
4784 "containsUserGroup",
4785 new String[] { Long.class.getName(), Long.class.getName() });
4786
4787
4795 public boolean containsUserGroup(long pk, long userGroupPK)
4796 throws SystemException {
4797 Object[] finderArgs = new Object[] { pk, userGroupPK };
4798
4799 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_USERGROUP,
4800 finderArgs, this);
4801
4802 if (value == null) {
4803 try {
4804 value = Boolean.valueOf(containsUserGroup.contains(pk,
4805 userGroupPK));
4806 }
4807 catch (Exception e) {
4808 throw processException(e);
4809 }
4810 finally {
4811 if (value == null) {
4812 value = Boolean.FALSE;
4813 }
4814
4815 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_USERGROUP,
4816 finderArgs, value);
4817 }
4818 }
4819
4820 return value.booleanValue();
4821 }
4822
4823
4830 public boolean containsUserGroups(long pk) throws SystemException {
4831 if (getUserGroupsSize(pk) > 0) {
4832 return true;
4833 }
4834 else {
4835 return false;
4836 }
4837 }
4838
4839
4846 public void addUserGroup(long pk, long userGroupPK)
4847 throws SystemException {
4848 try {
4849 addUserGroup.add(pk, userGroupPK);
4850 }
4851 catch (Exception e) {
4852 throw processException(e);
4853 }
4854 finally {
4855 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_USERGROUPS_NAME);
4856 }
4857 }
4858
4859
4866 public void addUserGroup(long pk,
4867 com.liferay.portal.model.UserGroup userGroup) throws SystemException {
4868 try {
4869 addUserGroup.add(pk, userGroup.getPrimaryKey());
4870 }
4871 catch (Exception e) {
4872 throw processException(e);
4873 }
4874 finally {
4875 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_USERGROUPS_NAME);
4876 }
4877 }
4878
4879
4886 public void addUserGroups(long pk, long[] userGroupPKs)
4887 throws SystemException {
4888 try {
4889 for (long userGroupPK : userGroupPKs) {
4890 addUserGroup.add(pk, userGroupPK);
4891 }
4892 }
4893 catch (Exception e) {
4894 throw processException(e);
4895 }
4896 finally {
4897 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_USERGROUPS_NAME);
4898 }
4899 }
4900
4901
4908 public void addUserGroups(long pk,
4909 List<com.liferay.portal.model.UserGroup> userGroups)
4910 throws SystemException {
4911 try {
4912 for (com.liferay.portal.model.UserGroup userGroup : userGroups) {
4913 addUserGroup.add(pk, userGroup.getPrimaryKey());
4914 }
4915 }
4916 catch (Exception e) {
4917 throw processException(e);
4918 }
4919 finally {
4920 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_USERGROUPS_NAME);
4921 }
4922 }
4923
4924
4930 public void clearUserGroups(long pk) throws SystemException {
4931 try {
4932 clearUserGroups.clear(pk);
4933 }
4934 catch (Exception e) {
4935 throw processException(e);
4936 }
4937 finally {
4938 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_USERGROUPS_NAME);
4939 }
4940 }
4941
4942
4949 public void removeUserGroup(long pk, long userGroupPK)
4950 throws SystemException {
4951 try {
4952 removeUserGroup.remove(pk, userGroupPK);
4953 }
4954 catch (Exception e) {
4955 throw processException(e);
4956 }
4957 finally {
4958 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_USERGROUPS_NAME);
4959 }
4960 }
4961
4962
4969 public void removeUserGroup(long pk,
4970 com.liferay.portal.model.UserGroup userGroup) throws SystemException {
4971 try {
4972 removeUserGroup.remove(pk, userGroup.getPrimaryKey());
4973 }
4974 catch (Exception e) {
4975 throw processException(e);
4976 }
4977 finally {
4978 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_USERGROUPS_NAME);
4979 }
4980 }
4981
4982
4989 public void removeUserGroups(long pk, long[] userGroupPKs)
4990 throws SystemException {
4991 try {
4992 for (long userGroupPK : userGroupPKs) {
4993 removeUserGroup.remove(pk, userGroupPK);
4994 }
4995 }
4996 catch (Exception e) {
4997 throw processException(e);
4998 }
4999 finally {
5000 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_USERGROUPS_NAME);
5001 }
5002 }
5003
5004
5011 public void removeUserGroups(long pk,
5012 List<com.liferay.portal.model.UserGroup> userGroups)
5013 throws SystemException {
5014 try {
5015 for (com.liferay.portal.model.UserGroup userGroup : userGroups) {
5016 removeUserGroup.remove(pk, userGroup.getPrimaryKey());
5017 }
5018 }
5019 catch (Exception e) {
5020 throw processException(e);
5021 }
5022 finally {
5023 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_USERGROUPS_NAME);
5024 }
5025 }
5026
5027
5034 public void setUserGroups(long pk, long[] userGroupPKs)
5035 throws SystemException {
5036 try {
5037 Set<Long> userGroupPKSet = SetUtil.fromArray(userGroupPKs);
5038
5039 List<com.liferay.portal.model.UserGroup> userGroups = getUserGroups(pk);
5040
5041 for (com.liferay.portal.model.UserGroup userGroup : userGroups) {
5042 if (!userGroupPKSet.remove(userGroup.getPrimaryKey())) {
5043 removeUserGroup.remove(pk, userGroup.getPrimaryKey());
5044 }
5045 }
5046
5047 for (Long userGroupPK : userGroupPKSet) {
5048 addUserGroup.add(pk, userGroupPK);
5049 }
5050 }
5051 catch (Exception e) {
5052 throw processException(e);
5053 }
5054 finally {
5055 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_USERGROUPS_NAME);
5056 }
5057 }
5058
5059
5066 public void setUserGroups(long pk,
5067 List<com.liferay.portal.model.UserGroup> userGroups)
5068 throws SystemException {
5069 try {
5070 long[] userGroupPKs = new long[userGroups.size()];
5071
5072 for (int i = 0; i < userGroups.size(); i++) {
5073 com.liferay.portal.model.UserGroup userGroup = userGroups.get(i);
5074
5075 userGroupPKs[i] = userGroup.getPrimaryKey();
5076 }
5077
5078 setUserGroups(pk, userGroupPKs);
5079 }
5080 catch (Exception e) {
5081 throw processException(e);
5082 }
5083 finally {
5084 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_USERGROUPS_NAME);
5085 }
5086 }
5087
5088
5095 public List<com.liferay.portal.model.User> getUsers(long pk)
5096 throws SystemException {
5097 return getUsers(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
5098 }
5099
5100
5113 public List<com.liferay.portal.model.User> getUsers(long pk, int start,
5114 int end) throws SystemException {
5115 return getUsers(pk, start, end, null);
5116 }
5117
5118 public static final FinderPath FINDER_PATH_GET_USERS = new FinderPath(com.liferay.portal.model.impl.UserModelImpl.ENTITY_CACHE_ENABLED,
5119 GroupModelImpl.FINDER_CACHE_ENABLED_USERS_GROUPS,
5120 GroupModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME, "getUsers",
5121 new String[] {
5122 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
5123 "com.liferay.portal.kernel.util.OrderByComparator"
5124 });
5125
5126
5140 public List<com.liferay.portal.model.User> getUsers(long pk, int start,
5141 int end, OrderByComparator orderByComparator) throws SystemException {
5142 Object[] finderArgs = new Object[] {
5143 pk, String.valueOf(start), String.valueOf(end),
5144 String.valueOf(orderByComparator)
5145 };
5146
5147 List<com.liferay.portal.model.User> list = (List<com.liferay.portal.model.User>)FinderCacheUtil.getResult(FINDER_PATH_GET_USERS,
5148 finderArgs, this);
5149
5150 if (list == null) {
5151 Session session = null;
5152
5153 try {
5154 session = openSession();
5155
5156 String sql = null;
5157
5158 if (orderByComparator != null) {
5159 sql = _SQL_GETUSERS.concat(ORDER_BY_CLAUSE)
5160 .concat(orderByComparator.getOrderBy());
5161 }
5162 else {
5163 sql = _SQL_GETUSERS;
5164 }
5165
5166 SQLQuery q = session.createSQLQuery(sql);
5167
5168 q.addEntity("User_",
5169 com.liferay.portal.model.impl.UserImpl.class);
5170
5171 QueryPos qPos = QueryPos.getInstance(q);
5172
5173 qPos.add(pk);
5174
5175 list = (List<com.liferay.portal.model.User>)QueryUtil.list(q,
5176 getDialect(), start, end);
5177 }
5178 catch (Exception e) {
5179 throw processException(e);
5180 }
5181 finally {
5182 if (list == null) {
5183 FinderCacheUtil.removeResult(FINDER_PATH_GET_USERS,
5184 finderArgs);
5185 }
5186 else {
5187 userPersistence.cacheResult(list);
5188
5189 FinderCacheUtil.putResult(FINDER_PATH_GET_USERS,
5190 finderArgs, list);
5191 }
5192
5193 closeSession(session);
5194 }
5195 }
5196
5197 return list;
5198 }
5199
5200 public static final FinderPath FINDER_PATH_GET_USERS_SIZE = new FinderPath(com.liferay.portal.model.impl.UserModelImpl.ENTITY_CACHE_ENABLED,
5201 GroupModelImpl.FINDER_CACHE_ENABLED_USERS_GROUPS,
5202 GroupModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME, "getUsersSize",
5203 new String[] { Long.class.getName() });
5204
5205
5212 public int getUsersSize(long pk) throws SystemException {
5213 Object[] finderArgs = new Object[] { pk };
5214
5215 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_USERS_SIZE,
5216 finderArgs, this);
5217
5218 if (count == null) {
5219 Session session = null;
5220
5221 try {
5222 session = openSession();
5223
5224 SQLQuery q = session.createSQLQuery(_SQL_GETUSERSSIZE);
5225
5226 q.addScalar(COUNT_COLUMN_NAME,
5227 com.liferay.portal.kernel.dao.orm.Type.LONG);
5228
5229 QueryPos qPos = QueryPos.getInstance(q);
5230
5231 qPos.add(pk);
5232
5233 count = (Long)q.uniqueResult();
5234 }
5235 catch (Exception e) {
5236 throw processException(e);
5237 }
5238 finally {
5239 if (count == null) {
5240 count = Long.valueOf(0);
5241 }
5242
5243 FinderCacheUtil.putResult(FINDER_PATH_GET_USERS_SIZE,
5244 finderArgs, count);
5245
5246 closeSession(session);
5247 }
5248 }
5249
5250 return count.intValue();
5251 }
5252
5253 public static final FinderPath FINDER_PATH_CONTAINS_USER = new FinderPath(com.liferay.portal.model.impl.UserModelImpl.ENTITY_CACHE_ENABLED,
5254 GroupModelImpl.FINDER_CACHE_ENABLED_USERS_GROUPS,
5255 GroupModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME, "containsUser",
5256 new String[] { Long.class.getName(), Long.class.getName() });
5257
5258
5266 public boolean containsUser(long pk, long userPK) throws SystemException {
5267 Object[] finderArgs = new Object[] { pk, userPK };
5268
5269 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_USER,
5270 finderArgs, this);
5271
5272 if (value == null) {
5273 try {
5274 value = Boolean.valueOf(containsUser.contains(pk, userPK));
5275 }
5276 catch (Exception e) {
5277 throw processException(e);
5278 }
5279 finally {
5280 if (value == null) {
5281 value = Boolean.FALSE;
5282 }
5283
5284 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_USER,
5285 finderArgs, value);
5286 }
5287 }
5288
5289 return value.booleanValue();
5290 }
5291
5292
5299 public boolean containsUsers(long pk) throws SystemException {
5300 if (getUsersSize(pk) > 0) {
5301 return true;
5302 }
5303 else {
5304 return false;
5305 }
5306 }
5307
5308
5315 public void addUser(long pk, long userPK) throws SystemException {
5316 try {
5317 addUser.add(pk, userPK);
5318 }
5319 catch (Exception e) {
5320 throw processException(e);
5321 }
5322 finally {
5323 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
5324 }
5325 }
5326
5327
5334 public void addUser(long pk, com.liferay.portal.model.User user)
5335 throws SystemException {
5336 try {
5337 addUser.add(pk, user.getPrimaryKey());
5338 }
5339 catch (Exception e) {
5340 throw processException(e);
5341 }
5342 finally {
5343 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
5344 }
5345 }
5346
5347
5354 public void addUsers(long pk, long[] userPKs) throws SystemException {
5355 try {
5356 for (long userPK : userPKs) {
5357 addUser.add(pk, userPK);
5358 }
5359 }
5360 catch (Exception e) {
5361 throw processException(e);
5362 }
5363 finally {
5364 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
5365 }
5366 }
5367
5368
5375 public void addUsers(long pk, List<com.liferay.portal.model.User> users)
5376 throws SystemException {
5377 try {
5378 for (com.liferay.portal.model.User user : users) {
5379 addUser.add(pk, user.getPrimaryKey());
5380 }
5381 }
5382 catch (Exception e) {
5383 throw processException(e);
5384 }
5385 finally {
5386 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
5387 }
5388 }
5389
5390
5396 public void clearUsers(long pk) throws SystemException {
5397 try {
5398 clearUsers.clear(pk);
5399 }
5400 catch (Exception e) {
5401 throw processException(e);
5402 }
5403 finally {
5404 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
5405 }
5406 }
5407
5408
5415 public void removeUser(long pk, long userPK) throws SystemException {
5416 try {
5417 removeUser.remove(pk, userPK);
5418 }
5419 catch (Exception e) {
5420 throw processException(e);
5421 }
5422 finally {
5423 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
5424 }
5425 }
5426
5427
5434 public void removeUser(long pk, com.liferay.portal.model.User user)
5435 throws SystemException {
5436 try {
5437 removeUser.remove(pk, user.getPrimaryKey());
5438 }
5439 catch (Exception e) {
5440 throw processException(e);
5441 }
5442 finally {
5443 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
5444 }
5445 }
5446
5447
5454 public void removeUsers(long pk, long[] userPKs) throws SystemException {
5455 try {
5456 for (long userPK : userPKs) {
5457 removeUser.remove(pk, userPK);
5458 }
5459 }
5460 catch (Exception e) {
5461 throw processException(e);
5462 }
5463 finally {
5464 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
5465 }
5466 }
5467
5468
5475 public void removeUsers(long pk, List<com.liferay.portal.model.User> users)
5476 throws SystemException {
5477 try {
5478 for (com.liferay.portal.model.User user : users) {
5479 removeUser.remove(pk, user.getPrimaryKey());
5480 }
5481 }
5482 catch (Exception e) {
5483 throw processException(e);
5484 }
5485 finally {
5486 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
5487 }
5488 }
5489
5490
5497 public void setUsers(long pk, long[] userPKs) throws SystemException {
5498 try {
5499 Set<Long> userPKSet = SetUtil.fromArray(userPKs);
5500
5501 List<com.liferay.portal.model.User> users = getUsers(pk);
5502
5503 for (com.liferay.portal.model.User user : users) {
5504 if (!userPKSet.remove(user.getPrimaryKey())) {
5505 removeUser.remove(pk, user.getPrimaryKey());
5506 }
5507 }
5508
5509 for (Long userPK : userPKSet) {
5510 addUser.add(pk, userPK);
5511 }
5512 }
5513 catch (Exception e) {
5514 throw processException(e);
5515 }
5516 finally {
5517 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
5518 }
5519 }
5520
5521
5528 public void setUsers(long pk, List<com.liferay.portal.model.User> users)
5529 throws SystemException {
5530 try {
5531 long[] userPKs = new long[users.size()];
5532
5533 for (int i = 0; i < users.size(); i++) {
5534 com.liferay.portal.model.User user = users.get(i);
5535
5536 userPKs[i] = user.getPrimaryKey();
5537 }
5538
5539 setUsers(pk, userPKs);
5540 }
5541 catch (Exception e) {
5542 throw processException(e);
5543 }
5544 finally {
5545 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
5546 }
5547 }
5548
5549
5552 public void afterPropertiesSet() {
5553 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
5554 com.liferay.portal.util.PropsUtil.get(
5555 "value.object.listener.com.liferay.portal.model.Group")));
5556
5557 if (listenerClassNames.length > 0) {
5558 try {
5559 List<ModelListener<Group>> listenersList = new ArrayList<ModelListener<Group>>();
5560
5561 for (String listenerClassName : listenerClassNames) {
5562 listenersList.add((ModelListener<Group>)InstanceFactory.newInstance(
5563 listenerClassName));
5564 }
5565
5566 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
5567 }
5568 catch (Exception e) {
5569 _log.error(e);
5570 }
5571 }
5572
5573 containsOrganization = new ContainsOrganization(this);
5574
5575 addOrganization = new AddOrganization(this);
5576 clearOrganizations = new ClearOrganizations(this);
5577 removeOrganization = new RemoveOrganization(this);
5578
5579 containsPermission = new ContainsPermission(this);
5580
5581 addPermission = new AddPermission(this);
5582 clearPermissions = new ClearPermissions(this);
5583 removePermission = new RemovePermission(this);
5584
5585 containsRole = new ContainsRole(this);
5586
5587 addRole = new AddRole(this);
5588 clearRoles = new ClearRoles(this);
5589 removeRole = new RemoveRole(this);
5590
5591 containsUserGroup = new ContainsUserGroup(this);
5592
5593 addUserGroup = new AddUserGroup(this);
5594 clearUserGroups = new ClearUserGroups(this);
5595 removeUserGroup = new RemoveUserGroup(this);
5596
5597 containsUser = new ContainsUser(this);
5598
5599 addUser = new AddUser(this);
5600 clearUsers = new ClearUsers(this);
5601 removeUser = new RemoveUser(this);
5602 }
5603
5604 public void destroy() {
5605 EntityCacheUtil.removeCache(GroupImpl.class.getName());
5606 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
5607 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST);
5608 }
5609
5610 @BeanReference(type = AccountPersistence.class)
5611 protected AccountPersistence accountPersistence;
5612 @BeanReference(type = AddressPersistence.class)
5613 protected AddressPersistence addressPersistence;
5614 @BeanReference(type = BrowserTrackerPersistence.class)
5615 protected BrowserTrackerPersistence browserTrackerPersistence;
5616 @BeanReference(type = ClassNamePersistence.class)
5617 protected ClassNamePersistence classNamePersistence;
5618 @BeanReference(type = ClusterGroupPersistence.class)
5619 protected ClusterGroupPersistence clusterGroupPersistence;
5620 @BeanReference(type = CompanyPersistence.class)
5621 protected CompanyPersistence companyPersistence;
5622 @BeanReference(type = ContactPersistence.class)
5623 protected ContactPersistence contactPersistence;
5624 @BeanReference(type = CountryPersistence.class)
5625 protected CountryPersistence countryPersistence;
5626 @BeanReference(type = EmailAddressPersistence.class)
5627 protected EmailAddressPersistence emailAddressPersistence;
5628 @BeanReference(type = GroupPersistence.class)
5629 protected GroupPersistence groupPersistence;
5630 @BeanReference(type = ImagePersistence.class)
5631 protected ImagePersistence imagePersistence;
5632 @BeanReference(type = LayoutPersistence.class)
5633 protected LayoutPersistence layoutPersistence;
5634 @BeanReference(type = LayoutPrototypePersistence.class)
5635 protected LayoutPrototypePersistence layoutPrototypePersistence;
5636 @BeanReference(type = LayoutSetPersistence.class)
5637 protected LayoutSetPersistence layoutSetPersistence;
5638 @BeanReference(type = LayoutSetPrototypePersistence.class)
5639 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
5640 @BeanReference(type = ListTypePersistence.class)
5641 protected ListTypePersistence listTypePersistence;
5642 @BeanReference(type = LockPersistence.class)
5643 protected LockPersistence lockPersistence;
5644 @BeanReference(type = MembershipRequestPersistence.class)
5645 protected MembershipRequestPersistence membershipRequestPersistence;
5646 @BeanReference(type = OrganizationPersistence.class)
5647 protected OrganizationPersistence organizationPersistence;
5648 @BeanReference(type = OrgGroupPermissionPersistence.class)
5649 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
5650 @BeanReference(type = OrgGroupRolePersistence.class)
5651 protected OrgGroupRolePersistence orgGroupRolePersistence;
5652 @BeanReference(type = OrgLaborPersistence.class)
5653 protected OrgLaborPersistence orgLaborPersistence;
5654 @BeanReference(type = PasswordPolicyPersistence.class)
5655 protected PasswordPolicyPersistence passwordPolicyPersistence;
5656 @BeanReference(type = PasswordPolicyRelPersistence.class)
5657 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
5658 @BeanReference(type = PasswordTrackerPersistence.class)
5659 protected PasswordTrackerPersistence passwordTrackerPersistence;
5660 @BeanReference(type = PermissionPersistence.class)
5661 protected PermissionPersistence permissionPersistence;
5662 @BeanReference(type = PhonePersistence.class)
5663 protected PhonePersistence phonePersistence;
5664 @BeanReference(type = PluginSettingPersistence.class)
5665 protected PluginSettingPersistence pluginSettingPersistence;
5666 @BeanReference(type = PortletPersistence.class)
5667 protected PortletPersistence portletPersistence;
5668 @BeanReference(type = PortletItemPersistence.class)
5669 protected PortletItemPersistence portletItemPersistence;
5670 @BeanReference(type = PortletPreferencesPersistence.class)
5671 protected PortletPreferencesPersistence portletPreferencesPersistence;
5672 @BeanReference(type = RegionPersistence.class)
5673 protected RegionPersistence regionPersistence;
5674 @BeanReference(type = ReleasePersistence.class)
5675 protected ReleasePersistence releasePersistence;
5676 @BeanReference(type = ResourcePersistence.class)
5677 protected ResourcePersistence resourcePersistence;
5678 @BeanReference(type = ResourceActionPersistence.class)
5679 protected ResourceActionPersistence resourceActionPersistence;
5680 @BeanReference(type = ResourceCodePersistence.class)
5681 protected ResourceCodePersistence resourceCodePersistence;
5682 @BeanReference(type = ResourcePermissionPersistence.class)
5683 protected ResourcePermissionPersistence resourcePermissionPersistence;
5684 @BeanReference(type = RolePersistence.class)
5685 protected RolePersistence rolePersistence;
5686 @BeanReference(type = ServiceComponentPersistence.class)
5687 protected ServiceComponentPersistence serviceComponentPersistence;
5688 @BeanReference(type = ShardPersistence.class)
5689 protected ShardPersistence shardPersistence;
5690 @BeanReference(type = SubscriptionPersistence.class)
5691 protected SubscriptionPersistence subscriptionPersistence;
5692 @BeanReference(type = TicketPersistence.class)
5693 protected TicketPersistence ticketPersistence;
5694 @BeanReference(type = TeamPersistence.class)
5695 protected TeamPersistence teamPersistence;
5696 @BeanReference(type = UserPersistence.class)
5697 protected UserPersistence userPersistence;
5698 @BeanReference(type = UserGroupPersistence.class)
5699 protected UserGroupPersistence userGroupPersistence;
5700 @BeanReference(type = UserGroupGroupRolePersistence.class)
5701 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
5702 @BeanReference(type = UserGroupRolePersistence.class)
5703 protected UserGroupRolePersistence userGroupRolePersistence;
5704 @BeanReference(type = UserIdMapperPersistence.class)
5705 protected UserIdMapperPersistence userIdMapperPersistence;
5706 @BeanReference(type = UserTrackerPersistence.class)
5707 protected UserTrackerPersistence userTrackerPersistence;
5708 @BeanReference(type = UserTrackerPathPersistence.class)
5709 protected UserTrackerPathPersistence userTrackerPathPersistence;
5710 @BeanReference(type = WebDAVPropsPersistence.class)
5711 protected WebDAVPropsPersistence webDAVPropsPersistence;
5712 @BeanReference(type = WebsitePersistence.class)
5713 protected WebsitePersistence websitePersistence;
5714 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
5715 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
5716 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
5717 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
5718 @BeanReference(type = AssetEntryPersistence.class)
5719 protected AssetEntryPersistence assetEntryPersistence;
5720 @BeanReference(type = BlogsEntryPersistence.class)
5721 protected BlogsEntryPersistence blogsEntryPersistence;
5722 @BeanReference(type = BlogsStatsUserPersistence.class)
5723 protected BlogsStatsUserPersistence blogsStatsUserPersistence;
5724 @BeanReference(type = BookmarksFolderPersistence.class)
5725 protected BookmarksFolderPersistence bookmarksFolderPersistence;
5726 @BeanReference(type = CalEventPersistence.class)
5727 protected CalEventPersistence calEventPersistence;
5728 @BeanReference(type = DLFolderPersistence.class)
5729 protected DLFolderPersistence dlFolderPersistence;
5730 @BeanReference(type = IGFolderPersistence.class)
5731 protected IGFolderPersistence igFolderPersistence;
5732 @BeanReference(type = JournalArticlePersistence.class)
5733 protected JournalArticlePersistence journalArticlePersistence;
5734 @BeanReference(type = JournalStructurePersistence.class)
5735 protected JournalStructurePersistence journalStructurePersistence;
5736 @BeanReference(type = JournalTemplatePersistence.class)
5737 protected JournalTemplatePersistence journalTemplatePersistence;
5738 @BeanReference(type = MBBanPersistence.class)
5739 protected MBBanPersistence mbBanPersistence;
5740 @BeanReference(type = MBCategoryPersistence.class)
5741 protected MBCategoryPersistence mbCategoryPersistence;
5742 @BeanReference(type = MBStatsUserPersistence.class)
5743 protected MBStatsUserPersistence mbStatsUserPersistence;
5744 @BeanReference(type = PollsQuestionPersistence.class)
5745 protected PollsQuestionPersistence pollsQuestionPersistence;
5746 @BeanReference(type = ShoppingCartPersistence.class)
5747 protected ShoppingCartPersistence shoppingCartPersistence;
5748 @BeanReference(type = ShoppingCategoryPersistence.class)
5749 protected ShoppingCategoryPersistence shoppingCategoryPersistence;
5750 @BeanReference(type = ShoppingCouponPersistence.class)
5751 protected ShoppingCouponPersistence shoppingCouponPersistence;
5752 @BeanReference(type = ShoppingOrderPersistence.class)
5753 protected ShoppingOrderPersistence shoppingOrderPersistence;
5754 @BeanReference(type = SCFrameworkVersionPersistence.class)
5755 protected SCFrameworkVersionPersistence scFrameworkVersionPersistence;
5756 @BeanReference(type = SCProductEntryPersistence.class)
5757 protected SCProductEntryPersistence scProductEntryPersistence;
5758 @BeanReference(type = TasksProposalPersistence.class)
5759 protected TasksProposalPersistence tasksProposalPersistence;
5760 @BeanReference(type = WikiNodePersistence.class)
5761 protected WikiNodePersistence wikiNodePersistence;
5762 protected ContainsOrganization containsOrganization;
5763 protected AddOrganization addOrganization;
5764 protected ClearOrganizations clearOrganizations;
5765 protected RemoveOrganization removeOrganization;
5766 protected ContainsPermission containsPermission;
5767 protected AddPermission addPermission;
5768 protected ClearPermissions clearPermissions;
5769 protected RemovePermission removePermission;
5770 protected ContainsRole containsRole;
5771 protected AddRole addRole;
5772 protected ClearRoles clearRoles;
5773 protected RemoveRole removeRole;
5774 protected ContainsUserGroup containsUserGroup;
5775 protected AddUserGroup addUserGroup;
5776 protected ClearUserGroups clearUserGroups;
5777 protected RemoveUserGroup removeUserGroup;
5778 protected ContainsUser containsUser;
5779 protected AddUser addUser;
5780 protected ClearUsers clearUsers;
5781 protected RemoveUser removeUser;
5782
5783 protected class ContainsOrganization {
5784 protected ContainsOrganization(GroupPersistenceImpl persistenceImpl) {
5785 super();
5786
5787 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
5788 _SQL_CONTAINSORGANIZATION,
5789 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
5790 RowMapper.COUNT);
5791 }
5792
5793 protected boolean contains(long groupId, long organizationId) {
5794 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
5795 new Long(groupId), new Long(organizationId)
5796 });
5797
5798 if (results.size() > 0) {
5799 Integer count = results.get(0);
5800
5801 if (count.intValue() > 0) {
5802 return true;
5803 }
5804 }
5805
5806 return false;
5807 }
5808
5809 private MappingSqlQuery<Integer> _mappingSqlQuery;
5810 }
5811
5812 protected class AddOrganization {
5813 protected AddOrganization(GroupPersistenceImpl persistenceImpl) {
5814 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
5815 "INSERT INTO Groups_Orgs (groupId, organizationId) VALUES (?, ?)",
5816 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
5817 _persistenceImpl = persistenceImpl;
5818 }
5819
5820 protected void add(long groupId, long organizationId)
5821 throws SystemException {
5822 if (!_persistenceImpl.containsOrganization.contains(groupId,
5823 organizationId)) {
5824 ModelListener<com.liferay.portal.model.Organization>[] organizationListeners =
5825 organizationPersistence.getListeners();
5826
5827 for (ModelListener<Group> listener : listeners) {
5828 listener.onBeforeAddAssociation(groupId,
5829 com.liferay.portal.model.Organization.class.getName(),
5830 organizationId);
5831 }
5832
5833 for (ModelListener<com.liferay.portal.model.Organization> listener : organizationListeners) {
5834 listener.onBeforeAddAssociation(organizationId,
5835 Group.class.getName(), groupId);
5836 }
5837
5838 _sqlUpdate.update(new Object[] {
5839 new Long(groupId), new Long(organizationId)
5840 });
5841
5842 for (ModelListener<Group> listener : listeners) {
5843 listener.onAfterAddAssociation(groupId,
5844 com.liferay.portal.model.Organization.class.getName(),
5845 organizationId);
5846 }
5847
5848 for (ModelListener<com.liferay.portal.model.Organization> listener : organizationListeners) {
5849 listener.onAfterAddAssociation(organizationId,
5850 Group.class.getName(), groupId);
5851 }
5852 }
5853 }
5854
5855 private SqlUpdate _sqlUpdate;
5856 private GroupPersistenceImpl _persistenceImpl;
5857 }
5858
5859 protected class ClearOrganizations {
5860 protected ClearOrganizations(GroupPersistenceImpl persistenceImpl) {
5861 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
5862 "DELETE FROM Groups_Orgs WHERE groupId = ?",
5863 new int[] { java.sql.Types.BIGINT });
5864 }
5865
5866 protected void clear(long groupId) throws SystemException {
5867 ModelListener<com.liferay.portal.model.Organization>[] organizationListeners =
5868 organizationPersistence.getListeners();
5869
5870 List<com.liferay.portal.model.Organization> organizations = null;
5871
5872 if ((listeners.length > 0) || (organizationListeners.length > 0)) {
5873 organizations = getOrganizations(groupId);
5874
5875 for (com.liferay.portal.model.Organization organization : organizations) {
5876 for (ModelListener<Group> listener : listeners) {
5877 listener.onBeforeRemoveAssociation(groupId,
5878 com.liferay.portal.model.Organization.class.getName(),
5879 organization.getPrimaryKey());
5880 }
5881
5882 for (ModelListener<com.liferay.portal.model.Organization> listener : organizationListeners) {
5883 listener.onBeforeRemoveAssociation(organization.getPrimaryKey(),
5884 Group.class.getName(), groupId);
5885 }
5886 }
5887 }
5888
5889 _sqlUpdate.update(new Object[] { new Long(groupId) });
5890
5891 if ((listeners.length > 0) || (organizationListeners.length > 0)) {
5892 for (com.liferay.portal.model.Organization organization : organizations) {
5893 for (ModelListener<Group> listener : listeners) {
5894 listener.onAfterRemoveAssociation(groupId,
5895 com.liferay.portal.model.Organization.class.getName(),
5896 organization.getPrimaryKey());
5897 }
5898
5899 for (ModelListener<com.liferay.portal.model.Organization> listener : organizationListeners) {
5900 listener.onAfterRemoveAssociation(organization.getPrimaryKey(),
5901 Group.class.getName(), groupId);
5902 }
5903 }
5904 }
5905 }
5906
5907 private SqlUpdate _sqlUpdate;
5908 }
5909
5910 protected class RemoveOrganization {
5911 protected RemoveOrganization(GroupPersistenceImpl persistenceImpl) {
5912 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
5913 "DELETE FROM Groups_Orgs WHERE groupId = ? AND organizationId = ?",
5914 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
5915 _persistenceImpl = persistenceImpl;
5916 }
5917
5918 protected void remove(long groupId, long organizationId)
5919 throws SystemException {
5920 if (_persistenceImpl.containsOrganization.contains(groupId,
5921 organizationId)) {
5922 ModelListener<com.liferay.portal.model.Organization>[] organizationListeners =
5923 organizationPersistence.getListeners();
5924
5925 for (ModelListener<Group> listener : listeners) {
5926 listener.onBeforeRemoveAssociation(groupId,
5927 com.liferay.portal.model.Organization.class.getName(),
5928 organizationId);
5929 }
5930
5931 for (ModelListener<com.liferay.portal.model.Organization> listener : organizationListeners) {
5932 listener.onBeforeRemoveAssociation(organizationId,
5933 Group.class.getName(), groupId);
5934 }
5935
5936 _sqlUpdate.update(new Object[] {
5937 new Long(groupId), new Long(organizationId)
5938 });
5939
5940 for (ModelListener<Group> listener : listeners) {
5941 listener.onAfterRemoveAssociation(groupId,
5942 com.liferay.portal.model.Organization.class.getName(),
5943 organizationId);
5944 }
5945
5946 for (ModelListener<com.liferay.portal.model.Organization> listener : organizationListeners) {
5947 listener.onAfterRemoveAssociation(organizationId,
5948 Group.class.getName(), groupId);
5949 }
5950 }
5951 }
5952
5953 private SqlUpdate _sqlUpdate;
5954 private GroupPersistenceImpl _persistenceImpl;
5955 }
5956
5957 protected class ContainsPermission {
5958 protected ContainsPermission(GroupPersistenceImpl persistenceImpl) {
5959 super();
5960
5961 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
5962 _SQL_CONTAINSPERMISSION,
5963 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
5964 RowMapper.COUNT);
5965 }
5966
5967 protected boolean contains(long groupId, long permissionId) {
5968 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
5969 new Long(groupId), new Long(permissionId)
5970 });
5971
5972 if (results.size() > 0) {
5973 Integer count = results.get(0);
5974
5975 if (count.intValue() > 0) {
5976 return true;
5977 }
5978 }
5979
5980 return false;
5981 }
5982
5983 private MappingSqlQuery<Integer> _mappingSqlQuery;
5984 }
5985
5986 protected class AddPermission {
5987 protected AddPermission(GroupPersistenceImpl persistenceImpl) {
5988 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
5989 "INSERT INTO Groups_Permissions (groupId, permissionId) VALUES (?, ?)",
5990 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
5991 _persistenceImpl = persistenceImpl;
5992 }
5993
5994 protected void add(long groupId, long permissionId)
5995 throws SystemException {
5996 if (!_persistenceImpl.containsPermission.contains(groupId,
5997 permissionId)) {
5998 ModelListener<com.liferay.portal.model.Permission>[] permissionListeners =
5999 permissionPersistence.getListeners();
6000
6001 for (ModelListener<Group> listener : listeners) {
6002 listener.onBeforeAddAssociation(groupId,
6003 com.liferay.portal.model.Permission.class.getName(),
6004 permissionId);
6005 }
6006
6007 for (ModelListener<com.liferay.portal.model.Permission> listener : permissionListeners) {
6008 listener.onBeforeAddAssociation(permissionId,
6009 Group.class.getName(), groupId);
6010 }
6011
6012 _sqlUpdate.update(new Object[] {
6013 new Long(groupId), new Long(permissionId)
6014 });
6015
6016 for (ModelListener<Group> listener : listeners) {
6017 listener.onAfterAddAssociation(groupId,
6018 com.liferay.portal.model.Permission.class.getName(),
6019 permissionId);
6020 }
6021
6022 for (ModelListener<com.liferay.portal.model.Permission> listener : permissionListeners) {
6023 listener.onAfterAddAssociation(permissionId,
6024 Group.class.getName(), groupId);
6025 }
6026 }
6027 }
6028
6029 private SqlUpdate _sqlUpdate;
6030 private GroupPersistenceImpl _persistenceImpl;
6031 }
6032
6033 protected class ClearPermissions {
6034 protected ClearPermissions(GroupPersistenceImpl persistenceImpl) {
6035 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
6036 "DELETE FROM Groups_Permissions WHERE groupId = ?",
6037 new int[] { java.sql.Types.BIGINT });
6038 }
6039
6040 protected void clear(long groupId) throws SystemException {
6041 ModelListener<com.liferay.portal.model.Permission>[] permissionListeners =
6042 permissionPersistence.getListeners();
6043
6044 List<com.liferay.portal.model.Permission> permissions = null;
6045
6046 if ((listeners.length > 0) || (permissionListeners.length > 0)) {
6047 permissions = getPermissions(groupId);
6048
6049 for (com.liferay.portal.model.Permission permission : permissions) {
6050 for (ModelListener<Group> listener : listeners) {
6051 listener.onBeforeRemoveAssociation(groupId,
6052 com.liferay.portal.model.Permission.class.getName(),
6053 permission.getPrimaryKey());
6054 }
6055
6056 for (ModelListener<com.liferay.portal.model.Permission> listener : permissionListeners) {
6057 listener.onBeforeRemoveAssociation(permission.getPrimaryKey(),
6058 Group.class.getName(), groupId);
6059 }
6060 }
6061 }
6062
6063 _sqlUpdate.update(new Object[] { new Long(groupId) });
6064
6065 if ((listeners.length > 0) || (permissionListeners.length > 0)) {
6066 for (com.liferay.portal.model.Permission permission : permissions) {
6067 for (ModelListener<Group> listener : listeners) {
6068 listener.onAfterRemoveAssociation(groupId,
6069 com.liferay.portal.model.Permission.class.getName(),
6070 permission.getPrimaryKey());
6071 }
6072
6073 for (ModelListener<com.liferay.portal.model.Permission> listener : permissionListeners) {
6074 listener.onAfterRemoveAssociation(permission.getPrimaryKey(),
6075 Group.class.getName(), groupId);
6076 }
6077 }
6078 }
6079 }
6080
6081 private SqlUpdate _sqlUpdate;
6082 }
6083
6084 protected class RemovePermission {
6085 protected RemovePermission(GroupPersistenceImpl persistenceImpl) {
6086 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
6087 "DELETE FROM Groups_Permissions WHERE groupId = ? AND permissionId = ?",
6088 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
6089 _persistenceImpl = persistenceImpl;
6090 }
6091
6092 protected void remove(long groupId, long permissionId)
6093 throws SystemException {
6094 if (_persistenceImpl.containsPermission.contains(groupId,
6095 permissionId)) {
6096 ModelListener<com.liferay.portal.model.Permission>[] permissionListeners =
6097 permissionPersistence.getListeners();
6098
6099 for (ModelListener<Group> listener : listeners) {
6100 listener.onBeforeRemoveAssociation(groupId,
6101 com.liferay.portal.model.Permission.class.getName(),
6102 permissionId);
6103 }
6104
6105 for (ModelListener<com.liferay.portal.model.Permission> listener : permissionListeners) {
6106 listener.onBeforeRemoveAssociation(permissionId,
6107 Group.class.getName(), groupId);
6108 }
6109
6110 _sqlUpdate.update(new Object[] {
6111 new Long(groupId), new Long(permissionId)
6112 });
6113
6114 for (ModelListener<Group> listener : listeners) {
6115 listener.onAfterRemoveAssociation(groupId,
6116 com.liferay.portal.model.Permission.class.getName(),
6117 permissionId);
6118 }
6119
6120 for (ModelListener<com.liferay.portal.model.Permission> listener : permissionListeners) {
6121 listener.onAfterRemoveAssociation(permissionId,
6122 Group.class.getName(), groupId);
6123 }
6124 }
6125 }
6126
6127 private SqlUpdate _sqlUpdate;
6128 private GroupPersistenceImpl _persistenceImpl;
6129 }
6130
6131 protected class ContainsRole {
6132 protected ContainsRole(GroupPersistenceImpl persistenceImpl) {
6133 super();
6134
6135 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
6136 _SQL_CONTAINSROLE,
6137 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
6138 RowMapper.COUNT);
6139 }
6140
6141 protected boolean contains(long groupId, long roleId) {
6142 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
6143 new Long(groupId), new Long(roleId)
6144 });
6145
6146 if (results.size() > 0) {
6147 Integer count = results.get(0);
6148
6149 if (count.intValue() > 0) {
6150 return true;
6151 }
6152 }
6153
6154 return false;
6155 }
6156
6157 private MappingSqlQuery<Integer> _mappingSqlQuery;
6158 }
6159
6160 protected class AddRole {
6161 protected AddRole(GroupPersistenceImpl persistenceImpl) {
6162 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
6163 "INSERT INTO Groups_Roles (groupId, roleId) VALUES (?, ?)",
6164 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
6165 _persistenceImpl = persistenceImpl;
6166 }
6167
6168 protected void add(long groupId, long roleId) throws SystemException {
6169 if (!_persistenceImpl.containsRole.contains(groupId, roleId)) {
6170 ModelListener<com.liferay.portal.model.Role>[] roleListeners = rolePersistence.getListeners();
6171
6172 for (ModelListener<Group> listener : listeners) {
6173 listener.onBeforeAddAssociation(groupId,
6174 com.liferay.portal.model.Role.class.getName(), roleId);
6175 }
6176
6177 for (ModelListener<com.liferay.portal.model.Role> listener : roleListeners) {
6178 listener.onBeforeAddAssociation(roleId,
6179 Group.class.getName(), groupId);
6180 }
6181
6182 _sqlUpdate.update(new Object[] {
6183 new Long(groupId), new Long(roleId)
6184 });
6185
6186 for (ModelListener<Group> listener : listeners) {
6187 listener.onAfterAddAssociation(groupId,
6188 com.liferay.portal.model.Role.class.getName(), roleId);
6189 }
6190
6191 for (ModelListener<com.liferay.portal.model.Role> listener : roleListeners) {
6192 listener.onAfterAddAssociation(roleId,
6193 Group.class.getName(), groupId);
6194 }
6195 }
6196 }
6197
6198 private SqlUpdate _sqlUpdate;
6199 private GroupPersistenceImpl _persistenceImpl;
6200 }
6201
6202 protected class ClearRoles {
6203 protected ClearRoles(GroupPersistenceImpl persistenceImpl) {
6204 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
6205 "DELETE FROM Groups_Roles WHERE groupId = ?",
6206 new int[] { java.sql.Types.BIGINT });
6207 }
6208
6209 protected void clear(long groupId) throws SystemException {
6210 ModelListener<com.liferay.portal.model.Role>[] roleListeners = rolePersistence.getListeners();
6211
6212 List<com.liferay.portal.model.Role> roles = null;
6213
6214 if ((listeners.length > 0) || (roleListeners.length > 0)) {
6215 roles = getRoles(groupId);
6216
6217 for (com.liferay.portal.model.Role role : roles) {
6218 for (ModelListener<Group> listener : listeners) {
6219 listener.onBeforeRemoveAssociation(groupId,
6220 com.liferay.portal.model.Role.class.getName(),
6221 role.getPrimaryKey());
6222 }
6223
6224 for (ModelListener<com.liferay.portal.model.Role> listener : roleListeners) {
6225 listener.onBeforeRemoveAssociation(role.getPrimaryKey(),
6226 Group.class.getName(), groupId);
6227 }
6228 }
6229 }
6230
6231 _sqlUpdate.update(new Object[] { new Long(groupId) });
6232
6233 if ((listeners.length > 0) || (roleListeners.length > 0)) {
6234 for (com.liferay.portal.model.Role role : roles) {
6235 for (ModelListener<Group> listener : listeners) {
6236 listener.onAfterRemoveAssociation(groupId,
6237 com.liferay.portal.model.Role.class.getName(),
6238 role.getPrimaryKey());
6239 }
6240
6241 for (ModelListener<com.liferay.portal.model.Role> listener : roleListeners) {
6242 listener.onAfterRemoveAssociation(role.getPrimaryKey(),
6243 Group.class.getName(), groupId);
6244 }
6245 }
6246 }
6247 }
6248
6249 private SqlUpdate _sqlUpdate;
6250 }
6251
6252 protected class RemoveRole {
6253 protected RemoveRole(GroupPersistenceImpl persistenceImpl) {
6254 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
6255 "DELETE FROM Groups_Roles WHERE groupId = ? AND roleId = ?",
6256 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
6257 _persistenceImpl = persistenceImpl;
6258 }
6259
6260 protected void remove(long groupId, long roleId)
6261 throws SystemException {
6262 if (_persistenceImpl.containsRole.contains(groupId, roleId)) {
6263 ModelListener<com.liferay.portal.model.Role>[] roleListeners = rolePersistence.getListeners();
6264
6265 for (ModelListener<Group> listener : listeners) {
6266 listener.onBeforeRemoveAssociation(groupId,
6267 com.liferay.portal.model.Role.class.getName(), roleId);
6268 }
6269
6270 for (ModelListener<com.liferay.portal.model.Role> listener : roleListeners) {
6271 listener.onBeforeRemoveAssociation(roleId,
6272 Group.class.getName(), groupId);
6273 }
6274
6275 _sqlUpdate.update(new Object[] {
6276 new Long(groupId), new Long(roleId)
6277 });
6278
6279 for (ModelListener<Group> listener : listeners) {
6280 listener.onAfterRemoveAssociation(groupId,
6281 com.liferay.portal.model.Role.class.getName(), roleId);
6282 }
6283
6284 for (ModelListener<com.liferay.portal.model.Role> listener : roleListeners) {
6285 listener.onAfterRemoveAssociation(roleId,
6286 Group.class.getName(), groupId);
6287 }
6288 }
6289 }
6290
6291 private SqlUpdate _sqlUpdate;
6292 private GroupPersistenceImpl _persistenceImpl;
6293 }
6294
6295 protected class ContainsUserGroup {
6296 protected ContainsUserGroup(GroupPersistenceImpl persistenceImpl) {
6297 super();
6298
6299 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
6300 _SQL_CONTAINSUSERGROUP,
6301 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
6302 RowMapper.COUNT);
6303 }
6304
6305 protected boolean contains(long groupId, long userGroupId) {
6306 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
6307 new Long(groupId), new Long(userGroupId)
6308 });
6309
6310 if (results.size() > 0) {
6311 Integer count = results.get(0);
6312
6313 if (count.intValue() > 0) {
6314 return true;
6315 }
6316 }
6317
6318 return false;
6319 }
6320
6321 private MappingSqlQuery<Integer> _mappingSqlQuery;
6322 }
6323
6324 protected class AddUserGroup {
6325 protected AddUserGroup(GroupPersistenceImpl persistenceImpl) {
6326 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
6327 "INSERT INTO Groups_UserGroups (groupId, userGroupId) VALUES (?, ?)",
6328 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
6329 _persistenceImpl = persistenceImpl;
6330 }
6331
6332 protected void add(long groupId, long userGroupId)
6333 throws SystemException {
6334 if (!_persistenceImpl.containsUserGroup.contains(groupId,
6335 userGroupId)) {
6336 ModelListener<com.liferay.portal.model.UserGroup>[] userGroupListeners =
6337 userGroupPersistence.getListeners();
6338
6339 for (ModelListener<Group> listener : listeners) {
6340 listener.onBeforeAddAssociation(groupId,
6341 com.liferay.portal.model.UserGroup.class.getName(),
6342 userGroupId);
6343 }
6344
6345 for (ModelListener<com.liferay.portal.model.UserGroup> listener : userGroupListeners) {
6346 listener.onBeforeAddAssociation(userGroupId,
6347 Group.class.getName(), groupId);
6348 }
6349
6350 _sqlUpdate.update(new Object[] {
6351 new Long(groupId), new Long(userGroupId)
6352 });
6353
6354 for (ModelListener<Group> listener : listeners) {
6355 listener.onAfterAddAssociation(groupId,
6356 com.liferay.portal.model.UserGroup.class.getName(),
6357 userGroupId);
6358 }
6359
6360 for (ModelListener<com.liferay.portal.model.UserGroup> listener : userGroupListeners) {
6361 listener.onAfterAddAssociation(userGroupId,
6362 Group.class.getName(), groupId);
6363 }
6364 }
6365 }
6366
6367 private SqlUpdate _sqlUpdate;
6368 private GroupPersistenceImpl _persistenceImpl;
6369 }
6370
6371 protected class ClearUserGroups {
6372 protected ClearUserGroups(GroupPersistenceImpl persistenceImpl) {
6373 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
6374 "DELETE FROM Groups_UserGroups WHERE groupId = ?",
6375 new int[] { java.sql.Types.BIGINT });
6376 }
6377
6378 protected void clear(long groupId) throws SystemException {
6379 ModelListener<com.liferay.portal.model.UserGroup>[] userGroupListeners =
6380 userGroupPersistence.getListeners();
6381
6382 List<com.liferay.portal.model.UserGroup> userGroups = null;
6383
6384 if ((listeners.length > 0) || (userGroupListeners.length > 0)) {
6385 userGroups = getUserGroups(groupId);
6386
6387 for (com.liferay.portal.model.UserGroup userGroup : userGroups) {
6388 for (ModelListener<Group> listener : listeners) {
6389 listener.onBeforeRemoveAssociation(groupId,
6390 com.liferay.portal.model.UserGroup.class.getName(),
6391 userGroup.getPrimaryKey());
6392 }
6393
6394 for (ModelListener<com.liferay.portal.model.UserGroup> listener : userGroupListeners) {
6395 listener.onBeforeRemoveAssociation(userGroup.getPrimaryKey(),
6396 Group.class.getName(), groupId);
6397 }
6398 }
6399 }
6400
6401 _sqlUpdate.update(new Object[] { new Long(groupId) });
6402
6403 if ((listeners.length > 0) || (userGroupListeners.length > 0)) {
6404 for (com.liferay.portal.model.UserGroup userGroup : userGroups) {
6405 for (ModelListener<Group> listener : listeners) {
6406 listener.onAfterRemoveAssociation(groupId,
6407 com.liferay.portal.model.UserGroup.class.getName(),
6408 userGroup.getPrimaryKey());
6409 }
6410
6411 for (ModelListener<com.liferay.portal.model.UserGroup> listener : userGroupListeners) {
6412 listener.onAfterRemoveAssociation(userGroup.getPrimaryKey(),
6413 Group.class.getName(), groupId);
6414 }
6415 }
6416 }
6417 }
6418
6419 private SqlUpdate _sqlUpdate;
6420 }
6421
6422 protected class RemoveUserGroup {
6423 protected RemoveUserGroup(GroupPersistenceImpl persistenceImpl) {
6424 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
6425 "DELETE FROM Groups_UserGroups WHERE groupId = ? AND userGroupId = ?",
6426 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
6427 _persistenceImpl = persistenceImpl;
6428 }
6429
6430 protected void remove(long groupId, long userGroupId)
6431 throws SystemException {
6432 if (_persistenceImpl.containsUserGroup.contains(groupId, userGroupId)) {
6433 ModelListener<com.liferay.portal.model.UserGroup>[] userGroupListeners =
6434 userGroupPersistence.getListeners();
6435
6436 for (ModelListener<Group> listener : listeners) {
6437 listener.onBeforeRemoveAssociation(groupId,
6438 com.liferay.portal.model.UserGroup.class.getName(),
6439 userGroupId);
6440 }
6441
6442 for (ModelListener<com.liferay.portal.model.UserGroup> listener : userGroupListeners) {
6443 listener.onBeforeRemoveAssociation(userGroupId,
6444 Group.class.getName(), groupId);
6445 }
6446
6447 _sqlUpdate.update(new Object[] {
6448 new Long(groupId), new Long(userGroupId)
6449 });
6450
6451 for (ModelListener<Group> listener : listeners) {
6452 listener.onAfterRemoveAssociation(groupId,
6453 com.liferay.portal.model.UserGroup.class.getName(),
6454 userGroupId);
6455 }
6456
6457 for (ModelListener<com.liferay.portal.model.UserGroup> listener : userGroupListeners) {
6458 listener.onAfterRemoveAssociation(userGroupId,
6459 Group.class.getName(), groupId);
6460 }
6461 }
6462 }
6463
6464 private SqlUpdate _sqlUpdate;
6465 private GroupPersistenceImpl _persistenceImpl;
6466 }
6467
6468 protected class ContainsUser {
6469 protected ContainsUser(GroupPersistenceImpl persistenceImpl) {
6470 super();
6471
6472 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
6473 _SQL_CONTAINSUSER,
6474 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
6475 RowMapper.COUNT);
6476 }
6477
6478 protected boolean contains(long groupId, long userId) {
6479 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
6480 new Long(groupId), new Long(userId)
6481 });
6482
6483 if (results.size() > 0) {
6484 Integer count = results.get(0);
6485
6486 if (count.intValue() > 0) {
6487 return true;
6488 }
6489 }
6490
6491 return false;
6492 }
6493
6494 private MappingSqlQuery<Integer> _mappingSqlQuery;
6495 }
6496
6497 protected class AddUser {
6498 protected AddUser(GroupPersistenceImpl persistenceImpl) {
6499 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
6500 "INSERT INTO Users_Groups (groupId, userId) VALUES (?, ?)",
6501 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
6502 _persistenceImpl = persistenceImpl;
6503 }
6504
6505 protected void add(long groupId, long userId) throws SystemException {
6506 if (!_persistenceImpl.containsUser.contains(groupId, userId)) {
6507 ModelListener<com.liferay.portal.model.User>[] userListeners = userPersistence.getListeners();
6508
6509 for (ModelListener<Group> listener : listeners) {
6510 listener.onBeforeAddAssociation(groupId,
6511 com.liferay.portal.model.User.class.getName(), userId);
6512 }
6513
6514 for (ModelListener<com.liferay.portal.model.User> listener : userListeners) {
6515 listener.onBeforeAddAssociation(userId,
6516 Group.class.getName(), groupId);
6517 }
6518
6519 _sqlUpdate.update(new Object[] {
6520 new Long(groupId), new Long(userId)
6521 });
6522
6523 for (ModelListener<Group> listener : listeners) {
6524 listener.onAfterAddAssociation(groupId,
6525 com.liferay.portal.model.User.class.getName(), userId);
6526 }
6527
6528 for (ModelListener<com.liferay.portal.model.User> listener : userListeners) {
6529 listener.onAfterAddAssociation(userId,
6530 Group.class.getName(), groupId);
6531 }
6532 }
6533 }
6534
6535 private SqlUpdate _sqlUpdate;
6536 private GroupPersistenceImpl _persistenceImpl;
6537 }
6538
6539 protected class ClearUsers {
6540 protected ClearUsers(GroupPersistenceImpl persistenceImpl) {
6541 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
6542 "DELETE FROM Users_Groups WHERE groupId = ?",
6543 new int[] { java.sql.Types.BIGINT });
6544 }
6545
6546 protected void clear(long groupId) throws SystemException {
6547 ModelListener<com.liferay.portal.model.User>[] userListeners = userPersistence.getListeners();
6548
6549 List<com.liferay.portal.model.User> users = null;
6550
6551 if ((listeners.length > 0) || (userListeners.length > 0)) {
6552 users = getUsers(groupId);
6553
6554 for (com.liferay.portal.model.User user : users) {
6555 for (ModelListener<Group> listener : listeners) {
6556 listener.onBeforeRemoveAssociation(groupId,
6557 com.liferay.portal.model.User.class.getName(),
6558 user.getPrimaryKey());
6559 }
6560
6561 for (ModelListener<com.liferay.portal.model.User> listener : userListeners) {
6562 listener.onBeforeRemoveAssociation(user.getPrimaryKey(),
6563 Group.class.getName(), groupId);
6564 }
6565 }
6566 }
6567
6568 _sqlUpdate.update(new Object[] { new Long(groupId) });
6569
6570 if ((listeners.length > 0) || (userListeners.length > 0)) {
6571 for (com.liferay.portal.model.User user : users) {
6572 for (ModelListener<Group> listener : listeners) {
6573 listener.onAfterRemoveAssociation(groupId,
6574 com.liferay.portal.model.User.class.getName(),
6575 user.getPrimaryKey());
6576 }
6577
6578 for (ModelListener<com.liferay.portal.model.User> listener : userListeners) {
6579 listener.onAfterRemoveAssociation(user.getPrimaryKey(),
6580 Group.class.getName(), groupId);
6581 }
6582 }
6583 }
6584 }
6585
6586 private SqlUpdate _sqlUpdate;
6587 }
6588
6589 protected class RemoveUser {
6590 protected RemoveUser(GroupPersistenceImpl persistenceImpl) {
6591 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
6592 "DELETE FROM Users_Groups WHERE groupId = ? AND userId = ?",
6593 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
6594 _persistenceImpl = persistenceImpl;
6595 }
6596
6597 protected void remove(long groupId, long userId)
6598 throws SystemException {
6599 if (_persistenceImpl.containsUser.contains(groupId, userId)) {
6600 ModelListener<com.liferay.portal.model.User>[] userListeners = userPersistence.getListeners();
6601
6602 for (ModelListener<Group> listener : listeners) {
6603 listener.onBeforeRemoveAssociation(groupId,
6604 com.liferay.portal.model.User.class.getName(), userId);
6605 }
6606
6607 for (ModelListener<com.liferay.portal.model.User> listener : userListeners) {
6608 listener.onBeforeRemoveAssociation(userId,
6609 Group.class.getName(), groupId);
6610 }
6611
6612 _sqlUpdate.update(new Object[] {
6613 new Long(groupId), new Long(userId)
6614 });
6615
6616 for (ModelListener<Group> listener : listeners) {
6617 listener.onAfterRemoveAssociation(groupId,
6618 com.liferay.portal.model.User.class.getName(), userId);
6619 }
6620
6621 for (ModelListener<com.liferay.portal.model.User> listener : userListeners) {
6622 listener.onAfterRemoveAssociation(userId,
6623 Group.class.getName(), groupId);
6624 }
6625 }
6626 }
6627
6628 private SqlUpdate _sqlUpdate;
6629 private GroupPersistenceImpl _persistenceImpl;
6630 }
6631
6632 private static final String _SQL_SELECT_GROUP_ = "SELECT group_ FROM Group group_";
6633 private static final String _SQL_SELECT_GROUP__WHERE = "SELECT group_ FROM Group group_ WHERE ";
6634 private static final String _SQL_COUNT_GROUP_ = "SELECT COUNT(group_) FROM Group group_";
6635 private static final String _SQL_COUNT_GROUP__WHERE = "SELECT COUNT(group_) FROM Group group_ WHERE ";
6636 private static final String _SQL_GETORGANIZATIONS = "SELECT {Organization_.*} FROM Organization_ INNER JOIN Groups_Orgs ON (Groups_Orgs.organizationId = Organization_.organizationId) WHERE (Groups_Orgs.groupId = ?)";
6637 private static final String _SQL_GETORGANIZATIONSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM Groups_Orgs WHERE groupId = ?";
6638 private static final String _SQL_CONTAINSORGANIZATION = "SELECT COUNT(*) AS COUNT_VALUE FROM Groups_Orgs WHERE groupId = ? AND organizationId = ?";
6639 private static final String _SQL_GETPERMISSIONS = "SELECT {Permission_.*} FROM Permission_ INNER JOIN Groups_Permissions ON (Groups_Permissions.permissionId = Permission_.permissionId) WHERE (Groups_Permissions.groupId = ?)";
6640 private static final String _SQL_GETPERMISSIONSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM Groups_Permissions WHERE groupId = ?";
6641 private static final String _SQL_CONTAINSPERMISSION = "SELECT COUNT(*) AS COUNT_VALUE FROM Groups_Permissions WHERE groupId = ? AND permissionId = ?";
6642 private static final String _SQL_GETROLES = "SELECT {Role_.*} FROM Role_ INNER JOIN Groups_Roles ON (Groups_Roles.roleId = Role_.roleId) WHERE (Groups_Roles.groupId = ?)";
6643 private static final String _SQL_GETROLESSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM Groups_Roles WHERE groupId = ?";
6644 private static final String _SQL_CONTAINSROLE = "SELECT COUNT(*) AS COUNT_VALUE FROM Groups_Roles WHERE groupId = ? AND roleId = ?";
6645 private static final String _SQL_GETUSERGROUPS = "SELECT {UserGroup.*} FROM UserGroup INNER JOIN Groups_UserGroups ON (Groups_UserGroups.userGroupId = UserGroup.userGroupId) WHERE (Groups_UserGroups.groupId = ?)";
6646 private static final String _SQL_GETUSERGROUPSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM Groups_UserGroups WHERE groupId = ?";
6647 private static final String _SQL_CONTAINSUSERGROUP = "SELECT COUNT(*) AS COUNT_VALUE FROM Groups_UserGroups WHERE groupId = ? AND userGroupId = ?";
6648 private static final String _SQL_GETUSERS = "SELECT {User_.*} FROM User_ INNER JOIN Users_Groups ON (Users_Groups.userId = User_.userId) WHERE (Users_Groups.groupId = ?)";
6649 private static final String _SQL_GETUSERSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM Users_Groups WHERE groupId = ?";
6650 private static final String _SQL_CONTAINSUSER = "SELECT COUNT(*) AS COUNT_VALUE FROM Users_Groups WHERE groupId = ? AND userId = ?";
6651 private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "group_.companyId = ?";
6652 private static final String _FINDER_COLUMN_LIVEGROUPID_LIVEGROUPID_2 = "group_.liveGroupId = ?";
6653 private static final String _FINDER_COLUMN_C_N_COMPANYID_2 = "group_.companyId = ? AND ";
6654 private static final String _FINDER_COLUMN_C_N_NAME_1 = "group_.name IS NULL";
6655 private static final String _FINDER_COLUMN_C_N_NAME_2 = "group_.name = ?";
6656 private static final String _FINDER_COLUMN_C_N_NAME_3 = "(group_.name IS NULL OR group_.name = ?)";
6657 private static final String _FINDER_COLUMN_C_F_COMPANYID_2 = "group_.companyId = ? AND ";
6658 private static final String _FINDER_COLUMN_C_F_FRIENDLYURL_1 = "group_.friendlyURL IS NULL";
6659 private static final String _FINDER_COLUMN_C_F_FRIENDLYURL_2 = "group_.friendlyURL = ?";
6660 private static final String _FINDER_COLUMN_C_F_FRIENDLYURL_3 = "(group_.friendlyURL IS NULL OR group_.friendlyURL = ?)";
6661 private static final String _FINDER_COLUMN_T_A_TYPE_2 = "group_.type = ? AND ";
6662 private static final String _FINDER_COLUMN_T_A_ACTIVE_2 = "group_.active = ?";
6663 private static final String _FINDER_COLUMN_C_C_C_COMPANYID_2 = "group_.companyId = ? AND ";
6664 private static final String _FINDER_COLUMN_C_C_C_CLASSNAMEID_2 = "group_.classNameId = ? AND ";
6665 private static final String _FINDER_COLUMN_C_C_C_CLASSPK_2 = "group_.classPK = ?";
6666 private static final String _FINDER_COLUMN_C_L_N_COMPANYID_2 = "group_.companyId = ? AND ";
6667 private static final String _FINDER_COLUMN_C_L_N_LIVEGROUPID_2 = "group_.liveGroupId = ? AND ";
6668 private static final String _FINDER_COLUMN_C_L_N_NAME_1 = "group_.name IS NULL";
6669 private static final String _FINDER_COLUMN_C_L_N_NAME_2 = "group_.name = ?";
6670 private static final String _FINDER_COLUMN_C_L_N_NAME_3 = "(group_.name IS NULL OR group_.name = ?)";
6671 private static final String _FINDER_COLUMN_C_C_L_N_COMPANYID_2 = "group_.companyId = ? AND ";
6672 private static final String _FINDER_COLUMN_C_C_L_N_CLASSNAMEID_2 = "group_.classNameId = ? AND ";
6673 private static final String _FINDER_COLUMN_C_C_L_N_LIVEGROUPID_2 = "group_.liveGroupId = ? AND ";
6674 private static final String _FINDER_COLUMN_C_C_L_N_NAME_1 = "group_.name IS NULL";
6675 private static final String _FINDER_COLUMN_C_C_L_N_NAME_2 = "group_.name = ?";
6676 private static final String _FINDER_COLUMN_C_C_L_N_NAME_3 = "(group_.name IS NULL OR group_.name = ?)";
6677 private static final String _ORDER_BY_ENTITY_ALIAS = "group_.";
6678 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Group exists with the primary key ";
6679 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No Group exists with the key {";
6680 private static Log _log = LogFactoryUtil.getLog(GroupPersistenceImpl.class);
6681 }