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