01: /* Copyright 2004 The JA-SIG Collaborative. All rights reserved.
02: * See license distributed with this file and
03: * available online at http://www.uportal.org/license.html
04: */
05:
06: package org.jasig.portal.groups;
07:
08: /**
09: * @author Dan Ellentuck
10: * @version $Revision: 36518 $
11: * @see org.jasig.portal.groups.IEntityGroup
12: *
13: * An <code>IEntityGroup</code> that answers if it contains an entity
14: * by delegating to the local group store. By contrast, an
15: * <code>EntityGroupImpl</code> answers this by examining (and if
16: * necessary initializing) its own member cache. This behavior is
17: * designed to accommodate groups whose membership is computed by
18: * testing the prospective entity member rather than by testing the
19: * group. It allows contains() and deepContains() to work correctly
20: * for groups from services like PAGS and JitLDAP. Groups in these
21: * services do not keep references to their members but only define
22: * the logic for computing if a candidate entity is a member.
23: */
24: public class EntityTestingGroupImpl extends EntityGroupImpl {
25:
26: /**
27: * @param groupKey
28: * @param entityType
29: * @throws GroupsException
30: */
31: public EntityTestingGroupImpl(String groupKey, Class entityType)
32: throws GroupsException {
33: super (groupKey, entityType);
34: }
35:
36: /**
37: * Checks if <code>GroupMember</code> gm is a member of this.
38: * @return boolean
39: * @param gm org.jasig.portal.groups.IGroupMember
40: */
41: public boolean contains(IGroupMember gm) throws GroupsException {
42: return (gm.isEntity()) ? gm.isMemberOf(this) : super
43: .contains(gm);
44: }
45: }
|