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 if (group.isCachedModel() || BatchSessionUtil.isEnabled()) {
434 Object staleObject = session.get(GroupImpl.class,
435 group.getPrimaryKeyObj());
436
437 if (staleObject != null) {
438 session.evict(staleObject);
439 }
440 }
441
442 session.delete(group);
443
444 session.flush();
445 }
446 catch (Exception e) {
447 throw processException(e);
448 }
449 finally {
450 closeSession(session);
451 }
452
453 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
454
455 GroupModelImpl groupModelImpl = (GroupModelImpl)group;
456
457 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_LIVEGROUPID,
458 new Object[] { new Long(groupModelImpl.getOriginalLiveGroupId()) });
459
460 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_N,
461 new Object[] {
462 new Long(groupModelImpl.getOriginalCompanyId()),
463
464 groupModelImpl.getOriginalName()
465 });
466
467 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_F,
468 new Object[] {
469 new Long(groupModelImpl.getOriginalCompanyId()),
470
471 groupModelImpl.getOriginalFriendlyURL()
472 });
473
474 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C_C,
475 new Object[] {
476 new Long(groupModelImpl.getOriginalCompanyId()),
477 new Long(groupModelImpl.getOriginalClassNameId()),
478 new Long(groupModelImpl.getOriginalClassPK())
479 });
480
481 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_L_N,
482 new Object[] {
483 new Long(groupModelImpl.getOriginalCompanyId()),
484 new Long(groupModelImpl.getOriginalLiveGroupId()),
485
486 groupModelImpl.getOriginalName()
487 });
488
489 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C_L_N,
490 new Object[] {
491 new Long(groupModelImpl.getOriginalCompanyId()),
492 new Long(groupModelImpl.getOriginalClassNameId()),
493 new Long(groupModelImpl.getOriginalLiveGroupId()),
494
495 groupModelImpl.getOriginalName()
496 });
497
498 EntityCacheUtil.removeResult(GroupModelImpl.ENTITY_CACHE_ENABLED,
499 GroupImpl.class, group.getPrimaryKey());
500
501 return group;
502 }
503
504 public Group updateImpl(com.liferay.portal.model.Group group, boolean merge)
505 throws SystemException {
506 group = toUnwrappedModel(group);
507
508 boolean isNew = group.isNew();
509
510 GroupModelImpl groupModelImpl = (GroupModelImpl)group;
511
512 Session session = null;
513
514 try {
515 session = openSession();
516
517 BatchSessionUtil.update(session, group, merge);
518
519 group.setNew(false);
520 }
521 catch (Exception e) {
522 throw processException(e);
523 }
524 finally {
525 closeSession(session);
526 }
527
528 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
529
530 EntityCacheUtil.putResult(GroupModelImpl.ENTITY_CACHE_ENABLED,
531 GroupImpl.class, group.getPrimaryKey(), group);
532
533 if (!isNew &&
534 (group.getLiveGroupId() != groupModelImpl.getOriginalLiveGroupId())) {
535 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_LIVEGROUPID,
536 new Object[] { new Long(groupModelImpl.getOriginalLiveGroupId()) });
537 }
538
539 if (isNew ||
540 (group.getLiveGroupId() != groupModelImpl.getOriginalLiveGroupId())) {
541 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LIVEGROUPID,
542 new Object[] { new Long(group.getLiveGroupId()) }, group);
543 }
544
545 if (!isNew &&
546 ((group.getCompanyId() != groupModelImpl.getOriginalCompanyId()) ||
547 !Validator.equals(group.getName(),
548 groupModelImpl.getOriginalName()))) {
549 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_N,
550 new Object[] {
551 new Long(groupModelImpl.getOriginalCompanyId()),
552
553 groupModelImpl.getOriginalName()
554 });
555 }
556
557 if (isNew ||
558 ((group.getCompanyId() != groupModelImpl.getOriginalCompanyId()) ||
559 !Validator.equals(group.getName(),
560 groupModelImpl.getOriginalName()))) {
561 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_N,
562 new Object[] { new Long(group.getCompanyId()), group.getName() },
563 group);
564 }
565
566 if (!isNew &&
567 ((group.getCompanyId() != groupModelImpl.getOriginalCompanyId()) ||
568 !Validator.equals(group.getFriendlyURL(),
569 groupModelImpl.getOriginalFriendlyURL()))) {
570 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_F,
571 new Object[] {
572 new Long(groupModelImpl.getOriginalCompanyId()),
573
574 groupModelImpl.getOriginalFriendlyURL()
575 });
576 }
577
578 if (isNew ||
579 ((group.getCompanyId() != groupModelImpl.getOriginalCompanyId()) ||
580 !Validator.equals(group.getFriendlyURL(),
581 groupModelImpl.getOriginalFriendlyURL()))) {
582 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_F,
583 new Object[] {
584 new Long(group.getCompanyId()),
585
586 group.getFriendlyURL()
587 }, group);
588 }
589
590 if (!isNew &&
591 ((group.getCompanyId() != groupModelImpl.getOriginalCompanyId()) ||
592 (group.getClassNameId() != groupModelImpl.getOriginalClassNameId()) ||
593 (group.getClassPK() != groupModelImpl.getOriginalClassPK()))) {
594 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C_C,
595 new Object[] {
596 new Long(groupModelImpl.getOriginalCompanyId()),
597 new Long(groupModelImpl.getOriginalClassNameId()),
598 new Long(groupModelImpl.getOriginalClassPK())
599 });
600 }
601
602 if (isNew ||
603 ((group.getCompanyId() != groupModelImpl.getOriginalCompanyId()) ||
604 (group.getClassNameId() != groupModelImpl.getOriginalClassNameId()) ||
605 (group.getClassPK() != groupModelImpl.getOriginalClassPK()))) {
606 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C_C,
607 new Object[] {
608 new Long(group.getCompanyId()),
609 new Long(group.getClassNameId()),
610 new Long(group.getClassPK())
611 }, group);
612 }
613
614 if (!isNew &&
615 ((group.getCompanyId() != groupModelImpl.getOriginalCompanyId()) ||
616 (group.getLiveGroupId() != groupModelImpl.getOriginalLiveGroupId()) ||
617 !Validator.equals(group.getName(),
618 groupModelImpl.getOriginalName()))) {
619 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_L_N,
620 new Object[] {
621 new Long(groupModelImpl.getOriginalCompanyId()),
622 new Long(groupModelImpl.getOriginalLiveGroupId()),
623
624 groupModelImpl.getOriginalName()
625 });
626 }
627
628 if (isNew ||
629 ((group.getCompanyId() != groupModelImpl.getOriginalCompanyId()) ||
630 (group.getLiveGroupId() != groupModelImpl.getOriginalLiveGroupId()) ||
631 !Validator.equals(group.getName(),
632 groupModelImpl.getOriginalName()))) {
633 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_L_N,
634 new Object[] {
635 new Long(group.getCompanyId()),
636 new Long(group.getLiveGroupId()),
637
638 group.getName()
639 }, group);
640 }
641
642 if (!isNew &&
643 ((group.getCompanyId() != groupModelImpl.getOriginalCompanyId()) ||
644 (group.getClassNameId() != groupModelImpl.getOriginalClassNameId()) ||
645 (group.getLiveGroupId() != groupModelImpl.getOriginalLiveGroupId()) ||
646 !Validator.equals(group.getName(),
647 groupModelImpl.getOriginalName()))) {
648 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C_L_N,
649 new Object[] {
650 new Long(groupModelImpl.getOriginalCompanyId()),
651 new Long(groupModelImpl.getOriginalClassNameId()),
652 new Long(groupModelImpl.getOriginalLiveGroupId()),
653
654 groupModelImpl.getOriginalName()
655 });
656 }
657
658 if (isNew ||
659 ((group.getCompanyId() != groupModelImpl.getOriginalCompanyId()) ||
660 (group.getClassNameId() != groupModelImpl.getOriginalClassNameId()) ||
661 (group.getLiveGroupId() != groupModelImpl.getOriginalLiveGroupId()) ||
662 !Validator.equals(group.getName(),
663 groupModelImpl.getOriginalName()))) {
664 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C_L_N,
665 new Object[] {
666 new Long(group.getCompanyId()),
667 new Long(group.getClassNameId()),
668 new Long(group.getLiveGroupId()),
669
670 group.getName()
671 }, group);
672 }
673
674 return group;
675 }
676
677 protected Group toUnwrappedModel(Group group) {
678 if (group instanceof GroupImpl) {
679 return group;
680 }
681
682 GroupImpl groupImpl = new GroupImpl();
683
684 groupImpl.setNew(group.isNew());
685 groupImpl.setPrimaryKey(group.getPrimaryKey());
686
687 groupImpl.setGroupId(group.getGroupId());
688 groupImpl.setCompanyId(group.getCompanyId());
689 groupImpl.setCreatorUserId(group.getCreatorUserId());
690 groupImpl.setClassNameId(group.getClassNameId());
691 groupImpl.setClassPK(group.getClassPK());
692 groupImpl.setParentGroupId(group.getParentGroupId());
693 groupImpl.setLiveGroupId(group.getLiveGroupId());
694 groupImpl.setName(group.getName());
695 groupImpl.setDescription(group.getDescription());
696 groupImpl.setType(group.getType());
697 groupImpl.setTypeSettings(group.getTypeSettings());
698 groupImpl.setFriendlyURL(group.getFriendlyURL());
699 groupImpl.setActive(group.isActive());
700
701 return groupImpl;
702 }
703
704
712 public Group findByPrimaryKey(Serializable primaryKey)
713 throws NoSuchModelException, SystemException {
714 return findByPrimaryKey(((Long)primaryKey).longValue());
715 }
716
717
725 public Group findByPrimaryKey(long groupId)
726 throws NoSuchGroupException, SystemException {
727 Group group = fetchByPrimaryKey(groupId);
728
729 if (group == null) {
730 if (_log.isWarnEnabled()) {
731 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + groupId);
732 }
733
734 throw new NoSuchGroupException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
735 groupId);
736 }
737
738 return group;
739 }
740
741
748 public Group fetchByPrimaryKey(Serializable primaryKey)
749 throws SystemException {
750 return fetchByPrimaryKey(((Long)primaryKey).longValue());
751 }
752
753
760 public Group fetchByPrimaryKey(long groupId) throws SystemException {
761 Group group = (Group)EntityCacheUtil.getResult(GroupModelImpl.ENTITY_CACHE_ENABLED,
762 GroupImpl.class, groupId, this);
763
764 if (group == null) {
765 Session session = null;
766
767 try {
768 session = openSession();
769
770 group = (Group)session.get(GroupImpl.class, new Long(groupId));
771 }
772 catch (Exception e) {
773 throw processException(e);
774 }
775 finally {
776 if (group != null) {
777 cacheResult(group);
778 }
779
780 closeSession(session);
781 }
782 }
783
784 return group;
785 }
786
787
794 public List<Group> findByCompanyId(long companyId)
795 throws SystemException {
796 return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
797 null);
798 }
799
800
813 public List<Group> findByCompanyId(long companyId, int start, int end)
814 throws SystemException {
815 return findByCompanyId(companyId, start, end, null);
816 }
817
818
832 public List<Group> findByCompanyId(long companyId, int start, int end,
833 OrderByComparator orderByComparator) throws SystemException {
834 Object[] finderArgs = new Object[] {
835 companyId,
836
837 String.valueOf(start), String.valueOf(end),
838 String.valueOf(orderByComparator)
839 };
840
841 List<Group> list = (List<Group>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_COMPANYID,
842 finderArgs, this);
843
844 if (list == null) {
845 Session session = null;
846
847 try {
848 session = openSession();
849
850 StringBundler query = null;
851
852 if (orderByComparator != null) {
853 query = new StringBundler(3 +
854 (orderByComparator.getOrderByFields().length * 3));
855 }
856 else {
857 query = new StringBundler(3);
858 }
859
860 query.append(_SQL_SELECT_GROUP__WHERE);
861
862 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
863
864 if (orderByComparator != null) {
865 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
866 orderByComparator);
867 }
868
869 else {
870 query.append(GroupModelImpl.ORDER_BY_JPQL);
871 }
872
873 String sql = query.toString();
874
875 Query q = session.createQuery(sql);
876
877 QueryPos qPos = QueryPos.getInstance(q);
878
879 qPos.add(companyId);
880
881 list = (List<Group>)QueryUtil.list(q, getDialect(), start, end);
882 }
883 catch (Exception e) {
884 throw processException(e);
885 }
886 finally {
887 if (list == null) {
888 list = new ArrayList<Group>();
889 }
890
891 cacheResult(list);
892
893 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_COMPANYID,
894 finderArgs, list);
895
896 closeSession(session);
897 }
898 }
899
900 return list;
901 }
902
903
916 public Group findByCompanyId_First(long companyId,
917 OrderByComparator orderByComparator)
918 throws NoSuchGroupException, SystemException {
919 List<Group> list = findByCompanyId(companyId, 0, 1, orderByComparator);
920
921 if (list.isEmpty()) {
922 StringBundler msg = new StringBundler(4);
923
924 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
925
926 msg.append("companyId=");
927 msg.append(companyId);
928
929 msg.append(StringPool.CLOSE_CURLY_BRACE);
930
931 throw new NoSuchGroupException(msg.toString());
932 }
933 else {
934 return list.get(0);
935 }
936 }
937
938
951 public Group findByCompanyId_Last(long companyId,
952 OrderByComparator orderByComparator)
953 throws NoSuchGroupException, SystemException {
954 int count = countByCompanyId(companyId);
955
956 List<Group> list = findByCompanyId(companyId, count - 1, count,
957 orderByComparator);
958
959 if (list.isEmpty()) {
960 StringBundler msg = new StringBundler(4);
961
962 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
963
964 msg.append("companyId=");
965 msg.append(companyId);
966
967 msg.append(StringPool.CLOSE_CURLY_BRACE);
968
969 throw new NoSuchGroupException(msg.toString());
970 }
971 else {
972 return list.get(0);
973 }
974 }
975
976
990 public Group[] findByCompanyId_PrevAndNext(long groupId, long companyId,
991 OrderByComparator orderByComparator)
992 throws NoSuchGroupException, SystemException {
993 Group group = findByPrimaryKey(groupId);
994
995 Session session = null;
996
997 try {
998 session = openSession();
999
1000 Group[] array = new GroupImpl[3];
1001
1002 array[0] = getByCompanyId_PrevAndNext(session, group, companyId,
1003 orderByComparator, true);
1004
1005 array[1] = group;
1006
1007 array[2] = getByCompanyId_PrevAndNext(session, group, companyId,
1008 orderByComparator, false);
1009
1010 return array;
1011 }
1012 catch (Exception e) {
1013 throw processException(e);
1014 }
1015 finally {
1016 closeSession(session);
1017 }
1018 }
1019
1020 protected Group getByCompanyId_PrevAndNext(Session session, Group group,
1021 long companyId, OrderByComparator orderByComparator, boolean previous) {
1022 StringBundler query = null;
1023
1024 if (orderByComparator != null) {
1025 query = new StringBundler(6 +
1026 (orderByComparator.getOrderByFields().length * 6));
1027 }
1028 else {
1029 query = new StringBundler(3);
1030 }
1031
1032 query.append(_SQL_SELECT_GROUP__WHERE);
1033
1034 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1035
1036 if (orderByComparator != null) {
1037 String[] orderByFields = orderByComparator.getOrderByFields();
1038
1039 if (orderByFields.length > 0) {
1040 query.append(WHERE_AND);
1041 }
1042
1043 for (int i = 0; i < orderByFields.length; i++) {
1044 query.append(_ORDER_BY_ENTITY_ALIAS);
1045 query.append(orderByFields[i]);
1046
1047 if ((i + 1) < orderByFields.length) {
1048 if (orderByComparator.isAscending() ^ previous) {
1049 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1050 }
1051 else {
1052 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1053 }
1054 }
1055 else {
1056 if (orderByComparator.isAscending() ^ previous) {
1057 query.append(WHERE_GREATER_THAN);
1058 }
1059 else {
1060 query.append(WHERE_LESSER_THAN);
1061 }
1062 }
1063 }
1064
1065 query.append(ORDER_BY_CLAUSE);
1066
1067 for (int i = 0; i < orderByFields.length; i++) {
1068 query.append(_ORDER_BY_ENTITY_ALIAS);
1069 query.append(orderByFields[i]);
1070
1071 if ((i + 1) < orderByFields.length) {
1072 if (orderByComparator.isAscending() ^ previous) {
1073 query.append(ORDER_BY_ASC_HAS_NEXT);
1074 }
1075 else {
1076 query.append(ORDER_BY_DESC_HAS_NEXT);
1077 }
1078 }
1079 else {
1080 if (orderByComparator.isAscending() ^ previous) {
1081 query.append(ORDER_BY_ASC);
1082 }
1083 else {
1084 query.append(ORDER_BY_DESC);
1085 }
1086 }
1087 }
1088 }
1089
1090 else {
1091 query.append(GroupModelImpl.ORDER_BY_JPQL);
1092 }
1093
1094 String sql = query.toString();
1095
1096 Query q = session.createQuery(sql);
1097
1098 q.setFirstResult(0);
1099 q.setMaxResults(2);
1100
1101 QueryPos qPos = QueryPos.getInstance(q);
1102
1103 qPos.add(companyId);
1104
1105 if (orderByComparator != null) {
1106 Object[] values = orderByComparator.getOrderByValues(group);
1107
1108 for (Object value : values) {
1109 qPos.add(value);
1110 }
1111 }
1112
1113 List<Group> list = q.list();
1114
1115 if (list.size() == 2) {
1116 return list.get(1);
1117 }
1118 else {
1119 return null;
1120 }
1121 }
1122
1123
1131 public Group findByLiveGroupId(long liveGroupId)
1132 throws NoSuchGroupException, SystemException {
1133 Group group = fetchByLiveGroupId(liveGroupId);
1134
1135 if (group == null) {
1136 StringBundler msg = new StringBundler(4);
1137
1138 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1139
1140 msg.append("liveGroupId=");
1141 msg.append(liveGroupId);
1142
1143 msg.append(StringPool.CLOSE_CURLY_BRACE);
1144
1145 if (_log.isWarnEnabled()) {
1146 _log.warn(msg.toString());
1147 }
1148
1149 throw new NoSuchGroupException(msg.toString());
1150 }
1151
1152 return group;
1153 }
1154
1155
1162 public Group fetchByLiveGroupId(long liveGroupId) throws SystemException {
1163 return fetchByLiveGroupId(liveGroupId, true);
1164 }
1165
1166
1173 public Group fetchByLiveGroupId(long liveGroupId, boolean retrieveFromCache)
1174 throws SystemException {
1175 Object[] finderArgs = new Object[] { liveGroupId };
1176
1177 Object result = null;
1178
1179 if (retrieveFromCache) {
1180 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_LIVEGROUPID,
1181 finderArgs, this);
1182 }
1183
1184 if (result == null) {
1185 Session session = null;
1186
1187 try {
1188 session = openSession();
1189
1190 StringBundler query = new StringBundler(3);
1191
1192 query.append(_SQL_SELECT_GROUP__WHERE);
1193
1194 query.append(_FINDER_COLUMN_LIVEGROUPID_LIVEGROUPID_2);
1195
1196 query.append(GroupModelImpl.ORDER_BY_JPQL);
1197
1198 String sql = query.toString();
1199
1200 Query q = session.createQuery(sql);
1201
1202 QueryPos qPos = QueryPos.getInstance(q);
1203
1204 qPos.add(liveGroupId);
1205
1206 List<Group> list = q.list();
1207
1208 result = list;
1209
1210 Group group = null;
1211
1212 if (list.isEmpty()) {
1213 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LIVEGROUPID,
1214 finderArgs, list);
1215 }
1216 else {
1217 group = list.get(0);
1218
1219 cacheResult(group);
1220
1221 if ((group.getLiveGroupId() != liveGroupId)) {
1222 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LIVEGROUPID,
1223 finderArgs, group);
1224 }
1225 }
1226
1227 return group;
1228 }
1229 catch (Exception e) {
1230 throw processException(e);
1231 }
1232 finally {
1233 if (result == null) {
1234 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LIVEGROUPID,
1235 finderArgs, new ArrayList<Group>());
1236 }
1237
1238 closeSession(session);
1239 }
1240 }
1241 else {
1242 if (result instanceof List<?>) {
1243 return null;
1244 }
1245 else {
1246 return (Group)result;
1247 }
1248 }
1249 }
1250
1251
1260 public Group findByC_N(long companyId, String name)
1261 throws NoSuchGroupException, SystemException {
1262 Group group = fetchByC_N(companyId, name);
1263
1264 if (group == null) {
1265 StringBundler msg = new StringBundler(6);
1266
1267 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1268
1269 msg.append("companyId=");
1270 msg.append(companyId);
1271
1272 msg.append(", name=");
1273 msg.append(name);
1274
1275 msg.append(StringPool.CLOSE_CURLY_BRACE);
1276
1277 if (_log.isWarnEnabled()) {
1278 _log.warn(msg.toString());
1279 }
1280
1281 throw new NoSuchGroupException(msg.toString());
1282 }
1283
1284 return group;
1285 }
1286
1287
1295 public Group fetchByC_N(long companyId, String name)
1296 throws SystemException {
1297 return fetchByC_N(companyId, name, true);
1298 }
1299
1300
1308 public Group fetchByC_N(long companyId, String name,
1309 boolean retrieveFromCache) throws SystemException {
1310 Object[] finderArgs = new Object[] { companyId, name };
1311
1312 Object result = null;
1313
1314 if (retrieveFromCache) {
1315 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_N,
1316 finderArgs, this);
1317 }
1318
1319 if (result == null) {
1320 Session session = null;
1321
1322 try {
1323 session = openSession();
1324
1325 StringBundler query = new StringBundler(4);
1326
1327 query.append(_SQL_SELECT_GROUP__WHERE);
1328
1329 query.append(_FINDER_COLUMN_C_N_COMPANYID_2);
1330
1331 if (name == null) {
1332 query.append(_FINDER_COLUMN_C_N_NAME_1);
1333 }
1334 else {
1335 if (name.equals(StringPool.BLANK)) {
1336 query.append(_FINDER_COLUMN_C_N_NAME_3);
1337 }
1338 else {
1339 query.append(_FINDER_COLUMN_C_N_NAME_2);
1340 }
1341 }
1342
1343 query.append(GroupModelImpl.ORDER_BY_JPQL);
1344
1345 String sql = query.toString();
1346
1347 Query q = session.createQuery(sql);
1348
1349 QueryPos qPos = QueryPos.getInstance(q);
1350
1351 qPos.add(companyId);
1352
1353 if (name != null) {
1354 qPos.add(name);
1355 }
1356
1357 List<Group> list = q.list();
1358
1359 result = list;
1360
1361 Group group = null;
1362
1363 if (list.isEmpty()) {
1364 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_N,
1365 finderArgs, list);
1366 }
1367 else {
1368 group = list.get(0);
1369
1370 cacheResult(group);
1371
1372 if ((group.getCompanyId() != companyId) ||
1373 (group.getName() == null) ||
1374 !group.getName().equals(name)) {
1375 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_N,
1376 finderArgs, group);
1377 }
1378 }
1379
1380 return group;
1381 }
1382 catch (Exception e) {
1383 throw processException(e);
1384 }
1385 finally {
1386 if (result == null) {
1387 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_N,
1388 finderArgs, new ArrayList<Group>());
1389 }
1390
1391 closeSession(session);
1392 }
1393 }
1394 else {
1395 if (result instanceof List<?>) {
1396 return null;
1397 }
1398 else {
1399 return (Group)result;
1400 }
1401 }
1402 }
1403
1404
1413 public Group findByC_F(long companyId, String friendlyURL)
1414 throws NoSuchGroupException, SystemException {
1415 Group group = fetchByC_F(companyId, friendlyURL);
1416
1417 if (group == null) {
1418 StringBundler msg = new StringBundler(6);
1419
1420 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1421
1422 msg.append("companyId=");
1423 msg.append(companyId);
1424
1425 msg.append(", friendlyURL=");
1426 msg.append(friendlyURL);
1427
1428 msg.append(StringPool.CLOSE_CURLY_BRACE);
1429
1430 if (_log.isWarnEnabled()) {
1431 _log.warn(msg.toString());
1432 }
1433
1434 throw new NoSuchGroupException(msg.toString());
1435 }
1436
1437 return group;
1438 }
1439
1440
1448 public Group fetchByC_F(long companyId, String friendlyURL)
1449 throws SystemException {
1450 return fetchByC_F(companyId, friendlyURL, true);
1451 }
1452
1453
1461 public Group fetchByC_F(long companyId, String friendlyURL,
1462 boolean retrieveFromCache) throws SystemException {
1463 Object[] finderArgs = new Object[] { companyId, friendlyURL };
1464
1465 Object result = null;
1466
1467 if (retrieveFromCache) {
1468 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_F,
1469 finderArgs, this);
1470 }
1471
1472 if (result == null) {
1473 Session session = null;
1474
1475 try {
1476 session = openSession();
1477
1478 StringBundler query = new StringBundler(4);
1479
1480 query.append(_SQL_SELECT_GROUP__WHERE);
1481
1482 query.append(_FINDER_COLUMN_C_F_COMPANYID_2);
1483
1484 if (friendlyURL == null) {
1485 query.append(_FINDER_COLUMN_C_F_FRIENDLYURL_1);
1486 }
1487 else {
1488 if (friendlyURL.equals(StringPool.BLANK)) {
1489 query.append(_FINDER_COLUMN_C_F_FRIENDLYURL_3);
1490 }
1491 else {
1492 query.append(_FINDER_COLUMN_C_F_FRIENDLYURL_2);
1493 }
1494 }
1495
1496 query.append(GroupModelImpl.ORDER_BY_JPQL);
1497
1498 String sql = query.toString();
1499
1500 Query q = session.createQuery(sql);
1501
1502 QueryPos qPos = QueryPos.getInstance(q);
1503
1504 qPos.add(companyId);
1505
1506 if (friendlyURL != null) {
1507 qPos.add(friendlyURL);
1508 }
1509
1510 List<Group> list = q.list();
1511
1512 result = list;
1513
1514 Group group = null;
1515
1516 if (list.isEmpty()) {
1517 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_F,
1518 finderArgs, list);
1519 }
1520 else {
1521 group = list.get(0);
1522
1523 cacheResult(group);
1524
1525 if ((group.getCompanyId() != companyId) ||
1526 (group.getFriendlyURL() == null) ||
1527 !group.getFriendlyURL().equals(friendlyURL)) {
1528 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_F,
1529 finderArgs, group);
1530 }
1531 }
1532
1533 return group;
1534 }
1535 catch (Exception e) {
1536 throw processException(e);
1537 }
1538 finally {
1539 if (result == null) {
1540 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_F,
1541 finderArgs, new ArrayList<Group>());
1542 }
1543
1544 closeSession(session);
1545 }
1546 }
1547 else {
1548 if (result instanceof List<?>) {
1549 return null;
1550 }
1551 else {
1552 return (Group)result;
1553 }
1554 }
1555 }
1556
1557
1565 public List<Group> findByT_A(int type, boolean active)
1566 throws SystemException {
1567 return findByT_A(type, active, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1568 null);
1569 }
1570
1571
1585 public List<Group> findByT_A(int type, boolean active, int start, int end)
1586 throws SystemException {
1587 return findByT_A(type, active, start, end, null);
1588 }
1589
1590
1605 public List<Group> findByT_A(int type, boolean active, int start, int end,
1606 OrderByComparator orderByComparator) throws SystemException {
1607 Object[] finderArgs = new Object[] {
1608 type, active,
1609
1610 String.valueOf(start), String.valueOf(end),
1611 String.valueOf(orderByComparator)
1612 };
1613
1614 List<Group> list = (List<Group>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_T_A,
1615 finderArgs, this);
1616
1617 if (list == null) {
1618 Session session = null;
1619
1620 try {
1621 session = openSession();
1622
1623 StringBundler query = null;
1624
1625 if (orderByComparator != null) {
1626 query = new StringBundler(4 +
1627 (orderByComparator.getOrderByFields().length * 3));
1628 }
1629 else {
1630 query = new StringBundler(4);
1631 }
1632
1633 query.append(_SQL_SELECT_GROUP__WHERE);
1634
1635 query.append(_FINDER_COLUMN_T_A_TYPE_2);
1636
1637 query.append(_FINDER_COLUMN_T_A_ACTIVE_2);
1638
1639 if (orderByComparator != null) {
1640 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1641 orderByComparator);
1642 }
1643
1644 else {
1645 query.append(GroupModelImpl.ORDER_BY_JPQL);
1646 }
1647
1648 String sql = query.toString();
1649
1650 Query q = session.createQuery(sql);
1651
1652 QueryPos qPos = QueryPos.getInstance(q);
1653
1654 qPos.add(type);
1655
1656 qPos.add(active);
1657
1658 list = (List<Group>)QueryUtil.list(q, getDialect(), start, end);
1659 }
1660 catch (Exception e) {
1661 throw processException(e);
1662 }
1663 finally {
1664 if (list == null) {
1665 list = new ArrayList<Group>();
1666 }
1667
1668 cacheResult(list);
1669
1670 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_T_A, finderArgs,
1671 list);
1672
1673 closeSession(session);
1674 }
1675 }
1676
1677 return list;
1678 }
1679
1680
1694 public Group findByT_A_First(int type, boolean active,
1695 OrderByComparator orderByComparator)
1696 throws NoSuchGroupException, SystemException {
1697 List<Group> list = findByT_A(type, active, 0, 1, orderByComparator);
1698
1699 if (list.isEmpty()) {
1700 StringBundler msg = new StringBundler(6);
1701
1702 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1703
1704 msg.append("type=");
1705 msg.append(type);
1706
1707 msg.append(", active=");
1708 msg.append(active);
1709
1710 msg.append(StringPool.CLOSE_CURLY_BRACE);
1711
1712 throw new NoSuchGroupException(msg.toString());
1713 }
1714 else {
1715 return list.get(0);
1716 }
1717 }
1718
1719
1733 public Group findByT_A_Last(int type, boolean active,
1734 OrderByComparator orderByComparator)
1735 throws NoSuchGroupException, SystemException {
1736 int count = countByT_A(type, active);
1737
1738 List<Group> list = findByT_A(type, active, count - 1, count,
1739 orderByComparator);
1740
1741 if (list.isEmpty()) {
1742 StringBundler msg = new StringBundler(6);
1743
1744 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1745
1746 msg.append("type=");
1747 msg.append(type);
1748
1749 msg.append(", active=");
1750 msg.append(active);
1751
1752 msg.append(StringPool.CLOSE_CURLY_BRACE);
1753
1754 throw new NoSuchGroupException(msg.toString());
1755 }
1756 else {
1757 return list.get(0);
1758 }
1759 }
1760
1761
1776 public Group[] findByT_A_PrevAndNext(long groupId, int type,
1777 boolean active, OrderByComparator orderByComparator)
1778 throws NoSuchGroupException, SystemException {
1779 Group group = findByPrimaryKey(groupId);
1780
1781 Session session = null;
1782
1783 try {
1784 session = openSession();
1785
1786 Group[] array = new GroupImpl[3];
1787
1788 array[0] = getByT_A_PrevAndNext(session, group, type, active,
1789 orderByComparator, true);
1790
1791 array[1] = group;
1792
1793 array[2] = getByT_A_PrevAndNext(session, group, type, active,
1794 orderByComparator, false);
1795
1796 return array;
1797 }
1798 catch (Exception e) {
1799 throw processException(e);
1800 }
1801 finally {
1802 closeSession(session);
1803 }
1804 }
1805
1806 protected Group getByT_A_PrevAndNext(Session session, Group group,
1807 int type, boolean active, OrderByComparator orderByComparator,
1808 boolean previous) {
1809 StringBundler query = null;
1810
1811 if (orderByComparator != null) {
1812 query = new StringBundler(6 +
1813 (orderByComparator.getOrderByFields().length * 6));
1814 }
1815 else {
1816 query = new StringBundler(3);
1817 }
1818
1819 query.append(_SQL_SELECT_GROUP__WHERE);
1820
1821 query.append(_FINDER_COLUMN_T_A_TYPE_2);
1822
1823 query.append(_FINDER_COLUMN_T_A_ACTIVE_2);
1824
1825 if (orderByComparator != null) {
1826 String[] orderByFields = orderByComparator.getOrderByFields();
1827
1828 if (orderByFields.length > 0) {
1829 query.append(WHERE_AND);
1830 }
1831
1832 for (int i = 0; i < orderByFields.length; i++) {
1833 query.append(_ORDER_BY_ENTITY_ALIAS);
1834 query.append(orderByFields[i]);
1835
1836 if ((i + 1) < orderByFields.length) {
1837 if (orderByComparator.isAscending() ^ previous) {
1838 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1839 }
1840 else {
1841 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1842 }
1843 }
1844 else {
1845 if (orderByComparator.isAscending() ^ previous) {
1846 query.append(WHERE_GREATER_THAN);
1847 }
1848 else {
1849 query.append(WHERE_LESSER_THAN);
1850 }
1851 }
1852 }
1853
1854 query.append(ORDER_BY_CLAUSE);
1855
1856 for (int i = 0; i < orderByFields.length; i++) {
1857 query.append(_ORDER_BY_ENTITY_ALIAS);
1858 query.append(orderByFields[i]);
1859
1860 if ((i + 1) < orderByFields.length) {
1861 if (orderByComparator.isAscending() ^ previous) {
1862 query.append(ORDER_BY_ASC_HAS_NEXT);
1863 }
1864 else {
1865 query.append(ORDER_BY_DESC_HAS_NEXT);
1866 }
1867 }
1868 else {
1869 if (orderByComparator.isAscending() ^ previous) {
1870 query.append(ORDER_BY_ASC);
1871 }
1872 else {
1873 query.append(ORDER_BY_DESC);
1874 }
1875 }
1876 }
1877 }
1878
1879 else {
1880 query.append(GroupModelImpl.ORDER_BY_JPQL);
1881 }
1882
1883 String sql = query.toString();
1884
1885 Query q = session.createQuery(sql);
1886
1887 q.setFirstResult(0);
1888 q.setMaxResults(2);
1889
1890 QueryPos qPos = QueryPos.getInstance(q);
1891
1892 qPos.add(type);
1893
1894 qPos.add(active);
1895
1896 if (orderByComparator != null) {
1897 Object[] values = orderByComparator.getOrderByValues(group);
1898
1899 for (Object value : values) {
1900 qPos.add(value);
1901 }
1902 }
1903
1904 List<Group> list = q.list();
1905
1906 if (list.size() == 2) {
1907 return list.get(1);
1908 }
1909 else {
1910 return null;
1911 }
1912 }
1913
1914
1924 public Group findByC_C_C(long companyId, long classNameId, long classPK)
1925 throws NoSuchGroupException, SystemException {
1926 Group group = fetchByC_C_C(companyId, classNameId, classPK);
1927
1928 if (group == null) {
1929 StringBundler msg = new StringBundler(8);
1930
1931 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1932
1933 msg.append("companyId=");
1934 msg.append(companyId);
1935
1936 msg.append(", classNameId=");
1937 msg.append(classNameId);
1938
1939 msg.append(", classPK=");
1940 msg.append(classPK);
1941
1942 msg.append(StringPool.CLOSE_CURLY_BRACE);
1943
1944 if (_log.isWarnEnabled()) {
1945 _log.warn(msg.toString());
1946 }
1947
1948 throw new NoSuchGroupException(msg.toString());
1949 }
1950
1951 return group;
1952 }
1953
1954
1963 public Group fetchByC_C_C(long companyId, long classNameId, long classPK)
1964 throws SystemException {
1965 return fetchByC_C_C(companyId, classNameId, classPK, true);
1966 }
1967
1968
1977 public Group fetchByC_C_C(long companyId, long classNameId, long classPK,
1978 boolean retrieveFromCache) throws SystemException {
1979 Object[] finderArgs = new Object[] { companyId, classNameId, classPK };
1980
1981 Object result = null;
1982
1983 if (retrieveFromCache) {
1984 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_C_C,
1985 finderArgs, this);
1986 }
1987
1988 if (result == null) {
1989 Session session = null;
1990
1991 try {
1992 session = openSession();
1993
1994 StringBundler query = new StringBundler(5);
1995
1996 query.append(_SQL_SELECT_GROUP__WHERE);
1997
1998 query.append(_FINDER_COLUMN_C_C_C_COMPANYID_2);
1999
2000 query.append(_FINDER_COLUMN_C_C_C_CLASSNAMEID_2);
2001
2002 query.append(_FINDER_COLUMN_C_C_C_CLASSPK_2);
2003
2004 query.append(GroupModelImpl.ORDER_BY_JPQL);
2005
2006 String sql = query.toString();
2007
2008 Query q = session.createQuery(sql);
2009
2010 QueryPos qPos = QueryPos.getInstance(q);
2011
2012 qPos.add(companyId);
2013
2014 qPos.add(classNameId);
2015
2016 qPos.add(classPK);
2017
2018 List<Group> list = q.list();
2019
2020 result = list;
2021
2022 Group group = null;
2023
2024 if (list.isEmpty()) {
2025 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C_C,
2026 finderArgs, list);
2027 }
2028 else {
2029 group = list.get(0);
2030
2031 cacheResult(group);
2032
2033 if ((group.getCompanyId() != companyId) ||
2034 (group.getClassNameId() != classNameId) ||
2035 (group.getClassPK() != classPK)) {
2036 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C_C,
2037 finderArgs, group);
2038 }
2039 }
2040
2041 return group;
2042 }
2043 catch (Exception e) {
2044 throw processException(e);
2045 }
2046 finally {
2047 if (result == null) {
2048 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C_C,
2049 finderArgs, new ArrayList<Group>());
2050 }
2051
2052 closeSession(session);
2053 }
2054 }
2055 else {
2056 if (result instanceof List<?>) {
2057 return null;
2058 }
2059 else {
2060 return (Group)result;
2061 }
2062 }
2063 }
2064
2065
2075 public Group findByC_L_N(long companyId, long liveGroupId, String name)
2076 throws NoSuchGroupException, SystemException {
2077 Group group = fetchByC_L_N(companyId, liveGroupId, name);
2078
2079 if (group == null) {
2080 StringBundler msg = new StringBundler(8);
2081
2082 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2083
2084 msg.append("companyId=");
2085 msg.append(companyId);
2086
2087 msg.append(", liveGroupId=");
2088 msg.append(liveGroupId);
2089
2090 msg.append(", name=");
2091 msg.append(name);
2092
2093 msg.append(StringPool.CLOSE_CURLY_BRACE);
2094
2095 if (_log.isWarnEnabled()) {
2096 _log.warn(msg.toString());
2097 }
2098
2099 throw new NoSuchGroupException(msg.toString());
2100 }
2101
2102 return group;
2103 }
2104
2105
2114 public Group fetchByC_L_N(long companyId, long liveGroupId, String name)
2115 throws SystemException {
2116 return fetchByC_L_N(companyId, liveGroupId, name, true);
2117 }
2118
2119
2128 public Group fetchByC_L_N(long companyId, long liveGroupId, String name,
2129 boolean retrieveFromCache) throws SystemException {
2130 Object[] finderArgs = new Object[] { companyId, liveGroupId, name };
2131
2132 Object result = null;
2133
2134 if (retrieveFromCache) {
2135 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_L_N,
2136 finderArgs, this);
2137 }
2138
2139 if (result == null) {
2140 Session session = null;
2141
2142 try {
2143 session = openSession();
2144
2145 StringBundler query = new StringBundler(5);
2146
2147 query.append(_SQL_SELECT_GROUP__WHERE);
2148
2149 query.append(_FINDER_COLUMN_C_L_N_COMPANYID_2);
2150
2151 query.append(_FINDER_COLUMN_C_L_N_LIVEGROUPID_2);
2152
2153 if (name == null) {
2154 query.append(_FINDER_COLUMN_C_L_N_NAME_1);
2155 }
2156 else {
2157 if (name.equals(StringPool.BLANK)) {
2158 query.append(_FINDER_COLUMN_C_L_N_NAME_3);
2159 }
2160 else {
2161 query.append(_FINDER_COLUMN_C_L_N_NAME_2);
2162 }
2163 }
2164
2165 query.append(GroupModelImpl.ORDER_BY_JPQL);
2166
2167 String sql = query.toString();
2168
2169 Query q = session.createQuery(sql);
2170
2171 QueryPos qPos = QueryPos.getInstance(q);
2172
2173 qPos.add(companyId);
2174
2175 qPos.add(liveGroupId);
2176
2177 if (name != null) {
2178 qPos.add(name);
2179 }
2180
2181 List<Group> list = q.list();
2182
2183 result = list;
2184
2185 Group group = null;
2186
2187 if (list.isEmpty()) {
2188 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_L_N,
2189 finderArgs, list);
2190 }
2191 else {
2192 group = list.get(0);
2193
2194 cacheResult(group);
2195
2196 if ((group.getCompanyId() != companyId) ||
2197 (group.getLiveGroupId() != liveGroupId) ||
2198 (group.getName() == null) ||
2199 !group.getName().equals(name)) {
2200 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_L_N,
2201 finderArgs, group);
2202 }
2203 }
2204
2205 return group;
2206 }
2207 catch (Exception e) {
2208 throw processException(e);
2209 }
2210 finally {
2211 if (result == null) {
2212 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_L_N,
2213 finderArgs, new ArrayList<Group>());
2214 }
2215
2216 closeSession(session);
2217 }
2218 }
2219 else {
2220 if (result instanceof List<?>) {
2221 return null;
2222 }
2223 else {
2224 return (Group)result;
2225 }
2226 }
2227 }
2228
2229
2240 public Group findByC_C_L_N(long companyId, long classNameId,
2241 long liveGroupId, String name)
2242 throws NoSuchGroupException, SystemException {
2243 Group group = fetchByC_C_L_N(companyId, classNameId, liveGroupId, name);
2244
2245 if (group == null) {
2246 StringBundler msg = new StringBundler(10);
2247
2248 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2249
2250 msg.append("companyId=");
2251 msg.append(companyId);
2252
2253 msg.append(", classNameId=");
2254 msg.append(classNameId);
2255
2256 msg.append(", liveGroupId=");
2257 msg.append(liveGroupId);
2258
2259 msg.append(", name=");
2260 msg.append(name);
2261
2262 msg.append(StringPool.CLOSE_CURLY_BRACE);
2263
2264 if (_log.isWarnEnabled()) {
2265 _log.warn(msg.toString());
2266 }
2267
2268 throw new NoSuchGroupException(msg.toString());
2269 }
2270
2271 return group;
2272 }
2273
2274
2284 public Group fetchByC_C_L_N(long companyId, long classNameId,
2285 long liveGroupId, String name) throws SystemException {
2286 return fetchByC_C_L_N(companyId, classNameId, liveGroupId, name, true);
2287 }
2288
2289
2299 public Group fetchByC_C_L_N(long companyId, long classNameId,
2300 long liveGroupId, String name, boolean retrieveFromCache)
2301 throws SystemException {
2302 Object[] finderArgs = new Object[] {
2303 companyId, classNameId, liveGroupId, name
2304 };
2305
2306 Object result = null;
2307
2308 if (retrieveFromCache) {
2309 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_C_L_N,
2310 finderArgs, this);
2311 }
2312
2313 if (result == null) {
2314 Session session = null;
2315
2316 try {
2317 session = openSession();
2318
2319 StringBundler query = new StringBundler(6);
2320
2321 query.append(_SQL_SELECT_GROUP__WHERE);
2322
2323 query.append(_FINDER_COLUMN_C_C_L_N_COMPANYID_2);
2324
2325 query.append(_FINDER_COLUMN_C_C_L_N_CLASSNAMEID_2);
2326
2327 query.append(_FINDER_COLUMN_C_C_L_N_LIVEGROUPID_2);
2328
2329 if (name == null) {
2330 query.append(_FINDER_COLUMN_C_C_L_N_NAME_1);
2331 }
2332 else {
2333 if (name.equals(StringPool.BLANK)) {
2334 query.append(_FINDER_COLUMN_C_C_L_N_NAME_3);
2335 }
2336 else {
2337 query.append(_FINDER_COLUMN_C_C_L_N_NAME_2);
2338 }
2339 }
2340
2341 query.append(GroupModelImpl.ORDER_BY_JPQL);
2342
2343 String sql = query.toString();
2344
2345 Query q = session.createQuery(sql);
2346
2347 QueryPos qPos = QueryPos.getInstance(q);
2348
2349 qPos.add(companyId);
2350
2351 qPos.add(classNameId);
2352
2353 qPos.add(liveGroupId);
2354
2355 if (name != null) {
2356 qPos.add(name);
2357 }
2358
2359 List<Group> list = q.list();
2360
2361 result = list;
2362
2363 Group group = null;
2364
2365 if (list.isEmpty()) {
2366 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C_L_N,
2367 finderArgs, list);
2368 }
2369 else {
2370 group = list.get(0);
2371
2372 cacheResult(group);
2373
2374 if ((group.getCompanyId() != companyId) ||
2375 (group.getClassNameId() != classNameId) ||
2376 (group.getLiveGroupId() != liveGroupId) ||
2377 (group.getName() == null) ||
2378 !group.getName().equals(name)) {
2379 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C_L_N,
2380 finderArgs, group);
2381 }
2382 }
2383
2384 return group;
2385 }
2386 catch (Exception e) {
2387 throw processException(e);
2388 }
2389 finally {
2390 if (result == null) {
2391 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C_L_N,
2392 finderArgs, new ArrayList<Group>());
2393 }
2394
2395 closeSession(session);
2396 }
2397 }
2398 else {
2399 if (result instanceof List<?>) {
2400 return null;
2401 }
2402 else {
2403 return (Group)result;
2404 }
2405 }
2406 }
2407
2408
2414 public List<Group> findAll() throws SystemException {
2415 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2416 }
2417
2418
2430 public List<Group> findAll(int start, int end) throws SystemException {
2431 return findAll(start, end, null);
2432 }
2433
2434
2447 public List<Group> findAll(int start, int end,
2448 OrderByComparator orderByComparator) throws SystemException {
2449 Object[] finderArgs = new Object[] {
2450 String.valueOf(start), String.valueOf(end),
2451 String.valueOf(orderByComparator)
2452 };
2453
2454 List<Group> list = (List<Group>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
2455 finderArgs, this);
2456
2457 if (list == null) {
2458 Session session = null;
2459
2460 try {
2461 session = openSession();
2462
2463 StringBundler query = null;
2464 String sql = null;
2465
2466 if (orderByComparator != null) {
2467 query = new StringBundler(2 +
2468 (orderByComparator.getOrderByFields().length * 3));
2469
2470 query.append(_SQL_SELECT_GROUP_);
2471
2472 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2473 orderByComparator);
2474
2475 sql = query.toString();
2476 }
2477 else {
2478 sql = _SQL_SELECT_GROUP_.concat(GroupModelImpl.ORDER_BY_JPQL);
2479 }
2480
2481 Query q = session.createQuery(sql);
2482
2483 if (orderByComparator == null) {
2484 list = (List<Group>)QueryUtil.list(q, getDialect(), start,
2485 end, false);
2486
2487 Collections.sort(list);
2488 }
2489 else {
2490 list = (List<Group>)QueryUtil.list(q, getDialect(), start,
2491 end);
2492 }
2493 }
2494 catch (Exception e) {
2495 throw processException(e);
2496 }
2497 finally {
2498 if (list == null) {
2499 list = new ArrayList<Group>();
2500 }
2501
2502 cacheResult(list);
2503
2504 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
2505
2506 closeSession(session);
2507 }
2508 }
2509
2510 return list;
2511 }
2512
2513
2519 public void removeByCompanyId(long companyId) throws SystemException {
2520 for (Group group : findByCompanyId(companyId)) {
2521 remove(group);
2522 }
2523 }
2524
2525
2531 public void removeByLiveGroupId(long liveGroupId)
2532 throws NoSuchGroupException, SystemException {
2533 Group group = findByLiveGroupId(liveGroupId);
2534
2535 remove(group);
2536 }
2537
2538
2545 public void removeByC_N(long companyId, String name)
2546 throws NoSuchGroupException, SystemException {
2547 Group group = findByC_N(companyId, name);
2548
2549 remove(group);
2550 }
2551
2552
2559 public void removeByC_F(long companyId, String friendlyURL)
2560 throws NoSuchGroupException, SystemException {
2561 Group group = findByC_F(companyId, friendlyURL);
2562
2563 remove(group);
2564 }
2565
2566
2573 public void removeByT_A(int type, boolean active) throws SystemException {
2574 for (Group group : findByT_A(type, active)) {
2575 remove(group);
2576 }
2577 }
2578
2579
2587 public void removeByC_C_C(long companyId, long classNameId, long classPK)
2588 throws NoSuchGroupException, SystemException {
2589 Group group = findByC_C_C(companyId, classNameId, classPK);
2590
2591 remove(group);
2592 }
2593
2594
2602 public void removeByC_L_N(long companyId, long liveGroupId, String name)
2603 throws NoSuchGroupException, SystemException {
2604 Group group = findByC_L_N(companyId, liveGroupId, name);
2605
2606 remove(group);
2607 }
2608
2609
2618 public void removeByC_C_L_N(long companyId, long classNameId,
2619 long liveGroupId, String name)
2620 throws NoSuchGroupException, SystemException {
2621 Group group = findByC_C_L_N(companyId, classNameId, liveGroupId, name);
2622
2623 remove(group);
2624 }
2625
2626
2631 public void removeAll() throws SystemException {
2632 for (Group group : findAll()) {
2633 remove(group);
2634 }
2635 }
2636
2637
2644 public int countByCompanyId(long companyId) throws SystemException {
2645 Object[] finderArgs = new Object[] { companyId };
2646
2647 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
2648 finderArgs, this);
2649
2650 if (count == null) {
2651 Session session = null;
2652
2653 try {
2654 session = openSession();
2655
2656 StringBundler query = new StringBundler(2);
2657
2658 query.append(_SQL_COUNT_GROUP__WHERE);
2659
2660 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
2661
2662 String sql = query.toString();
2663
2664 Query q = session.createQuery(sql);
2665
2666 QueryPos qPos = QueryPos.getInstance(q);
2667
2668 qPos.add(companyId);
2669
2670 count = (Long)q.uniqueResult();
2671 }
2672 catch (Exception e) {
2673 throw processException(e);
2674 }
2675 finally {
2676 if (count == null) {
2677 count = Long.valueOf(0);
2678 }
2679
2680 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
2681 finderArgs, count);
2682
2683 closeSession(session);
2684 }
2685 }
2686
2687 return count.intValue();
2688 }
2689
2690
2697 public int countByLiveGroupId(long liveGroupId) throws SystemException {
2698 Object[] finderArgs = new Object[] { liveGroupId };
2699
2700 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_LIVEGROUPID,
2701 finderArgs, this);
2702
2703 if (count == null) {
2704 Session session = null;
2705
2706 try {
2707 session = openSession();
2708
2709 StringBundler query = new StringBundler(2);
2710
2711 query.append(_SQL_COUNT_GROUP__WHERE);
2712
2713 query.append(_FINDER_COLUMN_LIVEGROUPID_LIVEGROUPID_2);
2714
2715 String sql = query.toString();
2716
2717 Query q = session.createQuery(sql);
2718
2719 QueryPos qPos = QueryPos.getInstance(q);
2720
2721 qPos.add(liveGroupId);
2722
2723 count = (Long)q.uniqueResult();
2724 }
2725 catch (Exception e) {
2726 throw processException(e);
2727 }
2728 finally {
2729 if (count == null) {
2730 count = Long.valueOf(0);
2731 }
2732
2733 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_LIVEGROUPID,
2734 finderArgs, count);
2735
2736 closeSession(session);
2737 }
2738 }
2739
2740 return count.intValue();
2741 }
2742
2743
2751 public int countByC_N(long companyId, String name)
2752 throws SystemException {
2753 Object[] finderArgs = new Object[] { companyId, name };
2754
2755 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_N,
2756 finderArgs, this);
2757
2758 if (count == null) {
2759 Session session = null;
2760
2761 try {
2762 session = openSession();
2763
2764 StringBundler query = new StringBundler(3);
2765
2766 query.append(_SQL_COUNT_GROUP__WHERE);
2767
2768 query.append(_FINDER_COLUMN_C_N_COMPANYID_2);
2769
2770 if (name == null) {
2771 query.append(_FINDER_COLUMN_C_N_NAME_1);
2772 }
2773 else {
2774 if (name.equals(StringPool.BLANK)) {
2775 query.append(_FINDER_COLUMN_C_N_NAME_3);
2776 }
2777 else {
2778 query.append(_FINDER_COLUMN_C_N_NAME_2);
2779 }
2780 }
2781
2782 String sql = query.toString();
2783
2784 Query q = session.createQuery(sql);
2785
2786 QueryPos qPos = QueryPos.getInstance(q);
2787
2788 qPos.add(companyId);
2789
2790 if (name != null) {
2791 qPos.add(name);
2792 }
2793
2794 count = (Long)q.uniqueResult();
2795 }
2796 catch (Exception e) {
2797 throw processException(e);
2798 }
2799 finally {
2800 if (count == null) {
2801 count = Long.valueOf(0);
2802 }
2803
2804 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_N, finderArgs,
2805 count);
2806
2807 closeSession(session);
2808 }
2809 }
2810
2811 return count.intValue();
2812 }
2813
2814
2822 public int countByC_F(long companyId, String friendlyURL)
2823 throws SystemException {
2824 Object[] finderArgs = new Object[] { companyId, friendlyURL };
2825
2826 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_F,
2827 finderArgs, this);
2828
2829 if (count == null) {
2830 Session session = null;
2831
2832 try {
2833 session = openSession();
2834
2835 StringBundler query = new StringBundler(3);
2836
2837 query.append(_SQL_COUNT_GROUP__WHERE);
2838
2839 query.append(_FINDER_COLUMN_C_F_COMPANYID_2);
2840
2841 if (friendlyURL == null) {
2842 query.append(_FINDER_COLUMN_C_F_FRIENDLYURL_1);
2843 }
2844 else {
2845 if (friendlyURL.equals(StringPool.BLANK)) {
2846 query.append(_FINDER_COLUMN_C_F_FRIENDLYURL_3);
2847 }
2848 else {
2849 query.append(_FINDER_COLUMN_C_F_FRIENDLYURL_2);
2850 }
2851 }
2852
2853 String sql = query.toString();
2854
2855 Query q = session.createQuery(sql);
2856
2857 QueryPos qPos = QueryPos.getInstance(q);
2858
2859 qPos.add(companyId);
2860
2861 if (friendlyURL != null) {
2862 qPos.add(friendlyURL);
2863 }
2864
2865 count = (Long)q.uniqueResult();
2866 }
2867 catch (Exception e) {
2868 throw processException(e);
2869 }
2870 finally {
2871 if (count == null) {
2872 count = Long.valueOf(0);
2873 }
2874
2875 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_F, finderArgs,
2876 count);
2877
2878 closeSession(session);
2879 }
2880 }
2881
2882 return count.intValue();
2883 }
2884
2885
2893 public int countByT_A(int type, boolean active) throws SystemException {
2894 Object[] finderArgs = new Object[] { type, active };
2895
2896 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_T_A,
2897 finderArgs, this);
2898
2899 if (count == null) {
2900 Session session = null;
2901
2902 try {
2903 session = openSession();
2904
2905 StringBundler query = new StringBundler(3);
2906
2907 query.append(_SQL_COUNT_GROUP__WHERE);
2908
2909 query.append(_FINDER_COLUMN_T_A_TYPE_2);
2910
2911 query.append(_FINDER_COLUMN_T_A_ACTIVE_2);
2912
2913 String sql = query.toString();
2914
2915 Query q = session.createQuery(sql);
2916
2917 QueryPos qPos = QueryPos.getInstance(q);
2918
2919 qPos.add(type);
2920
2921 qPos.add(active);
2922
2923 count = (Long)q.uniqueResult();
2924 }
2925 catch (Exception e) {
2926 throw processException(e);
2927 }
2928 finally {
2929 if (count == null) {
2930 count = Long.valueOf(0);
2931 }
2932
2933 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_T_A, finderArgs,
2934 count);
2935
2936 closeSession(session);
2937 }
2938 }
2939
2940 return count.intValue();
2941 }
2942
2943
2952 public int countByC_C_C(long companyId, long classNameId, long classPK)
2953 throws SystemException {
2954 Object[] finderArgs = new Object[] { companyId, classNameId, classPK };
2955
2956 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C_C,
2957 finderArgs, this);
2958
2959 if (count == null) {
2960 Session session = null;
2961
2962 try {
2963 session = openSession();
2964
2965 StringBundler query = new StringBundler(4);
2966
2967 query.append(_SQL_COUNT_GROUP__WHERE);
2968
2969 query.append(_FINDER_COLUMN_C_C_C_COMPANYID_2);
2970
2971 query.append(_FINDER_COLUMN_C_C_C_CLASSNAMEID_2);
2972
2973 query.append(_FINDER_COLUMN_C_C_C_CLASSPK_2);
2974
2975 String sql = query.toString();
2976
2977 Query q = session.createQuery(sql);
2978
2979 QueryPos qPos = QueryPos.getInstance(q);
2980
2981 qPos.add(companyId);
2982
2983 qPos.add(classNameId);
2984
2985 qPos.add(classPK);
2986
2987 count = (Long)q.uniqueResult();
2988 }
2989 catch (Exception e) {
2990 throw processException(e);
2991 }
2992 finally {
2993 if (count == null) {
2994 count = Long.valueOf(0);
2995 }
2996
2997 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C_C,
2998 finderArgs, count);
2999
3000 closeSession(session);
3001 }
3002 }
3003
3004 return count.intValue();
3005 }
3006
3007
3016 public int countByC_L_N(long companyId, long liveGroupId, String name)
3017 throws SystemException {
3018 Object[] finderArgs = new Object[] { companyId, liveGroupId, name };
3019
3020 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_L_N,
3021 finderArgs, this);
3022
3023 if (count == null) {
3024 Session session = null;
3025
3026 try {
3027 session = openSession();
3028
3029 StringBundler query = new StringBundler(4);
3030
3031 query.append(_SQL_COUNT_GROUP__WHERE);
3032
3033 query.append(_FINDER_COLUMN_C_L_N_COMPANYID_2);
3034
3035 query.append(_FINDER_COLUMN_C_L_N_LIVEGROUPID_2);
3036
3037 if (name == null) {
3038 query.append(_FINDER_COLUMN_C_L_N_NAME_1);
3039 }
3040 else {
3041 if (name.equals(StringPool.BLANK)) {
3042 query.append(_FINDER_COLUMN_C_L_N_NAME_3);
3043 }
3044 else {
3045 query.append(_FINDER_COLUMN_C_L_N_NAME_2);
3046 }
3047 }
3048
3049 String sql = query.toString();
3050
3051 Query q = session.createQuery(sql);
3052
3053 QueryPos qPos = QueryPos.getInstance(q);
3054
3055 qPos.add(companyId);
3056
3057 qPos.add(liveGroupId);
3058
3059 if (name != null) {
3060 qPos.add(name);
3061 }
3062
3063 count = (Long)q.uniqueResult();
3064 }
3065 catch (Exception e) {
3066 throw processException(e);
3067 }
3068 finally {
3069 if (count == null) {
3070 count = Long.valueOf(0);
3071 }
3072
3073 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_L_N,
3074 finderArgs, count);
3075
3076 closeSession(session);
3077 }
3078 }
3079
3080 return count.intValue();
3081 }
3082
3083
3093 public int countByC_C_L_N(long companyId, long classNameId,
3094 long liveGroupId, String name) throws SystemException {
3095 Object[] finderArgs = new Object[] {
3096 companyId, classNameId, liveGroupId, name
3097 };
3098
3099 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C_L_N,
3100 finderArgs, this);
3101
3102 if (count == null) {
3103 Session session = null;
3104
3105 try {
3106 session = openSession();
3107
3108 StringBundler query = new StringBundler(5);
3109
3110 query.append(_SQL_COUNT_GROUP__WHERE);
3111
3112 query.append(_FINDER_COLUMN_C_C_L_N_COMPANYID_2);
3113
3114 query.append(_FINDER_COLUMN_C_C_L_N_CLASSNAMEID_2);
3115
3116 query.append(_FINDER_COLUMN_C_C_L_N_LIVEGROUPID_2);
3117
3118 if (name == null) {
3119 query.append(_FINDER_COLUMN_C_C_L_N_NAME_1);
3120 }
3121 else {
3122 if (name.equals(StringPool.BLANK)) {
3123 query.append(_FINDER_COLUMN_C_C_L_N_NAME_3);
3124 }
3125 else {
3126 query.append(_FINDER_COLUMN_C_C_L_N_NAME_2);
3127 }
3128 }
3129
3130 String sql = query.toString();
3131
3132 Query q = session.createQuery(sql);
3133
3134 QueryPos qPos = QueryPos.getInstance(q);
3135
3136 qPos.add(companyId);
3137
3138 qPos.add(classNameId);
3139
3140 qPos.add(liveGroupId);
3141
3142 if (name != null) {
3143 qPos.add(name);
3144 }
3145
3146 count = (Long)q.uniqueResult();
3147 }
3148 catch (Exception e) {
3149 throw processException(e);
3150 }
3151 finally {
3152 if (count == null) {
3153 count = Long.valueOf(0);
3154 }
3155
3156 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C_L_N,
3157 finderArgs, count);
3158
3159 closeSession(session);
3160 }
3161 }
3162
3163 return count.intValue();
3164 }
3165
3166
3172 public int countAll() throws SystemException {
3173 Object[] finderArgs = new Object[0];
3174
3175 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3176 finderArgs, this);
3177
3178 if (count == null) {
3179 Session session = null;
3180
3181 try {
3182 session = openSession();
3183
3184 Query q = session.createQuery(_SQL_COUNT_GROUP_);
3185
3186 count = (Long)q.uniqueResult();
3187 }
3188 catch (Exception e) {
3189 throw processException(e);
3190 }
3191 finally {
3192 if (count == null) {
3193 count = Long.valueOf(0);
3194 }
3195
3196 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
3197 count);
3198
3199 closeSession(session);
3200 }
3201 }
3202
3203 return count.intValue();
3204 }
3205
3206
3213 public List<com.liferay.portal.model.Organization> getOrganizations(long pk)
3214 throws SystemException {
3215 return getOrganizations(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
3216 }
3217
3218
3231 public List<com.liferay.portal.model.Organization> getOrganizations(
3232 long pk, int start, int end) throws SystemException {
3233 return getOrganizations(pk, start, end, null);
3234 }
3235
3236 public static final FinderPath FINDER_PATH_GET_ORGANIZATIONS = new FinderPath(com.liferay.portal.model.impl.OrganizationModelImpl.ENTITY_CACHE_ENABLED,
3237 GroupModelImpl.FINDER_CACHE_ENABLED_GROUPS_ORGS,
3238 GroupModelImpl.MAPPING_TABLE_GROUPS_ORGS_NAME, "getOrganizations",
3239 new String[] {
3240 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
3241 "com.liferay.portal.kernel.util.OrderByComparator"
3242 });
3243
3244
3258 public List<com.liferay.portal.model.Organization> getOrganizations(
3259 long pk, int start, int end, OrderByComparator orderByComparator)
3260 throws SystemException {
3261 Object[] finderArgs = new Object[] {
3262 pk, String.valueOf(start), String.valueOf(end),
3263 String.valueOf(orderByComparator)
3264 };
3265
3266 List<com.liferay.portal.model.Organization> list = (List<com.liferay.portal.model.Organization>)FinderCacheUtil.getResult(FINDER_PATH_GET_ORGANIZATIONS,
3267 finderArgs, this);
3268
3269 if (list == null) {
3270 Session session = null;
3271
3272 try {
3273 session = openSession();
3274
3275 String sql = null;
3276
3277 if (orderByComparator != null) {
3278 sql = _SQL_GETORGANIZATIONS.concat(ORDER_BY_CLAUSE)
3279 .concat(orderByComparator.getOrderBy());
3280 }
3281 else {
3282 sql = _SQL_GETORGANIZATIONS.concat(com.liferay.portal.model.impl.OrganizationModelImpl.ORDER_BY_SQL);
3283 }
3284
3285 SQLQuery q = session.createSQLQuery(sql);
3286
3287 q.addEntity("Organization_",
3288 com.liferay.portal.model.impl.OrganizationImpl.class);
3289
3290 QueryPos qPos = QueryPos.getInstance(q);
3291
3292 qPos.add(pk);
3293
3294 list = (List<com.liferay.portal.model.Organization>)QueryUtil.list(q,
3295 getDialect(), start, end);
3296 }
3297 catch (Exception e) {
3298 throw processException(e);
3299 }
3300 finally {
3301 if (list == null) {
3302 list = new ArrayList<com.liferay.portal.model.Organization>();
3303 }
3304
3305 organizationPersistence.cacheResult(list);
3306
3307 FinderCacheUtil.putResult(FINDER_PATH_GET_ORGANIZATIONS,
3308 finderArgs, list);
3309
3310 closeSession(session);
3311 }
3312 }
3313
3314 return list;
3315 }
3316
3317 public static final FinderPath FINDER_PATH_GET_ORGANIZATIONS_SIZE = new FinderPath(com.liferay.portal.model.impl.OrganizationModelImpl.ENTITY_CACHE_ENABLED,
3318 GroupModelImpl.FINDER_CACHE_ENABLED_GROUPS_ORGS,
3319 GroupModelImpl.MAPPING_TABLE_GROUPS_ORGS_NAME,
3320 "getOrganizationsSize", new String[] { Long.class.getName() });
3321
3322
3329 public int getOrganizationsSize(long pk) throws SystemException {
3330 Object[] finderArgs = new Object[] { pk };
3331
3332 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_ORGANIZATIONS_SIZE,
3333 finderArgs, this);
3334
3335 if (count == null) {
3336 Session session = null;
3337
3338 try {
3339 session = openSession();
3340
3341 SQLQuery q = session.createSQLQuery(_SQL_GETORGANIZATIONSSIZE);
3342
3343 q.addScalar(COUNT_COLUMN_NAME,
3344 com.liferay.portal.kernel.dao.orm.Type.LONG);
3345
3346 QueryPos qPos = QueryPos.getInstance(q);
3347
3348 qPos.add(pk);
3349
3350 count = (Long)q.uniqueResult();
3351 }
3352 catch (Exception e) {
3353 throw processException(e);
3354 }
3355 finally {
3356 if (count == null) {
3357 count = Long.valueOf(0);
3358 }
3359
3360 FinderCacheUtil.putResult(FINDER_PATH_GET_ORGANIZATIONS_SIZE,
3361 finderArgs, count);
3362
3363 closeSession(session);
3364 }
3365 }
3366
3367 return count.intValue();
3368 }
3369
3370 public static final FinderPath FINDER_PATH_CONTAINS_ORGANIZATION = new FinderPath(com.liferay.portal.model.impl.OrganizationModelImpl.ENTITY_CACHE_ENABLED,
3371 GroupModelImpl.FINDER_CACHE_ENABLED_GROUPS_ORGS,
3372 GroupModelImpl.MAPPING_TABLE_GROUPS_ORGS_NAME,
3373 "containsOrganization",
3374 new String[] { Long.class.getName(), Long.class.getName() });
3375
3376
3384 public boolean containsOrganization(long pk, long organizationPK)
3385 throws SystemException {
3386 Object[] finderArgs = new Object[] { pk, organizationPK };
3387
3388 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_ORGANIZATION,
3389 finderArgs, this);
3390
3391 if (value == null) {
3392 try {
3393 value = Boolean.valueOf(containsOrganization.contains(pk,
3394 organizationPK));
3395 }
3396 catch (Exception e) {
3397 throw processException(e);
3398 }
3399 finally {
3400 if (value == null) {
3401 value = Boolean.FALSE;
3402 }
3403
3404 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_ORGANIZATION,
3405 finderArgs, value);
3406 }
3407 }
3408
3409 return value.booleanValue();
3410 }
3411
3412
3419 public boolean containsOrganizations(long pk) throws SystemException {
3420 if (getOrganizationsSize(pk) > 0) {
3421 return true;
3422 }
3423 else {
3424 return false;
3425 }
3426 }
3427
3428
3435 public void addOrganization(long pk, long organizationPK)
3436 throws SystemException {
3437 try {
3438 addOrganization.add(pk, organizationPK);
3439 }
3440 catch (Exception e) {
3441 throw processException(e);
3442 }
3443 finally {
3444 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ORGS_NAME);
3445 }
3446 }
3447
3448
3455 public void addOrganization(long pk,
3456 com.liferay.portal.model.Organization organization)
3457 throws SystemException {
3458 try {
3459 addOrganization.add(pk, organization.getPrimaryKey());
3460 }
3461 catch (Exception e) {
3462 throw processException(e);
3463 }
3464 finally {
3465 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ORGS_NAME);
3466 }
3467 }
3468
3469
3476 public void addOrganizations(long pk, long[] organizationPKs)
3477 throws SystemException {
3478 try {
3479 for (long organizationPK : organizationPKs) {
3480 addOrganization.add(pk, organizationPK);
3481 }
3482 }
3483 catch (Exception e) {
3484 throw processException(e);
3485 }
3486 finally {
3487 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ORGS_NAME);
3488 }
3489 }
3490
3491
3498 public void addOrganizations(long pk,
3499 List<com.liferay.portal.model.Organization> organizations)
3500 throws SystemException {
3501 try {
3502 for (com.liferay.portal.model.Organization organization : organizations) {
3503 addOrganization.add(pk, organization.getPrimaryKey());
3504 }
3505 }
3506 catch (Exception e) {
3507 throw processException(e);
3508 }
3509 finally {
3510 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ORGS_NAME);
3511 }
3512 }
3513
3514
3520 public void clearOrganizations(long pk) throws SystemException {
3521 try {
3522 clearOrganizations.clear(pk);
3523 }
3524 catch (Exception e) {
3525 throw processException(e);
3526 }
3527 finally {
3528 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ORGS_NAME);
3529 }
3530 }
3531
3532
3539 public void removeOrganization(long pk, long organizationPK)
3540 throws SystemException {
3541 try {
3542 removeOrganization.remove(pk, organizationPK);
3543 }
3544 catch (Exception e) {
3545 throw processException(e);
3546 }
3547 finally {
3548 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ORGS_NAME);
3549 }
3550 }
3551
3552
3559 public void removeOrganization(long pk,
3560 com.liferay.portal.model.Organization organization)
3561 throws SystemException {
3562 try {
3563 removeOrganization.remove(pk, organization.getPrimaryKey());
3564 }
3565 catch (Exception e) {
3566 throw processException(e);
3567 }
3568 finally {
3569 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ORGS_NAME);
3570 }
3571 }
3572
3573
3580 public void removeOrganizations(long pk, long[] organizationPKs)
3581 throws SystemException {
3582 try {
3583 for (long organizationPK : organizationPKs) {
3584 removeOrganization.remove(pk, organizationPK);
3585 }
3586 }
3587 catch (Exception e) {
3588 throw processException(e);
3589 }
3590 finally {
3591 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ORGS_NAME);
3592 }
3593 }
3594
3595
3602 public void removeOrganizations(long pk,
3603 List<com.liferay.portal.model.Organization> organizations)
3604 throws SystemException {
3605 try {
3606 for (com.liferay.portal.model.Organization organization : organizations) {
3607 removeOrganization.remove(pk, organization.getPrimaryKey());
3608 }
3609 }
3610 catch (Exception e) {
3611 throw processException(e);
3612 }
3613 finally {
3614 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ORGS_NAME);
3615 }
3616 }
3617
3618
3625 public void setOrganizations(long pk, long[] organizationPKs)
3626 throws SystemException {
3627 try {
3628 Set<Long> organizationPKSet = SetUtil.fromArray(organizationPKs);
3629
3630 List<com.liferay.portal.model.Organization> organizations = getOrganizations(pk);
3631
3632 for (com.liferay.portal.model.Organization organization : organizations) {
3633 if (!organizationPKSet.remove(organization.getPrimaryKey())) {
3634 removeOrganization.remove(pk, organization.getPrimaryKey());
3635 }
3636 }
3637
3638 for (Long organizationPK : organizationPKSet) {
3639 addOrganization.add(pk, organizationPK);
3640 }
3641 }
3642 catch (Exception e) {
3643 throw processException(e);
3644 }
3645 finally {
3646 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ORGS_NAME);
3647 }
3648 }
3649
3650
3657 public void setOrganizations(long pk,
3658 List<com.liferay.portal.model.Organization> organizations)
3659 throws SystemException {
3660 try {
3661 long[] organizationPKs = new long[organizations.size()];
3662
3663 for (int i = 0; i < organizations.size(); i++) {
3664 com.liferay.portal.model.Organization organization = organizations.get(i);
3665
3666 organizationPKs[i] = organization.getPrimaryKey();
3667 }
3668
3669 setOrganizations(pk, organizationPKs);
3670 }
3671 catch (Exception e) {
3672 throw processException(e);
3673 }
3674 finally {
3675 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ORGS_NAME);
3676 }
3677 }
3678
3679
3686 public List<com.liferay.portal.model.Permission> getPermissions(long pk)
3687 throws SystemException {
3688 return getPermissions(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
3689 }
3690
3691
3704 public List<com.liferay.portal.model.Permission> getPermissions(long pk,
3705 int start, int end) throws SystemException {
3706 return getPermissions(pk, start, end, null);
3707 }
3708
3709 public static final FinderPath FINDER_PATH_GET_PERMISSIONS = new FinderPath(com.liferay.portal.model.impl.PermissionModelImpl.ENTITY_CACHE_ENABLED,
3710 GroupModelImpl.FINDER_CACHE_ENABLED_GROUPS_PERMISSIONS,
3711 GroupModelImpl.MAPPING_TABLE_GROUPS_PERMISSIONS_NAME,
3712 "getPermissions",
3713 new String[] {
3714 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
3715 "com.liferay.portal.kernel.util.OrderByComparator"
3716 });
3717
3718
3732 public List<com.liferay.portal.model.Permission> getPermissions(long pk,
3733 int start, int end, OrderByComparator orderByComparator)
3734 throws SystemException {
3735 Object[] finderArgs = new Object[] {
3736 pk, String.valueOf(start), String.valueOf(end),
3737 String.valueOf(orderByComparator)
3738 };
3739
3740 List<com.liferay.portal.model.Permission> list = (List<com.liferay.portal.model.Permission>)FinderCacheUtil.getResult(FINDER_PATH_GET_PERMISSIONS,
3741 finderArgs, this);
3742
3743 if (list == null) {
3744 Session session = null;
3745
3746 try {
3747 session = openSession();
3748
3749 String sql = null;
3750
3751 if (orderByComparator != null) {
3752 sql = _SQL_GETPERMISSIONS.concat(ORDER_BY_CLAUSE)
3753 .concat(orderByComparator.getOrderBy());
3754 }
3755 else {
3756 sql = _SQL_GETPERMISSIONS;
3757 }
3758
3759 SQLQuery q = session.createSQLQuery(sql);
3760
3761 q.addEntity("Permission_",
3762 com.liferay.portal.model.impl.PermissionImpl.class);
3763
3764 QueryPos qPos = QueryPos.getInstance(q);
3765
3766 qPos.add(pk);
3767
3768 list = (List<com.liferay.portal.model.Permission>)QueryUtil.list(q,
3769 getDialect(), start, end);
3770 }
3771 catch (Exception e) {
3772 throw processException(e);
3773 }
3774 finally {
3775 if (list == null) {
3776 list = new ArrayList<com.liferay.portal.model.Permission>();
3777 }
3778
3779 permissionPersistence.cacheResult(list);
3780
3781 FinderCacheUtil.putResult(FINDER_PATH_GET_PERMISSIONS,
3782 finderArgs, list);
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 list = new ArrayList<com.liferay.portal.model.Role>();
4249 }
4250
4251 rolePersistence.cacheResult(list);
4252
4253 FinderCacheUtil.putResult(FINDER_PATH_GET_ROLES, finderArgs,
4254 list);
4255
4256 closeSession(session);
4257 }
4258 }
4259
4260 return list;
4261 }
4262
4263 public static final FinderPath FINDER_PATH_GET_ROLES_SIZE = new FinderPath(com.liferay.portal.model.impl.RoleModelImpl.ENTITY_CACHE_ENABLED,
4264 GroupModelImpl.FINDER_CACHE_ENABLED_GROUPS_ROLES,
4265 GroupModelImpl.MAPPING_TABLE_GROUPS_ROLES_NAME, "getRolesSize",
4266 new String[] { Long.class.getName() });
4267
4268
4275 public int getRolesSize(long pk) throws SystemException {
4276 Object[] finderArgs = new Object[] { pk };
4277
4278 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_ROLES_SIZE,
4279 finderArgs, this);
4280
4281 if (count == null) {
4282 Session session = null;
4283
4284 try {
4285 session = openSession();
4286
4287 SQLQuery q = session.createSQLQuery(_SQL_GETROLESSIZE);
4288
4289 q.addScalar(COUNT_COLUMN_NAME,
4290 com.liferay.portal.kernel.dao.orm.Type.LONG);
4291
4292 QueryPos qPos = QueryPos.getInstance(q);
4293
4294 qPos.add(pk);
4295
4296 count = (Long)q.uniqueResult();
4297 }
4298 catch (Exception e) {
4299 throw processException(e);
4300 }
4301 finally {
4302 if (count == null) {
4303 count = Long.valueOf(0);
4304 }
4305
4306 FinderCacheUtil.putResult(FINDER_PATH_GET_ROLES_SIZE,
4307 finderArgs, count);
4308
4309 closeSession(session);
4310 }
4311 }
4312
4313 return count.intValue();
4314 }
4315
4316 public static final FinderPath FINDER_PATH_CONTAINS_ROLE = new FinderPath(com.liferay.portal.model.impl.RoleModelImpl.ENTITY_CACHE_ENABLED,
4317 GroupModelImpl.FINDER_CACHE_ENABLED_GROUPS_ROLES,
4318 GroupModelImpl.MAPPING_TABLE_GROUPS_ROLES_NAME, "containsRole",
4319 new String[] { Long.class.getName(), Long.class.getName() });
4320
4321
4329 public boolean containsRole(long pk, long rolePK) throws SystemException {
4330 Object[] finderArgs = new Object[] { pk, rolePK };
4331
4332 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_ROLE,
4333 finderArgs, this);
4334
4335 if (value == null) {
4336 try {
4337 value = Boolean.valueOf(containsRole.contains(pk, rolePK));
4338 }
4339 catch (Exception e) {
4340 throw processException(e);
4341 }
4342 finally {
4343 if (value == null) {
4344 value = Boolean.FALSE;
4345 }
4346
4347 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_ROLE,
4348 finderArgs, value);
4349 }
4350 }
4351
4352 return value.booleanValue();
4353 }
4354
4355
4362 public boolean containsRoles(long pk) throws SystemException {
4363 if (getRolesSize(pk) > 0) {
4364 return true;
4365 }
4366 else {
4367 return false;
4368 }
4369 }
4370
4371
4378 public void addRole(long pk, long rolePK) throws SystemException {
4379 try {
4380 addRole.add(pk, rolePK);
4381 }
4382 catch (Exception e) {
4383 throw processException(e);
4384 }
4385 finally {
4386 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ROLES_NAME);
4387 }
4388 }
4389
4390
4397 public void addRole(long pk, com.liferay.portal.model.Role role)
4398 throws SystemException {
4399 try {
4400 addRole.add(pk, role.getPrimaryKey());
4401 }
4402 catch (Exception e) {
4403 throw processException(e);
4404 }
4405 finally {
4406 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ROLES_NAME);
4407 }
4408 }
4409
4410
4417 public void addRoles(long pk, long[] rolePKs) throws SystemException {
4418 try {
4419 for (long rolePK : rolePKs) {
4420 addRole.add(pk, rolePK);
4421 }
4422 }
4423 catch (Exception e) {
4424 throw processException(e);
4425 }
4426 finally {
4427 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ROLES_NAME);
4428 }
4429 }
4430
4431
4438 public void addRoles(long pk, List<com.liferay.portal.model.Role> roles)
4439 throws SystemException {
4440 try {
4441 for (com.liferay.portal.model.Role role : roles) {
4442 addRole.add(pk, role.getPrimaryKey());
4443 }
4444 }
4445 catch (Exception e) {
4446 throw processException(e);
4447 }
4448 finally {
4449 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ROLES_NAME);
4450 }
4451 }
4452
4453
4459 public void clearRoles(long pk) throws SystemException {
4460 try {
4461 clearRoles.clear(pk);
4462 }
4463 catch (Exception e) {
4464 throw processException(e);
4465 }
4466 finally {
4467 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ROLES_NAME);
4468 }
4469 }
4470
4471
4478 public void removeRole(long pk, long rolePK) throws SystemException {
4479 try {
4480 removeRole.remove(pk, rolePK);
4481 }
4482 catch (Exception e) {
4483 throw processException(e);
4484 }
4485 finally {
4486 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ROLES_NAME);
4487 }
4488 }
4489
4490
4497 public void removeRole(long pk, com.liferay.portal.model.Role role)
4498 throws SystemException {
4499 try {
4500 removeRole.remove(pk, role.getPrimaryKey());
4501 }
4502 catch (Exception e) {
4503 throw processException(e);
4504 }
4505 finally {
4506 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ROLES_NAME);
4507 }
4508 }
4509
4510
4517 public void removeRoles(long pk, long[] rolePKs) throws SystemException {
4518 try {
4519 for (long rolePK : rolePKs) {
4520 removeRole.remove(pk, rolePK);
4521 }
4522 }
4523 catch (Exception e) {
4524 throw processException(e);
4525 }
4526 finally {
4527 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ROLES_NAME);
4528 }
4529 }
4530
4531
4538 public void removeRoles(long pk, List<com.liferay.portal.model.Role> roles)
4539 throws SystemException {
4540 try {
4541 for (com.liferay.portal.model.Role role : roles) {
4542 removeRole.remove(pk, role.getPrimaryKey());
4543 }
4544 }
4545 catch (Exception e) {
4546 throw processException(e);
4547 }
4548 finally {
4549 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ROLES_NAME);
4550 }
4551 }
4552
4553
4560 public void setRoles(long pk, long[] rolePKs) throws SystemException {
4561 try {
4562 Set<Long> rolePKSet = SetUtil.fromArray(rolePKs);
4563
4564 List<com.liferay.portal.model.Role> roles = getRoles(pk);
4565
4566 for (com.liferay.portal.model.Role role : roles) {
4567 if (!rolePKSet.remove(role.getPrimaryKey())) {
4568 removeRole.remove(pk, role.getPrimaryKey());
4569 }
4570 }
4571
4572 for (Long rolePK : rolePKSet) {
4573 addRole.add(pk, rolePK);
4574 }
4575 }
4576 catch (Exception e) {
4577 throw processException(e);
4578 }
4579 finally {
4580 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ROLES_NAME);
4581 }
4582 }
4583
4584
4591 public void setRoles(long pk, List<com.liferay.portal.model.Role> roles)
4592 throws SystemException {
4593 try {
4594 long[] rolePKs = new long[roles.size()];
4595
4596 for (int i = 0; i < roles.size(); i++) {
4597 com.liferay.portal.model.Role role = roles.get(i);
4598
4599 rolePKs[i] = role.getPrimaryKey();
4600 }
4601
4602 setRoles(pk, rolePKs);
4603 }
4604 catch (Exception e) {
4605 throw processException(e);
4606 }
4607 finally {
4608 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_ROLES_NAME);
4609 }
4610 }
4611
4612
4619 public List<com.liferay.portal.model.UserGroup> getUserGroups(long pk)
4620 throws SystemException {
4621 return getUserGroups(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
4622 }
4623
4624
4637 public List<com.liferay.portal.model.UserGroup> getUserGroups(long pk,
4638 int start, int end) throws SystemException {
4639 return getUserGroups(pk, start, end, null);
4640 }
4641
4642 public static final FinderPath FINDER_PATH_GET_USERGROUPS = new FinderPath(com.liferay.portal.model.impl.UserGroupModelImpl.ENTITY_CACHE_ENABLED,
4643 GroupModelImpl.FINDER_CACHE_ENABLED_GROUPS_USERGROUPS,
4644 GroupModelImpl.MAPPING_TABLE_GROUPS_USERGROUPS_NAME,
4645 "getUserGroups",
4646 new String[] {
4647 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
4648 "com.liferay.portal.kernel.util.OrderByComparator"
4649 });
4650
4651
4665 public List<com.liferay.portal.model.UserGroup> getUserGroups(long pk,
4666 int start, int end, OrderByComparator orderByComparator)
4667 throws SystemException {
4668 Object[] finderArgs = new Object[] {
4669 pk, String.valueOf(start), String.valueOf(end),
4670 String.valueOf(orderByComparator)
4671 };
4672
4673 List<com.liferay.portal.model.UserGroup> list = (List<com.liferay.portal.model.UserGroup>)FinderCacheUtil.getResult(FINDER_PATH_GET_USERGROUPS,
4674 finderArgs, this);
4675
4676 if (list == null) {
4677 Session session = null;
4678
4679 try {
4680 session = openSession();
4681
4682 String sql = null;
4683
4684 if (orderByComparator != null) {
4685 sql = _SQL_GETUSERGROUPS.concat(ORDER_BY_CLAUSE)
4686 .concat(orderByComparator.getOrderBy());
4687 }
4688 else {
4689 sql = _SQL_GETUSERGROUPS.concat(com.liferay.portal.model.impl.UserGroupModelImpl.ORDER_BY_SQL);
4690 }
4691
4692 SQLQuery q = session.createSQLQuery(sql);
4693
4694 q.addEntity("UserGroup",
4695 com.liferay.portal.model.impl.UserGroupImpl.class);
4696
4697 QueryPos qPos = QueryPos.getInstance(q);
4698
4699 qPos.add(pk);
4700
4701 list = (List<com.liferay.portal.model.UserGroup>)QueryUtil.list(q,
4702 getDialect(), start, end);
4703 }
4704 catch (Exception e) {
4705 throw processException(e);
4706 }
4707 finally {
4708 if (list == null) {
4709 list = new ArrayList<com.liferay.portal.model.UserGroup>();
4710 }
4711
4712 userGroupPersistence.cacheResult(list);
4713
4714 FinderCacheUtil.putResult(FINDER_PATH_GET_USERGROUPS,
4715 finderArgs, list);
4716
4717 closeSession(session);
4718 }
4719 }
4720
4721 return list;
4722 }
4723
4724 public static final FinderPath FINDER_PATH_GET_USERGROUPS_SIZE = new FinderPath(com.liferay.portal.model.impl.UserGroupModelImpl.ENTITY_CACHE_ENABLED,
4725 GroupModelImpl.FINDER_CACHE_ENABLED_GROUPS_USERGROUPS,
4726 GroupModelImpl.MAPPING_TABLE_GROUPS_USERGROUPS_NAME,
4727 "getUserGroupsSize", new String[] { Long.class.getName() });
4728
4729
4736 public int getUserGroupsSize(long pk) throws SystemException {
4737 Object[] finderArgs = new Object[] { pk };
4738
4739 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_USERGROUPS_SIZE,
4740 finderArgs, this);
4741
4742 if (count == null) {
4743 Session session = null;
4744
4745 try {
4746 session = openSession();
4747
4748 SQLQuery q = session.createSQLQuery(_SQL_GETUSERGROUPSSIZE);
4749
4750 q.addScalar(COUNT_COLUMN_NAME,
4751 com.liferay.portal.kernel.dao.orm.Type.LONG);
4752
4753 QueryPos qPos = QueryPos.getInstance(q);
4754
4755 qPos.add(pk);
4756
4757 count = (Long)q.uniqueResult();
4758 }
4759 catch (Exception e) {
4760 throw processException(e);
4761 }
4762 finally {
4763 if (count == null) {
4764 count = Long.valueOf(0);
4765 }
4766
4767 FinderCacheUtil.putResult(FINDER_PATH_GET_USERGROUPS_SIZE,
4768 finderArgs, count);
4769
4770 closeSession(session);
4771 }
4772 }
4773
4774 return count.intValue();
4775 }
4776
4777 public static final FinderPath FINDER_PATH_CONTAINS_USERGROUP = new FinderPath(com.liferay.portal.model.impl.UserGroupModelImpl.ENTITY_CACHE_ENABLED,
4778 GroupModelImpl.FINDER_CACHE_ENABLED_GROUPS_USERGROUPS,
4779 GroupModelImpl.MAPPING_TABLE_GROUPS_USERGROUPS_NAME,
4780 "containsUserGroup",
4781 new String[] { Long.class.getName(), Long.class.getName() });
4782
4783
4791 public boolean containsUserGroup(long pk, long userGroupPK)
4792 throws SystemException {
4793 Object[] finderArgs = new Object[] { pk, userGroupPK };
4794
4795 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_USERGROUP,
4796 finderArgs, this);
4797
4798 if (value == null) {
4799 try {
4800 value = Boolean.valueOf(containsUserGroup.contains(pk,
4801 userGroupPK));
4802 }
4803 catch (Exception e) {
4804 throw processException(e);
4805 }
4806 finally {
4807 if (value == null) {
4808 value = Boolean.FALSE;
4809 }
4810
4811 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_USERGROUP,
4812 finderArgs, value);
4813 }
4814 }
4815
4816 return value.booleanValue();
4817 }
4818
4819
4826 public boolean containsUserGroups(long pk) throws SystemException {
4827 if (getUserGroupsSize(pk) > 0) {
4828 return true;
4829 }
4830 else {
4831 return false;
4832 }
4833 }
4834
4835
4842 public void addUserGroup(long pk, long userGroupPK)
4843 throws SystemException {
4844 try {
4845 addUserGroup.add(pk, userGroupPK);
4846 }
4847 catch (Exception e) {
4848 throw processException(e);
4849 }
4850 finally {
4851 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_USERGROUPS_NAME);
4852 }
4853 }
4854
4855
4862 public void addUserGroup(long pk,
4863 com.liferay.portal.model.UserGroup userGroup) throws SystemException {
4864 try {
4865 addUserGroup.add(pk, userGroup.getPrimaryKey());
4866 }
4867 catch (Exception e) {
4868 throw processException(e);
4869 }
4870 finally {
4871 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_USERGROUPS_NAME);
4872 }
4873 }
4874
4875
4882 public void addUserGroups(long pk, long[] userGroupPKs)
4883 throws SystemException {
4884 try {
4885 for (long userGroupPK : userGroupPKs) {
4886 addUserGroup.add(pk, userGroupPK);
4887 }
4888 }
4889 catch (Exception e) {
4890 throw processException(e);
4891 }
4892 finally {
4893 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_USERGROUPS_NAME);
4894 }
4895 }
4896
4897
4904 public void addUserGroups(long pk,
4905 List<com.liferay.portal.model.UserGroup> userGroups)
4906 throws SystemException {
4907 try {
4908 for (com.liferay.portal.model.UserGroup userGroup : userGroups) {
4909 addUserGroup.add(pk, userGroup.getPrimaryKey());
4910 }
4911 }
4912 catch (Exception e) {
4913 throw processException(e);
4914 }
4915 finally {
4916 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_USERGROUPS_NAME);
4917 }
4918 }
4919
4920
4926 public void clearUserGroups(long pk) throws SystemException {
4927 try {
4928 clearUserGroups.clear(pk);
4929 }
4930 catch (Exception e) {
4931 throw processException(e);
4932 }
4933 finally {
4934 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_USERGROUPS_NAME);
4935 }
4936 }
4937
4938
4945 public void removeUserGroup(long pk, long userGroupPK)
4946 throws SystemException {
4947 try {
4948 removeUserGroup.remove(pk, userGroupPK);
4949 }
4950 catch (Exception e) {
4951 throw processException(e);
4952 }
4953 finally {
4954 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_USERGROUPS_NAME);
4955 }
4956 }
4957
4958
4965 public void removeUserGroup(long pk,
4966 com.liferay.portal.model.UserGroup userGroup) throws SystemException {
4967 try {
4968 removeUserGroup.remove(pk, userGroup.getPrimaryKey());
4969 }
4970 catch (Exception e) {
4971 throw processException(e);
4972 }
4973 finally {
4974 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_USERGROUPS_NAME);
4975 }
4976 }
4977
4978
4985 public void removeUserGroups(long pk, long[] userGroupPKs)
4986 throws SystemException {
4987 try {
4988 for (long userGroupPK : userGroupPKs) {
4989 removeUserGroup.remove(pk, userGroupPK);
4990 }
4991 }
4992 catch (Exception e) {
4993 throw processException(e);
4994 }
4995 finally {
4996 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_USERGROUPS_NAME);
4997 }
4998 }
4999
5000
5007 public void removeUserGroups(long pk,
5008 List<com.liferay.portal.model.UserGroup> userGroups)
5009 throws SystemException {
5010 try {
5011 for (com.liferay.portal.model.UserGroup userGroup : userGroups) {
5012 removeUserGroup.remove(pk, userGroup.getPrimaryKey());
5013 }
5014 }
5015 catch (Exception e) {
5016 throw processException(e);
5017 }
5018 finally {
5019 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_USERGROUPS_NAME);
5020 }
5021 }
5022
5023
5030 public void setUserGroups(long pk, long[] userGroupPKs)
5031 throws SystemException {
5032 try {
5033 Set<Long> userGroupPKSet = SetUtil.fromArray(userGroupPKs);
5034
5035 List<com.liferay.portal.model.UserGroup> userGroups = getUserGroups(pk);
5036
5037 for (com.liferay.portal.model.UserGroup userGroup : userGroups) {
5038 if (!userGroupPKSet.remove(userGroup.getPrimaryKey())) {
5039 removeUserGroup.remove(pk, userGroup.getPrimaryKey());
5040 }
5041 }
5042
5043 for (Long userGroupPK : userGroupPKSet) {
5044 addUserGroup.add(pk, userGroupPK);
5045 }
5046 }
5047 catch (Exception e) {
5048 throw processException(e);
5049 }
5050 finally {
5051 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_USERGROUPS_NAME);
5052 }
5053 }
5054
5055
5062 public void setUserGroups(long pk,
5063 List<com.liferay.portal.model.UserGroup> userGroups)
5064 throws SystemException {
5065 try {
5066 long[] userGroupPKs = new long[userGroups.size()];
5067
5068 for (int i = 0; i < userGroups.size(); i++) {
5069 com.liferay.portal.model.UserGroup userGroup = userGroups.get(i);
5070
5071 userGroupPKs[i] = userGroup.getPrimaryKey();
5072 }
5073
5074 setUserGroups(pk, userGroupPKs);
5075 }
5076 catch (Exception e) {
5077 throw processException(e);
5078 }
5079 finally {
5080 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_GROUPS_USERGROUPS_NAME);
5081 }
5082 }
5083
5084
5091 public List<com.liferay.portal.model.User> getUsers(long pk)
5092 throws SystemException {
5093 return getUsers(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
5094 }
5095
5096
5109 public List<com.liferay.portal.model.User> getUsers(long pk, int start,
5110 int end) throws SystemException {
5111 return getUsers(pk, start, end, null);
5112 }
5113
5114 public static final FinderPath FINDER_PATH_GET_USERS = new FinderPath(com.liferay.portal.model.impl.UserModelImpl.ENTITY_CACHE_ENABLED,
5115 GroupModelImpl.FINDER_CACHE_ENABLED_USERS_GROUPS,
5116 GroupModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME, "getUsers",
5117 new String[] {
5118 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
5119 "com.liferay.portal.kernel.util.OrderByComparator"
5120 });
5121
5122
5136 public List<com.liferay.portal.model.User> getUsers(long pk, int start,
5137 int end, OrderByComparator orderByComparator) throws SystemException {
5138 Object[] finderArgs = new Object[] {
5139 pk, String.valueOf(start), String.valueOf(end),
5140 String.valueOf(orderByComparator)
5141 };
5142
5143 List<com.liferay.portal.model.User> list = (List<com.liferay.portal.model.User>)FinderCacheUtil.getResult(FINDER_PATH_GET_USERS,
5144 finderArgs, this);
5145
5146 if (list == null) {
5147 Session session = null;
5148
5149 try {
5150 session = openSession();
5151
5152 String sql = null;
5153
5154 if (orderByComparator != null) {
5155 sql = _SQL_GETUSERS.concat(ORDER_BY_CLAUSE)
5156 .concat(orderByComparator.getOrderBy());
5157 }
5158 else {
5159 sql = _SQL_GETUSERS;
5160 }
5161
5162 SQLQuery q = session.createSQLQuery(sql);
5163
5164 q.addEntity("User_",
5165 com.liferay.portal.model.impl.UserImpl.class);
5166
5167 QueryPos qPos = QueryPos.getInstance(q);
5168
5169 qPos.add(pk);
5170
5171 list = (List<com.liferay.portal.model.User>)QueryUtil.list(q,
5172 getDialect(), start, end);
5173 }
5174 catch (Exception e) {
5175 throw processException(e);
5176 }
5177 finally {
5178 if (list == null) {
5179 list = new ArrayList<com.liferay.portal.model.User>();
5180 }
5181
5182 userPersistence.cacheResult(list);
5183
5184 FinderCacheUtil.putResult(FINDER_PATH_GET_USERS, finderArgs,
5185 list);
5186
5187 closeSession(session);
5188 }
5189 }
5190
5191 return list;
5192 }
5193
5194 public static final FinderPath FINDER_PATH_GET_USERS_SIZE = new FinderPath(com.liferay.portal.model.impl.UserModelImpl.ENTITY_CACHE_ENABLED,
5195 GroupModelImpl.FINDER_CACHE_ENABLED_USERS_GROUPS,
5196 GroupModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME, "getUsersSize",
5197 new String[] { Long.class.getName() });
5198
5199
5206 public int getUsersSize(long pk) throws SystemException {
5207 Object[] finderArgs = new Object[] { pk };
5208
5209 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_USERS_SIZE,
5210 finderArgs, this);
5211
5212 if (count == null) {
5213 Session session = null;
5214
5215 try {
5216 session = openSession();
5217
5218 SQLQuery q = session.createSQLQuery(_SQL_GETUSERSSIZE);
5219
5220 q.addScalar(COUNT_COLUMN_NAME,
5221 com.liferay.portal.kernel.dao.orm.Type.LONG);
5222
5223 QueryPos qPos = QueryPos.getInstance(q);
5224
5225 qPos.add(pk);
5226
5227 count = (Long)q.uniqueResult();
5228 }
5229 catch (Exception e) {
5230 throw processException(e);
5231 }
5232 finally {
5233 if (count == null) {
5234 count = Long.valueOf(0);
5235 }
5236
5237 FinderCacheUtil.putResult(FINDER_PATH_GET_USERS_SIZE,
5238 finderArgs, count);
5239
5240 closeSession(session);
5241 }
5242 }
5243
5244 return count.intValue();
5245 }
5246
5247 public static final FinderPath FINDER_PATH_CONTAINS_USER = new FinderPath(com.liferay.portal.model.impl.UserModelImpl.ENTITY_CACHE_ENABLED,
5248 GroupModelImpl.FINDER_CACHE_ENABLED_USERS_GROUPS,
5249 GroupModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME, "containsUser",
5250 new String[] { Long.class.getName(), Long.class.getName() });
5251
5252
5260 public boolean containsUser(long pk, long userPK) throws SystemException {
5261 Object[] finderArgs = new Object[] { pk, userPK };
5262
5263 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_USER,
5264 finderArgs, this);
5265
5266 if (value == null) {
5267 try {
5268 value = Boolean.valueOf(containsUser.contains(pk, userPK));
5269 }
5270 catch (Exception e) {
5271 throw processException(e);
5272 }
5273 finally {
5274 if (value == null) {
5275 value = Boolean.FALSE;
5276 }
5277
5278 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_USER,
5279 finderArgs, value);
5280 }
5281 }
5282
5283 return value.booleanValue();
5284 }
5285
5286
5293 public boolean containsUsers(long pk) throws SystemException {
5294 if (getUsersSize(pk) > 0) {
5295 return true;
5296 }
5297 else {
5298 return false;
5299 }
5300 }
5301
5302
5309 public void addUser(long pk, long userPK) throws SystemException {
5310 try {
5311 addUser.add(pk, userPK);
5312 }
5313 catch (Exception e) {
5314 throw processException(e);
5315 }
5316 finally {
5317 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
5318 }
5319 }
5320
5321
5328 public void addUser(long pk, com.liferay.portal.model.User user)
5329 throws SystemException {
5330 try {
5331 addUser.add(pk, user.getPrimaryKey());
5332 }
5333 catch (Exception e) {
5334 throw processException(e);
5335 }
5336 finally {
5337 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
5338 }
5339 }
5340
5341
5348 public void addUsers(long pk, long[] userPKs) throws SystemException {
5349 try {
5350 for (long userPK : userPKs) {
5351 addUser.add(pk, userPK);
5352 }
5353 }
5354 catch (Exception e) {
5355 throw processException(e);
5356 }
5357 finally {
5358 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
5359 }
5360 }
5361
5362
5369 public void addUsers(long pk, List<com.liferay.portal.model.User> users)
5370 throws SystemException {
5371 try {
5372 for (com.liferay.portal.model.User user : users) {
5373 addUser.add(pk, user.getPrimaryKey());
5374 }
5375 }
5376 catch (Exception e) {
5377 throw processException(e);
5378 }
5379 finally {
5380 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
5381 }
5382 }
5383
5384
5390 public void clearUsers(long pk) throws SystemException {
5391 try {
5392 clearUsers.clear(pk);
5393 }
5394 catch (Exception e) {
5395 throw processException(e);
5396 }
5397 finally {
5398 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
5399 }
5400 }
5401
5402
5409 public void removeUser(long pk, long userPK) throws SystemException {
5410 try {
5411 removeUser.remove(pk, userPK);
5412 }
5413 catch (Exception e) {
5414 throw processException(e);
5415 }
5416 finally {
5417 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
5418 }
5419 }
5420
5421
5428 public void removeUser(long pk, com.liferay.portal.model.User user)
5429 throws SystemException {
5430 try {
5431 removeUser.remove(pk, user.getPrimaryKey());
5432 }
5433 catch (Exception e) {
5434 throw processException(e);
5435 }
5436 finally {
5437 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
5438 }
5439 }
5440
5441
5448 public void removeUsers(long pk, long[] userPKs) throws SystemException {
5449 try {
5450 for (long userPK : userPKs) {
5451 removeUser.remove(pk, userPK);
5452 }
5453 }
5454 catch (Exception e) {
5455 throw processException(e);
5456 }
5457 finally {
5458 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
5459 }
5460 }
5461
5462
5469 public void removeUsers(long pk, List<com.liferay.portal.model.User> users)
5470 throws SystemException {
5471 try {
5472 for (com.liferay.portal.model.User user : users) {
5473 removeUser.remove(pk, user.getPrimaryKey());
5474 }
5475 }
5476 catch (Exception e) {
5477 throw processException(e);
5478 }
5479 finally {
5480 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
5481 }
5482 }
5483
5484
5491 public void setUsers(long pk, long[] userPKs) throws SystemException {
5492 try {
5493 Set<Long> userPKSet = SetUtil.fromArray(userPKs);
5494
5495 List<com.liferay.portal.model.User> users = getUsers(pk);
5496
5497 for (com.liferay.portal.model.User user : users) {
5498 if (!userPKSet.remove(user.getPrimaryKey())) {
5499 removeUser.remove(pk, user.getPrimaryKey());
5500 }
5501 }
5502
5503 for (Long userPK : userPKSet) {
5504 addUser.add(pk, userPK);
5505 }
5506 }
5507 catch (Exception e) {
5508 throw processException(e);
5509 }
5510 finally {
5511 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
5512 }
5513 }
5514
5515
5522 public void setUsers(long pk, List<com.liferay.portal.model.User> users)
5523 throws SystemException {
5524 try {
5525 long[] userPKs = new long[users.size()];
5526
5527 for (int i = 0; i < users.size(); i++) {
5528 com.liferay.portal.model.User user = users.get(i);
5529
5530 userPKs[i] = user.getPrimaryKey();
5531 }
5532
5533 setUsers(pk, userPKs);
5534 }
5535 catch (Exception e) {
5536 throw processException(e);
5537 }
5538 finally {
5539 FinderCacheUtil.clearCache(GroupModelImpl.MAPPING_TABLE_USERS_GROUPS_NAME);
5540 }
5541 }
5542
5543
5546 public void afterPropertiesSet() {
5547 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
5548 com.liferay.portal.util.PropsUtil.get(
5549 "value.object.listener.com.liferay.portal.model.Group")));
5550
5551 if (listenerClassNames.length > 0) {
5552 try {
5553 List<ModelListener<Group>> listenersList = new ArrayList<ModelListener<Group>>();
5554
5555 for (String listenerClassName : listenerClassNames) {
5556 listenersList.add((ModelListener<Group>)InstanceFactory.newInstance(
5557 listenerClassName));
5558 }
5559
5560 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
5561 }
5562 catch (Exception e) {
5563 _log.error(e);
5564 }
5565 }
5566
5567 containsOrganization = new ContainsOrganization(this);
5568
5569 addOrganization = new AddOrganization(this);
5570 clearOrganizations = new ClearOrganizations(this);
5571 removeOrganization = new RemoveOrganization(this);
5572
5573 containsPermission = new ContainsPermission(this);
5574
5575 addPermission = new AddPermission(this);
5576 clearPermissions = new ClearPermissions(this);
5577 removePermission = new RemovePermission(this);
5578
5579 containsRole = new ContainsRole(this);
5580
5581 addRole = new AddRole(this);
5582 clearRoles = new ClearRoles(this);
5583 removeRole = new RemoveRole(this);
5584
5585 containsUserGroup = new ContainsUserGroup(this);
5586
5587 addUserGroup = new AddUserGroup(this);
5588 clearUserGroups = new ClearUserGroups(this);
5589 removeUserGroup = new RemoveUserGroup(this);
5590
5591 containsUser = new ContainsUser(this);
5592
5593 addUser = new AddUser(this);
5594 clearUsers = new ClearUsers(this);
5595 removeUser = new RemoveUser(this);
5596 }
5597
5598 @BeanReference(type = AccountPersistence.class)
5599 protected AccountPersistence accountPersistence;
5600 @BeanReference(type = AddressPersistence.class)
5601 protected AddressPersistence addressPersistence;
5602 @BeanReference(type = BrowserTrackerPersistence.class)
5603 protected BrowserTrackerPersistence browserTrackerPersistence;
5604 @BeanReference(type = ClassNamePersistence.class)
5605 protected ClassNamePersistence classNamePersistence;
5606 @BeanReference(type = ClusterGroupPersistence.class)
5607 protected ClusterGroupPersistence clusterGroupPersistence;
5608 @BeanReference(type = CompanyPersistence.class)
5609 protected CompanyPersistence companyPersistence;
5610 @BeanReference(type = ContactPersistence.class)
5611 protected ContactPersistence contactPersistence;
5612 @BeanReference(type = CountryPersistence.class)
5613 protected CountryPersistence countryPersistence;
5614 @BeanReference(type = EmailAddressPersistence.class)
5615 protected EmailAddressPersistence emailAddressPersistence;
5616 @BeanReference(type = GroupPersistence.class)
5617 protected GroupPersistence groupPersistence;
5618 @BeanReference(type = ImagePersistence.class)
5619 protected ImagePersistence imagePersistence;
5620 @BeanReference(type = LayoutPersistence.class)
5621 protected LayoutPersistence layoutPersistence;
5622 @BeanReference(type = LayoutPrototypePersistence.class)
5623 protected LayoutPrototypePersistence layoutPrototypePersistence;
5624 @BeanReference(type = LayoutSetPersistence.class)
5625 protected LayoutSetPersistence layoutSetPersistence;
5626 @BeanReference(type = LayoutSetPrototypePersistence.class)
5627 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
5628 @BeanReference(type = ListTypePersistence.class)
5629 protected ListTypePersistence listTypePersistence;
5630 @BeanReference(type = LockPersistence.class)
5631 protected LockPersistence lockPersistence;
5632 @BeanReference(type = MembershipRequestPersistence.class)
5633 protected MembershipRequestPersistence membershipRequestPersistence;
5634 @BeanReference(type = OrganizationPersistence.class)
5635 protected OrganizationPersistence organizationPersistence;
5636 @BeanReference(type = OrgGroupPermissionPersistence.class)
5637 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
5638 @BeanReference(type = OrgGroupRolePersistence.class)
5639 protected OrgGroupRolePersistence orgGroupRolePersistence;
5640 @BeanReference(type = OrgLaborPersistence.class)
5641 protected OrgLaborPersistence orgLaborPersistence;
5642 @BeanReference(type = PasswordPolicyPersistence.class)
5643 protected PasswordPolicyPersistence passwordPolicyPersistence;
5644 @BeanReference(type = PasswordPolicyRelPersistence.class)
5645 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
5646 @BeanReference(type = PasswordTrackerPersistence.class)
5647 protected PasswordTrackerPersistence passwordTrackerPersistence;
5648 @BeanReference(type = PermissionPersistence.class)
5649 protected PermissionPersistence permissionPersistence;
5650 @BeanReference(type = PhonePersistence.class)
5651 protected PhonePersistence phonePersistence;
5652 @BeanReference(type = PluginSettingPersistence.class)
5653 protected PluginSettingPersistence pluginSettingPersistence;
5654 @BeanReference(type = PortletPersistence.class)
5655 protected PortletPersistence portletPersistence;
5656 @BeanReference(type = PortletItemPersistence.class)
5657 protected PortletItemPersistence portletItemPersistence;
5658 @BeanReference(type = PortletPreferencesPersistence.class)
5659 protected PortletPreferencesPersistence portletPreferencesPersistence;
5660 @BeanReference(type = RegionPersistence.class)
5661 protected RegionPersistence regionPersistence;
5662 @BeanReference(type = ReleasePersistence.class)
5663 protected ReleasePersistence releasePersistence;
5664 @BeanReference(type = ResourcePersistence.class)
5665 protected ResourcePersistence resourcePersistence;
5666 @BeanReference(type = ResourceActionPersistence.class)
5667 protected ResourceActionPersistence resourceActionPersistence;
5668 @BeanReference(type = ResourceCodePersistence.class)
5669 protected ResourceCodePersistence resourceCodePersistence;
5670 @BeanReference(type = ResourcePermissionPersistence.class)
5671 protected ResourcePermissionPersistence resourcePermissionPersistence;
5672 @BeanReference(type = RolePersistence.class)
5673 protected RolePersistence rolePersistence;
5674 @BeanReference(type = ServiceComponentPersistence.class)
5675 protected ServiceComponentPersistence serviceComponentPersistence;
5676 @BeanReference(type = ShardPersistence.class)
5677 protected ShardPersistence shardPersistence;
5678 @BeanReference(type = SubscriptionPersistence.class)
5679 protected SubscriptionPersistence subscriptionPersistence;
5680 @BeanReference(type = TicketPersistence.class)
5681 protected TicketPersistence ticketPersistence;
5682 @BeanReference(type = TeamPersistence.class)
5683 protected TeamPersistence teamPersistence;
5684 @BeanReference(type = UserPersistence.class)
5685 protected UserPersistence userPersistence;
5686 @BeanReference(type = UserGroupPersistence.class)
5687 protected UserGroupPersistence userGroupPersistence;
5688 @BeanReference(type = UserGroupGroupRolePersistence.class)
5689 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
5690 @BeanReference(type = UserGroupRolePersistence.class)
5691 protected UserGroupRolePersistence userGroupRolePersistence;
5692 @BeanReference(type = UserIdMapperPersistence.class)
5693 protected UserIdMapperPersistence userIdMapperPersistence;
5694 @BeanReference(type = UserTrackerPersistence.class)
5695 protected UserTrackerPersistence userTrackerPersistence;
5696 @BeanReference(type = UserTrackerPathPersistence.class)
5697 protected UserTrackerPathPersistence userTrackerPathPersistence;
5698 @BeanReference(type = WebDAVPropsPersistence.class)
5699 protected WebDAVPropsPersistence webDAVPropsPersistence;
5700 @BeanReference(type = WebsitePersistence.class)
5701 protected WebsitePersistence websitePersistence;
5702 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
5703 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
5704 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
5705 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
5706 @BeanReference(type = AssetEntryPersistence.class)
5707 protected AssetEntryPersistence assetEntryPersistence;
5708 @BeanReference(type = BlogsEntryPersistence.class)
5709 protected BlogsEntryPersistence blogsEntryPersistence;
5710 @BeanReference(type = BlogsStatsUserPersistence.class)
5711 protected BlogsStatsUserPersistence blogsStatsUserPersistence;
5712 @BeanReference(type = BookmarksFolderPersistence.class)
5713 protected BookmarksFolderPersistence bookmarksFolderPersistence;
5714 @BeanReference(type = CalEventPersistence.class)
5715 protected CalEventPersistence calEventPersistence;
5716 @BeanReference(type = DLFolderPersistence.class)
5717 protected DLFolderPersistence dlFolderPersistence;
5718 @BeanReference(type = IGFolderPersistence.class)
5719 protected IGFolderPersistence igFolderPersistence;
5720 @BeanReference(type = JournalArticlePersistence.class)
5721 protected JournalArticlePersistence journalArticlePersistence;
5722 @BeanReference(type = JournalStructurePersistence.class)
5723 protected JournalStructurePersistence journalStructurePersistence;
5724 @BeanReference(type = JournalTemplatePersistence.class)
5725 protected JournalTemplatePersistence journalTemplatePersistence;
5726 @BeanReference(type = MBBanPersistence.class)
5727 protected MBBanPersistence mbBanPersistence;
5728 @BeanReference(type = MBCategoryPersistence.class)
5729 protected MBCategoryPersistence mbCategoryPersistence;
5730 @BeanReference(type = MBStatsUserPersistence.class)
5731 protected MBStatsUserPersistence mbStatsUserPersistence;
5732 @BeanReference(type = PollsQuestionPersistence.class)
5733 protected PollsQuestionPersistence pollsQuestionPersistence;
5734 @BeanReference(type = ShoppingCartPersistence.class)
5735 protected ShoppingCartPersistence shoppingCartPersistence;
5736 @BeanReference(type = ShoppingCategoryPersistence.class)
5737 protected ShoppingCategoryPersistence shoppingCategoryPersistence;
5738 @BeanReference(type = ShoppingCouponPersistence.class)
5739 protected ShoppingCouponPersistence shoppingCouponPersistence;
5740 @BeanReference(type = ShoppingOrderPersistence.class)
5741 protected ShoppingOrderPersistence shoppingOrderPersistence;
5742 @BeanReference(type = SCFrameworkVersionPersistence.class)
5743 protected SCFrameworkVersionPersistence scFrameworkVersionPersistence;
5744 @BeanReference(type = SCProductEntryPersistence.class)
5745 protected SCProductEntryPersistence scProductEntryPersistence;
5746 @BeanReference(type = TasksProposalPersistence.class)
5747 protected TasksProposalPersistence tasksProposalPersistence;
5748 @BeanReference(type = WikiNodePersistence.class)
5749 protected WikiNodePersistence wikiNodePersistence;
5750 protected ContainsOrganization containsOrganization;
5751 protected AddOrganization addOrganization;
5752 protected ClearOrganizations clearOrganizations;
5753 protected RemoveOrganization removeOrganization;
5754 protected ContainsPermission containsPermission;
5755 protected AddPermission addPermission;
5756 protected ClearPermissions clearPermissions;
5757 protected RemovePermission removePermission;
5758 protected ContainsRole containsRole;
5759 protected AddRole addRole;
5760 protected ClearRoles clearRoles;
5761 protected RemoveRole removeRole;
5762 protected ContainsUserGroup containsUserGroup;
5763 protected AddUserGroup addUserGroup;
5764 protected ClearUserGroups clearUserGroups;
5765 protected RemoveUserGroup removeUserGroup;
5766 protected ContainsUser containsUser;
5767 protected AddUser addUser;
5768 protected ClearUsers clearUsers;
5769 protected RemoveUser removeUser;
5770
5771 protected class ContainsOrganization {
5772 protected ContainsOrganization(GroupPersistenceImpl persistenceImpl) {
5773 super();
5774
5775 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
5776 _SQL_CONTAINSORGANIZATION,
5777 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
5778 RowMapper.COUNT);
5779 }
5780
5781 protected boolean contains(long groupId, long organizationId) {
5782 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
5783 new Long(groupId), new Long(organizationId)
5784 });
5785
5786 if (results.size() > 0) {
5787 Integer count = results.get(0);
5788
5789 if (count.intValue() > 0) {
5790 return true;
5791 }
5792 }
5793
5794 return false;
5795 }
5796
5797 private MappingSqlQuery<Integer> _mappingSqlQuery;
5798 }
5799
5800 protected class AddOrganization {
5801 protected AddOrganization(GroupPersistenceImpl persistenceImpl) {
5802 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
5803 "INSERT INTO Groups_Orgs (groupId, organizationId) VALUES (?, ?)",
5804 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
5805 _persistenceImpl = persistenceImpl;
5806 }
5807
5808 protected void add(long groupId, long organizationId)
5809 throws SystemException {
5810 if (!_persistenceImpl.containsOrganization.contains(groupId,
5811 organizationId)) {
5812 ModelListener<com.liferay.portal.model.Organization>[] organizationListeners =
5813 organizationPersistence.getListeners();
5814
5815 for (ModelListener<Group> listener : listeners) {
5816 listener.onBeforeAddAssociation(groupId,
5817 com.liferay.portal.model.Organization.class.getName(),
5818 organizationId);
5819 }
5820
5821 for (ModelListener<com.liferay.portal.model.Organization> listener : organizationListeners) {
5822 listener.onBeforeAddAssociation(organizationId,
5823 Group.class.getName(), groupId);
5824 }
5825
5826 _sqlUpdate.update(new Object[] {
5827 new Long(groupId), new Long(organizationId)
5828 });
5829
5830 for (ModelListener<Group> listener : listeners) {
5831 listener.onAfterAddAssociation(groupId,
5832 com.liferay.portal.model.Organization.class.getName(),
5833 organizationId);
5834 }
5835
5836 for (ModelListener<com.liferay.portal.model.Organization> listener : organizationListeners) {
5837 listener.onAfterAddAssociation(organizationId,
5838 Group.class.getName(), groupId);
5839 }
5840 }
5841 }
5842
5843 private SqlUpdate _sqlUpdate;
5844 private GroupPersistenceImpl _persistenceImpl;
5845 }
5846
5847 protected class ClearOrganizations {
5848 protected ClearOrganizations(GroupPersistenceImpl persistenceImpl) {
5849 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
5850 "DELETE FROM Groups_Orgs WHERE groupId = ?",
5851 new int[] { java.sql.Types.BIGINT });
5852 }
5853
5854 protected void clear(long groupId) throws SystemException {
5855 ModelListener<com.liferay.portal.model.Organization>[] organizationListeners =
5856 organizationPersistence.getListeners();
5857
5858 List<com.liferay.portal.model.Organization> organizations = null;
5859
5860 if ((listeners.length > 0) || (organizationListeners.length > 0)) {
5861 organizations = getOrganizations(groupId);
5862
5863 for (com.liferay.portal.model.Organization organization : organizations) {
5864 for (ModelListener<Group> listener : listeners) {
5865 listener.onBeforeRemoveAssociation(groupId,
5866 com.liferay.portal.model.Organization.class.getName(),
5867 organization.getPrimaryKey());
5868 }
5869
5870 for (ModelListener<com.liferay.portal.model.Organization> listener : organizationListeners) {
5871 listener.onBeforeRemoveAssociation(organization.getPrimaryKey(),
5872 Group.class.getName(), groupId);
5873 }
5874 }
5875 }
5876
5877 _sqlUpdate.update(new Object[] { new Long(groupId) });
5878
5879 if ((listeners.length > 0) || (organizationListeners.length > 0)) {
5880 for (com.liferay.portal.model.Organization organization : organizations) {
5881 for (ModelListener<Group> listener : listeners) {
5882 listener.onAfterRemoveAssociation(groupId,
5883 com.liferay.portal.model.Organization.class.getName(),
5884 organization.getPrimaryKey());
5885 }
5886
5887 for (ModelListener<com.liferay.portal.model.Organization> listener : organizationListeners) {
5888 listener.onAfterRemoveAssociation(organization.getPrimaryKey(),
5889 Group.class.getName(), groupId);
5890 }
5891 }
5892 }
5893 }
5894
5895 private SqlUpdate _sqlUpdate;
5896 }
5897
5898 protected class RemoveOrganization {
5899 protected RemoveOrganization(GroupPersistenceImpl persistenceImpl) {
5900 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
5901 "DELETE FROM Groups_Orgs WHERE groupId = ? AND organizationId = ?",
5902 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
5903 _persistenceImpl = persistenceImpl;
5904 }
5905
5906 protected void remove(long groupId, long organizationId)
5907 throws SystemException {
5908 if (_persistenceImpl.containsOrganization.contains(groupId,
5909 organizationId)) {
5910 ModelListener<com.liferay.portal.model.Organization>[] organizationListeners =
5911 organizationPersistence.getListeners();
5912
5913 for (ModelListener<Group> listener : listeners) {
5914 listener.onBeforeRemoveAssociation(groupId,
5915 com.liferay.portal.model.Organization.class.getName(),
5916 organizationId);
5917 }
5918
5919 for (ModelListener<com.liferay.portal.model.Organization> listener : organizationListeners) {
5920 listener.onBeforeRemoveAssociation(organizationId,
5921 Group.class.getName(), groupId);
5922 }
5923
5924 _sqlUpdate.update(new Object[] {
5925 new Long(groupId), new Long(organizationId)
5926 });
5927
5928 for (ModelListener<Group> listener : listeners) {
5929 listener.onAfterRemoveAssociation(groupId,
5930 com.liferay.portal.model.Organization.class.getName(),
5931 organizationId);
5932 }
5933
5934 for (ModelListener<com.liferay.portal.model.Organization> listener : organizationListeners) {
5935 listener.onAfterRemoveAssociation(organizationId,
5936 Group.class.getName(), groupId);
5937 }
5938 }
5939 }
5940
5941 private SqlUpdate _sqlUpdate;
5942 private GroupPersistenceImpl _persistenceImpl;
5943 }
5944
5945 protected class ContainsPermission {
5946 protected ContainsPermission(GroupPersistenceImpl persistenceImpl) {
5947 super();
5948
5949 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
5950 _SQL_CONTAINSPERMISSION,
5951 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
5952 RowMapper.COUNT);
5953 }
5954
5955 protected boolean contains(long groupId, long permissionId) {
5956 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
5957 new Long(groupId), new Long(permissionId)
5958 });
5959
5960 if (results.size() > 0) {
5961 Integer count = results.get(0);
5962
5963 if (count.intValue() > 0) {
5964 return true;
5965 }
5966 }
5967
5968 return false;
5969 }
5970
5971 private MappingSqlQuery<Integer> _mappingSqlQuery;
5972 }
5973
5974 protected class AddPermission {
5975 protected AddPermission(GroupPersistenceImpl persistenceImpl) {
5976 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
5977 "INSERT INTO Groups_Permissions (groupId, permissionId) VALUES (?, ?)",
5978 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
5979 _persistenceImpl = persistenceImpl;
5980 }
5981
5982 protected void add(long groupId, long permissionId)
5983 throws SystemException {
5984 if (!_persistenceImpl.containsPermission.contains(groupId,
5985 permissionId)) {
5986 ModelListener<com.liferay.portal.model.Permission>[] permissionListeners =
5987 permissionPersistence.getListeners();
5988
5989 for (ModelListener<Group> listener : listeners) {
5990 listener.onBeforeAddAssociation(groupId,
5991 com.liferay.portal.model.Permission.class.getName(),
5992 permissionId);
5993 }
5994
5995 for (ModelListener<com.liferay.portal.model.Permission> listener : permissionListeners) {
5996 listener.onBeforeAddAssociation(permissionId,
5997 Group.class.getName(), groupId);
5998 }
5999
6000 _sqlUpdate.update(new Object[] {
6001 new Long(groupId), new Long(permissionId)
6002 });
6003
6004 for (ModelListener<Group> listener : listeners) {
6005 listener.onAfterAddAssociation(groupId,
6006 com.liferay.portal.model.Permission.class.getName(),
6007 permissionId);
6008 }
6009
6010 for (ModelListener<com.liferay.portal.model.Permission> listener : permissionListeners) {
6011 listener.onAfterAddAssociation(permissionId,
6012 Group.class.getName(), groupId);
6013 }
6014 }
6015 }
6016
6017 private SqlUpdate _sqlUpdate;
6018 private GroupPersistenceImpl _persistenceImpl;
6019 }
6020
6021 protected class ClearPermissions {
6022 protected ClearPermissions(GroupPersistenceImpl persistenceImpl) {
6023 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
6024 "DELETE FROM Groups_Permissions WHERE groupId = ?",
6025 new int[] { java.sql.Types.BIGINT });
6026 }
6027
6028 protected void clear(long groupId) throws SystemException {
6029 ModelListener<com.liferay.portal.model.Permission>[] permissionListeners =
6030 permissionPersistence.getListeners();
6031
6032 List<com.liferay.portal.model.Permission> permissions = null;
6033
6034 if ((listeners.length > 0) || (permissionListeners.length > 0)) {
6035 permissions = getPermissions(groupId);
6036
6037 for (com.liferay.portal.model.Permission permission : permissions) {
6038 for (ModelListener<Group> listener : listeners) {
6039 listener.onBeforeRemoveAssociation(groupId,
6040 com.liferay.portal.model.Permission.class.getName(),
6041 permission.getPrimaryKey());
6042 }
6043
6044 for (ModelListener<com.liferay.portal.model.Permission> listener : permissionListeners) {
6045 listener.onBeforeRemoveAssociation(permission.getPrimaryKey(),
6046 Group.class.getName(), groupId);
6047 }
6048 }
6049 }
6050
6051 _sqlUpdate.update(new Object[] { new Long(groupId) });
6052
6053 if ((listeners.length > 0) || (permissionListeners.length > 0)) {
6054 for (com.liferay.portal.model.Permission permission : permissions) {
6055 for (ModelListener<Group> listener : listeners) {
6056 listener.onAfterRemoveAssociation(groupId,
6057 com.liferay.portal.model.Permission.class.getName(),
6058 permission.getPrimaryKey());
6059 }
6060
6061 for (ModelListener<com.liferay.portal.model.Permission> listener : permissionListeners) {
6062 listener.onAfterRemoveAssociation(permission.getPrimaryKey(),
6063 Group.class.getName(), groupId);
6064 }
6065 }
6066 }
6067 }
6068
6069 private SqlUpdate _sqlUpdate;
6070 }
6071
6072 protected class RemovePermission {
6073 protected RemovePermission(GroupPersistenceImpl persistenceImpl) {
6074 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
6075 "DELETE FROM Groups_Permissions WHERE groupId = ? AND permissionId = ?",
6076 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
6077 _persistenceImpl = persistenceImpl;
6078 }
6079
6080 protected void remove(long groupId, long permissionId)
6081 throws SystemException {
6082 if (_persistenceImpl.containsPermission.contains(groupId,
6083 permissionId)) {
6084 ModelListener<com.liferay.portal.model.Permission>[] permissionListeners =
6085 permissionPersistence.getListeners();
6086
6087 for (ModelListener<Group> listener : listeners) {
6088 listener.onBeforeRemoveAssociation(groupId,
6089 com.liferay.portal.model.Permission.class.getName(),
6090 permissionId);
6091 }
6092
6093 for (ModelListener<com.liferay.portal.model.Permission> listener : permissionListeners) {
6094 listener.onBeforeRemoveAssociation(permissionId,
6095 Group.class.getName(), groupId);
6096 }
6097
6098 _sqlUpdate.update(new Object[] {
6099 new Long(groupId), new Long(permissionId)
6100 });
6101
6102 for (ModelListener<Group> listener : listeners) {
6103 listener.onAfterRemoveAssociation(groupId,
6104 com.liferay.portal.model.Permission.class.getName(),
6105 permissionId);
6106 }
6107
6108 for (ModelListener<com.liferay.portal.model.Permission> listener : permissionListeners) {
6109 listener.onAfterRemoveAssociation(permissionId,
6110 Group.class.getName(), groupId);
6111 }
6112 }
6113 }
6114
6115 private SqlUpdate _sqlUpdate;
6116 private GroupPersistenceImpl _persistenceImpl;
6117 }
6118
6119 protected class ContainsRole {
6120 protected ContainsRole(GroupPersistenceImpl persistenceImpl) {
6121 super();
6122
6123 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
6124 _SQL_CONTAINSROLE,
6125 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
6126 RowMapper.COUNT);
6127 }
6128
6129 protected boolean contains(long groupId, long roleId) {
6130 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
6131 new Long(groupId), new Long(roleId)
6132 });
6133
6134 if (results.size() > 0) {
6135 Integer count = results.get(0);
6136
6137 if (count.intValue() > 0) {
6138 return true;
6139 }
6140 }
6141
6142 return false;
6143 }
6144
6145 private MappingSqlQuery<Integer> _mappingSqlQuery;
6146 }
6147
6148 protected class AddRole {
6149 protected AddRole(GroupPersistenceImpl persistenceImpl) {
6150 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
6151 "INSERT INTO Groups_Roles (groupId, roleId) VALUES (?, ?)",
6152 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
6153 _persistenceImpl = persistenceImpl;
6154 }
6155
6156 protected void add(long groupId, long roleId) throws SystemException {
6157 if (!_persistenceImpl.containsRole.contains(groupId, roleId)) {
6158 ModelListener<com.liferay.portal.model.Role>[] roleListeners = rolePersistence.getListeners();
6159
6160 for (ModelListener<Group> listener : listeners) {
6161 listener.onBeforeAddAssociation(groupId,
6162 com.liferay.portal.model.Role.class.getName(), roleId);
6163 }
6164
6165 for (ModelListener<com.liferay.portal.model.Role> listener : roleListeners) {
6166 listener.onBeforeAddAssociation(roleId,
6167 Group.class.getName(), groupId);
6168 }
6169
6170 _sqlUpdate.update(new Object[] {
6171 new Long(groupId), new Long(roleId)
6172 });
6173
6174 for (ModelListener<Group> listener : listeners) {
6175 listener.onAfterAddAssociation(groupId,
6176 com.liferay.portal.model.Role.class.getName(), roleId);
6177 }
6178
6179 for (ModelListener<com.liferay.portal.model.Role> listener : roleListeners) {
6180 listener.onAfterAddAssociation(roleId,
6181 Group.class.getName(), groupId);
6182 }
6183 }
6184 }
6185
6186 private SqlUpdate _sqlUpdate;
6187 private GroupPersistenceImpl _persistenceImpl;
6188 }
6189
6190 protected class ClearRoles {
6191 protected ClearRoles(GroupPersistenceImpl persistenceImpl) {
6192 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
6193 "DELETE FROM Groups_Roles WHERE groupId = ?",
6194 new int[] { java.sql.Types.BIGINT });
6195 }
6196
6197 protected void clear(long groupId) throws SystemException {
6198 ModelListener<com.liferay.portal.model.Role>[] roleListeners = rolePersistence.getListeners();
6199
6200 List<com.liferay.portal.model.Role> roles = null;
6201
6202 if ((listeners.length > 0) || (roleListeners.length > 0)) {
6203 roles = getRoles(groupId);
6204
6205 for (com.liferay.portal.model.Role role : roles) {
6206 for (ModelListener<Group> listener : listeners) {
6207 listener.onBeforeRemoveAssociation(groupId,
6208 com.liferay.portal.model.Role.class.getName(),
6209 role.getPrimaryKey());
6210 }
6211
6212 for (ModelListener<com.liferay.portal.model.Role> listener : roleListeners) {
6213 listener.onBeforeRemoveAssociation(role.getPrimaryKey(),
6214 Group.class.getName(), groupId);
6215 }
6216 }
6217 }
6218
6219 _sqlUpdate.update(new Object[] { new Long(groupId) });
6220
6221 if ((listeners.length > 0) || (roleListeners.length > 0)) {
6222 for (com.liferay.portal.model.Role role : roles) {
6223 for (ModelListener<Group> listener : listeners) {
6224 listener.onAfterRemoveAssociation(groupId,
6225 com.liferay.portal.model.Role.class.getName(),
6226 role.getPrimaryKey());
6227 }
6228
6229 for (ModelListener<com.liferay.portal.model.Role> listener : roleListeners) {
6230 listener.onAfterRemoveAssociation(role.getPrimaryKey(),
6231 Group.class.getName(), groupId);
6232 }
6233 }
6234 }
6235 }
6236
6237 private SqlUpdate _sqlUpdate;
6238 }
6239
6240 protected class RemoveRole {
6241 protected RemoveRole(GroupPersistenceImpl persistenceImpl) {
6242 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
6243 "DELETE FROM Groups_Roles WHERE groupId = ? AND roleId = ?",
6244 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
6245 _persistenceImpl = persistenceImpl;
6246 }
6247
6248 protected void remove(long groupId, long roleId)
6249 throws SystemException {
6250 if (_persistenceImpl.containsRole.contains(groupId, roleId)) {
6251 ModelListener<com.liferay.portal.model.Role>[] roleListeners = rolePersistence.getListeners();
6252
6253 for (ModelListener<Group> listener : listeners) {
6254 listener.onBeforeRemoveAssociation(groupId,
6255 com.liferay.portal.model.Role.class.getName(), roleId);
6256 }
6257
6258 for (ModelListener<com.liferay.portal.model.Role> listener : roleListeners) {
6259 listener.onBeforeRemoveAssociation(roleId,
6260 Group.class.getName(), groupId);
6261 }
6262
6263 _sqlUpdate.update(new Object[] {
6264 new Long(groupId), new Long(roleId)
6265 });
6266
6267 for (ModelListener<Group> listener : listeners) {
6268 listener.onAfterRemoveAssociation(groupId,
6269 com.liferay.portal.model.Role.class.getName(), roleId);
6270 }
6271
6272 for (ModelListener<com.liferay.portal.model.Role> listener : roleListeners) {
6273 listener.onAfterRemoveAssociation(roleId,
6274 Group.class.getName(), groupId);
6275 }
6276 }
6277 }
6278
6279 private SqlUpdate _sqlUpdate;
6280 private GroupPersistenceImpl _persistenceImpl;
6281 }
6282
6283 protected class ContainsUserGroup {
6284 protected ContainsUserGroup(GroupPersistenceImpl persistenceImpl) {
6285 super();
6286
6287 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
6288 _SQL_CONTAINSUSERGROUP,
6289 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
6290 RowMapper.COUNT);
6291 }
6292
6293 protected boolean contains(long groupId, long userGroupId) {
6294 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
6295 new Long(groupId), new Long(userGroupId)
6296 });
6297
6298 if (results.size() > 0) {
6299 Integer count = results.get(0);
6300
6301 if (count.intValue() > 0) {
6302 return true;
6303 }
6304 }
6305
6306 return false;
6307 }
6308
6309 private MappingSqlQuery<Integer> _mappingSqlQuery;
6310 }
6311
6312 protected class AddUserGroup {
6313 protected AddUserGroup(GroupPersistenceImpl persistenceImpl) {
6314 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
6315 "INSERT INTO Groups_UserGroups (groupId, userGroupId) VALUES (?, ?)",
6316 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
6317 _persistenceImpl = persistenceImpl;
6318 }
6319
6320 protected void add(long groupId, long userGroupId)
6321 throws SystemException {
6322 if (!_persistenceImpl.containsUserGroup.contains(groupId,
6323 userGroupId)) {
6324 ModelListener<com.liferay.portal.model.UserGroup>[] userGroupListeners =
6325 userGroupPersistence.getListeners();
6326
6327 for (ModelListener<Group> listener : listeners) {
6328 listener.onBeforeAddAssociation(groupId,
6329 com.liferay.portal.model.UserGroup.class.getName(),
6330 userGroupId);
6331 }
6332
6333 for (ModelListener<com.liferay.portal.model.UserGroup> listener : userGroupListeners) {
6334 listener.onBeforeAddAssociation(userGroupId,
6335 Group.class.getName(), groupId);
6336 }
6337
6338 _sqlUpdate.update(new Object[] {
6339 new Long(groupId), new Long(userGroupId)
6340 });
6341
6342 for (ModelListener<Group> listener : listeners) {
6343 listener.onAfterAddAssociation(groupId,
6344 com.liferay.portal.model.UserGroup.class.getName(),
6345 userGroupId);
6346 }
6347
6348 for (ModelListener<com.liferay.portal.model.UserGroup> listener : userGroupListeners) {
6349 listener.onAfterAddAssociation(userGroupId,
6350 Group.class.getName(), groupId);
6351 }
6352 }
6353 }
6354
6355 private SqlUpdate _sqlUpdate;
6356 private GroupPersistenceImpl _persistenceImpl;
6357 }
6358
6359 protected class ClearUserGroups {
6360 protected ClearUserGroups(GroupPersistenceImpl persistenceImpl) {
6361 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
6362 "DELETE FROM Groups_UserGroups WHERE groupId = ?",
6363 new int[] { java.sql.Types.BIGINT });
6364 }
6365
6366 protected void clear(long groupId) throws SystemException {
6367 ModelListener<com.liferay.portal.model.UserGroup>[] userGroupListeners =
6368 userGroupPersistence.getListeners();
6369
6370 List<com.liferay.portal.model.UserGroup> userGroups = null;
6371
6372 if ((listeners.length > 0) || (userGroupListeners.length > 0)) {
6373 userGroups = getUserGroups(groupId);
6374
6375 for (com.liferay.portal.model.UserGroup userGroup : userGroups) {
6376 for (ModelListener<Group> listener : listeners) {
6377 listener.onBeforeRemoveAssociation(groupId,
6378 com.liferay.portal.model.UserGroup.class.getName(),
6379 userGroup.getPrimaryKey());
6380 }
6381
6382 for (ModelListener<com.liferay.portal.model.UserGroup> listener : userGroupListeners) {
6383 listener.onBeforeRemoveAssociation(userGroup.getPrimaryKey(),
6384 Group.class.getName(), groupId);
6385 }
6386 }
6387 }
6388
6389 _sqlUpdate.update(new Object[] { new Long(groupId) });
6390
6391 if ((listeners.length > 0) || (userGroupListeners.length > 0)) {
6392 for (com.liferay.portal.model.UserGroup userGroup : userGroups) {
6393 for (ModelListener<Group> listener : listeners) {
6394 listener.onAfterRemoveAssociation(groupId,
6395 com.liferay.portal.model.UserGroup.class.getName(),
6396 userGroup.getPrimaryKey());
6397 }
6398
6399 for (ModelListener<com.liferay.portal.model.UserGroup> listener : userGroupListeners) {
6400 listener.onAfterRemoveAssociation(userGroup.getPrimaryKey(),
6401 Group.class.getName(), groupId);
6402 }
6403 }
6404 }
6405 }
6406
6407 private SqlUpdate _sqlUpdate;
6408 }
6409
6410 protected class RemoveUserGroup {
6411 protected RemoveUserGroup(GroupPersistenceImpl persistenceImpl) {
6412 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
6413 "DELETE FROM Groups_UserGroups WHERE groupId = ? AND userGroupId = ?",
6414 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
6415 _persistenceImpl = persistenceImpl;
6416 }
6417
6418 protected void remove(long groupId, long userGroupId)
6419 throws SystemException {
6420 if (_persistenceImpl.containsUserGroup.contains(groupId, userGroupId)) {
6421 ModelListener<com.liferay.portal.model.UserGroup>[] userGroupListeners =
6422 userGroupPersistence.getListeners();
6423
6424 for (ModelListener<Group> listener : listeners) {
6425 listener.onBeforeRemoveAssociation(groupId,
6426 com.liferay.portal.model.UserGroup.class.getName(),
6427 userGroupId);
6428 }
6429
6430 for (ModelListener<com.liferay.portal.model.UserGroup> listener : userGroupListeners) {
6431 listener.onBeforeRemoveAssociation(userGroupId,
6432 Group.class.getName(), groupId);
6433 }
6434
6435 _sqlUpdate.update(new Object[] {
6436 new Long(groupId), new Long(userGroupId)
6437 });
6438
6439 for (ModelListener<Group> listener : listeners) {
6440 listener.onAfterRemoveAssociation(groupId,
6441 com.liferay.portal.model.UserGroup.class.getName(),
6442 userGroupId);
6443 }
6444
6445 for (ModelListener<com.liferay.portal.model.UserGroup> listener : userGroupListeners) {
6446 listener.onAfterRemoveAssociation(userGroupId,
6447 Group.class.getName(), groupId);
6448 }
6449 }
6450 }
6451
6452 private SqlUpdate _sqlUpdate;
6453 private GroupPersistenceImpl _persistenceImpl;
6454 }
6455
6456 protected class ContainsUser {
6457 protected ContainsUser(GroupPersistenceImpl persistenceImpl) {
6458 super();
6459
6460 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
6461 _SQL_CONTAINSUSER,
6462 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
6463 RowMapper.COUNT);
6464 }
6465
6466 protected boolean contains(long groupId, long userId) {
6467 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
6468 new Long(groupId), new Long(userId)
6469 });
6470
6471 if (results.size() > 0) {
6472 Integer count = results.get(0);
6473
6474 if (count.intValue() > 0) {
6475 return true;
6476 }
6477 }
6478
6479 return false;
6480 }
6481
6482 private MappingSqlQuery<Integer> _mappingSqlQuery;
6483 }
6484
6485 protected class AddUser {
6486 protected AddUser(GroupPersistenceImpl persistenceImpl) {
6487 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
6488 "INSERT INTO Users_Groups (groupId, userId) VALUES (?, ?)",
6489 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
6490 _persistenceImpl = persistenceImpl;
6491 }
6492
6493 protected void add(long groupId, long userId) throws SystemException {
6494 if (!_persistenceImpl.containsUser.contains(groupId, userId)) {
6495 ModelListener<com.liferay.portal.model.User>[] userListeners = userPersistence.getListeners();
6496
6497 for (ModelListener<Group> listener : listeners) {
6498 listener.onBeforeAddAssociation(groupId,
6499 com.liferay.portal.model.User.class.getName(), userId);
6500 }
6501
6502 for (ModelListener<com.liferay.portal.model.User> listener : userListeners) {
6503 listener.onBeforeAddAssociation(userId,
6504 Group.class.getName(), groupId);
6505 }
6506
6507 _sqlUpdate.update(new Object[] {
6508 new Long(groupId), new Long(userId)
6509 });
6510
6511 for (ModelListener<Group> listener : listeners) {
6512 listener.onAfterAddAssociation(groupId,
6513 com.liferay.portal.model.User.class.getName(), userId);
6514 }
6515
6516 for (ModelListener<com.liferay.portal.model.User> listener : userListeners) {
6517 listener.onAfterAddAssociation(userId,
6518 Group.class.getName(), groupId);
6519 }
6520 }
6521 }
6522
6523 private SqlUpdate _sqlUpdate;
6524 private GroupPersistenceImpl _persistenceImpl;
6525 }
6526
6527 protected class ClearUsers {
6528 protected ClearUsers(GroupPersistenceImpl persistenceImpl) {
6529 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
6530 "DELETE FROM Users_Groups WHERE groupId = ?",
6531 new int[] { java.sql.Types.BIGINT });
6532 }
6533
6534 protected void clear(long groupId) throws SystemException {
6535 ModelListener<com.liferay.portal.model.User>[] userListeners = userPersistence.getListeners();
6536
6537 List<com.liferay.portal.model.User> users = null;
6538
6539 if ((listeners.length > 0) || (userListeners.length > 0)) {
6540 users = getUsers(groupId);
6541
6542 for (com.liferay.portal.model.User user : users) {
6543 for (ModelListener<Group> listener : listeners) {
6544 listener.onBeforeRemoveAssociation(groupId,
6545 com.liferay.portal.model.User.class.getName(),
6546 user.getPrimaryKey());
6547 }
6548
6549 for (ModelListener<com.liferay.portal.model.User> listener : userListeners) {
6550 listener.onBeforeRemoveAssociation(user.getPrimaryKey(),
6551 Group.class.getName(), groupId);
6552 }
6553 }
6554 }
6555
6556 _sqlUpdate.update(new Object[] { new Long(groupId) });
6557
6558 if ((listeners.length > 0) || (userListeners.length > 0)) {
6559 for (com.liferay.portal.model.User user : users) {
6560 for (ModelListener<Group> listener : listeners) {
6561 listener.onAfterRemoveAssociation(groupId,
6562 com.liferay.portal.model.User.class.getName(),
6563 user.getPrimaryKey());
6564 }
6565
6566 for (ModelListener<com.liferay.portal.model.User> listener : userListeners) {
6567 listener.onAfterRemoveAssociation(user.getPrimaryKey(),
6568 Group.class.getName(), groupId);
6569 }
6570 }
6571 }
6572 }
6573
6574 private SqlUpdate _sqlUpdate;
6575 }
6576
6577 protected class RemoveUser {
6578 protected RemoveUser(GroupPersistenceImpl persistenceImpl) {
6579 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
6580 "DELETE FROM Users_Groups WHERE groupId = ? AND userId = ?",
6581 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
6582 _persistenceImpl = persistenceImpl;
6583 }
6584
6585 protected void remove(long groupId, long userId)
6586 throws SystemException {
6587 if (_persistenceImpl.containsUser.contains(groupId, userId)) {
6588 ModelListener<com.liferay.portal.model.User>[] userListeners = userPersistence.getListeners();
6589
6590 for (ModelListener<Group> listener : listeners) {
6591 listener.onBeforeRemoveAssociation(groupId,
6592 com.liferay.portal.model.User.class.getName(), userId);
6593 }
6594
6595 for (ModelListener<com.liferay.portal.model.User> listener : userListeners) {
6596 listener.onBeforeRemoveAssociation(userId,
6597 Group.class.getName(), groupId);
6598 }
6599
6600 _sqlUpdate.update(new Object[] {
6601 new Long(groupId), new Long(userId)
6602 });
6603
6604 for (ModelListener<Group> listener : listeners) {
6605 listener.onAfterRemoveAssociation(groupId,
6606 com.liferay.portal.model.User.class.getName(), userId);
6607 }
6608
6609 for (ModelListener<com.liferay.portal.model.User> listener : userListeners) {
6610 listener.onAfterRemoveAssociation(userId,
6611 Group.class.getName(), groupId);
6612 }
6613 }
6614 }
6615
6616 private SqlUpdate _sqlUpdate;
6617 private GroupPersistenceImpl _persistenceImpl;
6618 }
6619
6620 private static final String _SQL_SELECT_GROUP_ = "SELECT group_ FROM Group group_";
6621 private static final String _SQL_SELECT_GROUP__WHERE = "SELECT group_ FROM Group group_ WHERE ";
6622 private static final String _SQL_COUNT_GROUP_ = "SELECT COUNT(group_) FROM Group group_";
6623 private static final String _SQL_COUNT_GROUP__WHERE = "SELECT COUNT(group_) FROM Group group_ WHERE ";
6624 private static final String _SQL_GETORGANIZATIONS = "SELECT {Organization_.*} FROM Organization_ INNER JOIN Groups_Orgs ON (Groups_Orgs.organizationId = Organization_.organizationId) WHERE (Groups_Orgs.groupId = ?)";
6625 private static final String _SQL_GETORGANIZATIONSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM Groups_Orgs WHERE groupId = ?";
6626 private static final String _SQL_CONTAINSORGANIZATION = "SELECT COUNT(*) AS COUNT_VALUE FROM Groups_Orgs WHERE groupId = ? AND organizationId = ?";
6627 private static final String _SQL_GETPERMISSIONS = "SELECT {Permission_.*} FROM Permission_ INNER JOIN Groups_Permissions ON (Groups_Permissions.permissionId = Permission_.permissionId) WHERE (Groups_Permissions.groupId = ?)";
6628 private static final String _SQL_GETPERMISSIONSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM Groups_Permissions WHERE groupId = ?";
6629 private static final String _SQL_CONTAINSPERMISSION = "SELECT COUNT(*) AS COUNT_VALUE FROM Groups_Permissions WHERE groupId = ? AND permissionId = ?";
6630 private static final String _SQL_GETROLES = "SELECT {Role_.*} FROM Role_ INNER JOIN Groups_Roles ON (Groups_Roles.roleId = Role_.roleId) WHERE (Groups_Roles.groupId = ?)";
6631 private static final String _SQL_GETROLESSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM Groups_Roles WHERE groupId = ?";
6632 private static final String _SQL_CONTAINSROLE = "SELECT COUNT(*) AS COUNT_VALUE FROM Groups_Roles WHERE groupId = ? AND roleId = ?";
6633 private static final String _SQL_GETUSERGROUPS = "SELECT {UserGroup.*} FROM UserGroup INNER JOIN Groups_UserGroups ON (Groups_UserGroups.userGroupId = UserGroup.userGroupId) WHERE (Groups_UserGroups.groupId = ?)";
6634 private static final String _SQL_GETUSERGROUPSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM Groups_UserGroups WHERE groupId = ?";
6635 private static final String _SQL_CONTAINSUSERGROUP = "SELECT COUNT(*) AS COUNT_VALUE FROM Groups_UserGroups WHERE groupId = ? AND userGroupId = ?";
6636 private static final String _SQL_GETUSERS = "SELECT {User_.*} FROM User_ INNER JOIN Users_Groups ON (Users_Groups.userId = User_.userId) WHERE (Users_Groups.groupId = ?)";
6637 private static final String _SQL_GETUSERSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM Users_Groups WHERE groupId = ?";
6638 private static final String _SQL_CONTAINSUSER = "SELECT COUNT(*) AS COUNT_VALUE FROM Users_Groups WHERE groupId = ? AND userId = ?";
6639 private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "group_.companyId = ?";
6640 private static final String _FINDER_COLUMN_LIVEGROUPID_LIVEGROUPID_2 = "group_.liveGroupId = ?";
6641 private static final String _FINDER_COLUMN_C_N_COMPANYID_2 = "group_.companyId = ? AND ";
6642 private static final String _FINDER_COLUMN_C_N_NAME_1 = "group_.name IS NULL";
6643 private static final String _FINDER_COLUMN_C_N_NAME_2 = "group_.name = ?";
6644 private static final String _FINDER_COLUMN_C_N_NAME_3 = "(group_.name IS NULL OR group_.name = ?)";
6645 private static final String _FINDER_COLUMN_C_F_COMPANYID_2 = "group_.companyId = ? AND ";
6646 private static final String _FINDER_COLUMN_C_F_FRIENDLYURL_1 = "group_.friendlyURL IS NULL";
6647 private static final String _FINDER_COLUMN_C_F_FRIENDLYURL_2 = "group_.friendlyURL = ?";
6648 private static final String _FINDER_COLUMN_C_F_FRIENDLYURL_3 = "(group_.friendlyURL IS NULL OR group_.friendlyURL = ?)";
6649 private static final String _FINDER_COLUMN_T_A_TYPE_2 = "group_.type = ? AND ";
6650 private static final String _FINDER_COLUMN_T_A_ACTIVE_2 = "group_.active = ?";
6651 private static final String _FINDER_COLUMN_C_C_C_COMPANYID_2 = "group_.companyId = ? AND ";
6652 private static final String _FINDER_COLUMN_C_C_C_CLASSNAMEID_2 = "group_.classNameId = ? AND ";
6653 private static final String _FINDER_COLUMN_C_C_C_CLASSPK_2 = "group_.classPK = ?";
6654 private static final String _FINDER_COLUMN_C_L_N_COMPANYID_2 = "group_.companyId = ? AND ";
6655 private static final String _FINDER_COLUMN_C_L_N_LIVEGROUPID_2 = "group_.liveGroupId = ? AND ";
6656 private static final String _FINDER_COLUMN_C_L_N_NAME_1 = "group_.name IS NULL";
6657 private static final String _FINDER_COLUMN_C_L_N_NAME_2 = "group_.name = ?";
6658 private static final String _FINDER_COLUMN_C_L_N_NAME_3 = "(group_.name IS NULL OR group_.name = ?)";
6659 private static final String _FINDER_COLUMN_C_C_L_N_COMPANYID_2 = "group_.companyId = ? AND ";
6660 private static final String _FINDER_COLUMN_C_C_L_N_CLASSNAMEID_2 = "group_.classNameId = ? AND ";
6661 private static final String _FINDER_COLUMN_C_C_L_N_LIVEGROUPID_2 = "group_.liveGroupId = ? AND ";
6662 private static final String _FINDER_COLUMN_C_C_L_N_NAME_1 = "group_.name IS NULL";
6663 private static final String _FINDER_COLUMN_C_C_L_N_NAME_2 = "group_.name = ?";
6664 private static final String _FINDER_COLUMN_C_C_L_N_NAME_3 = "(group_.name IS NULL OR group_.name = ?)";
6665 private static final String _ORDER_BY_ENTITY_ALIAS = "group_.";
6666 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Group exists with the primary key ";
6667 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No Group exists with the key {";
6668 private static Log _log = LogFactoryUtil.getLog(GroupPersistenceImpl.class);
6669 }