Returns and members for the <code>IEntityGroup</code>.

@param eg IEntityGroup
966740
@Override
    public Iterator findMembers(IEntityGroup eg) throws GroupsException {
        Collection members = new ArrayList(10);
        Iterator it = null;

        for (it = findMemberGroups(eg); it.hasNext(); ) {
            members.add(it.next());
        }
        for (it = findMemberEntities(eg); it.hasNext(); ) {
            members.add(it.next());
        }

        return members.iterator();
    }
193892
def members(self):
        ''''''
        with self._mutex:
            if not self._members:
                self._members = {}
                for o in self.organisations:
                    # TODO: Search for these in the tree
                    self._members[o.org_id] = o.obj.get_members()
        return self._members
298149
@Override
    public Iterator findMemberGroups(IEntityGroup group) throws GroupsException {

        if (isTreeRefreshRequired()) {
            refreshTree();
        }

        log.debug("Invoking findMemberGroups() for group:  {}", group.getLocalKey());

        List<IEntityGroup> rslt = new ArrayList<>();

        List<String> list = groupsTree.getChildren().get(group.getLocalKey());
        if (list != null) {
            // should only reach this code if its a SmartLdap managed group...
            for (String s : list) {
                rslt.add(groupsTree.getGroups().get(s));
            }
        }

        return rslt.iterator();
    }
1126609
protected void synchronizeGroupMembersOnUpdate(IEntityGroup group) throws GroupsException {
        EntityGroupImpl egi = (EntityGroupImpl) group;
        GroupMemberImpl gmi = null;

        for (Iterator it = egi.getAddedMembers().values().iterator(); it.hasNext(); ) {
            gmi = (GroupMemberImpl) it.next();
            gmi.invalidateInParentGroupsCache(Collections.singleton((IGroupMember) gmi));
            if (cacheInUse()) {
                cacheUpdate(gmi);
            }
        }

        for (Iterator it = egi.getRemovedMembers().values().iterator(); it.hasNext(); ) {
            gmi = (GroupMemberImpl) it.next();
            gmi.invalidateInParentGroupsCache(Collections.singleton((IGroupMember) gmi));
            if (cacheInUse()) {
                cacheUpdate(gmi);
            }
        }
    }
1285706
@Override
    public Iterator findParentGroups(IGroupMember gm) throws GroupsException {
        log.debug("Finding containing groups for member {}", gm.getKey());
        Collection groups = new ArrayList(10);
        IEntityGroup group = null;
        for (Iterator it = getGroupStore().findParentGroups(gm); it.hasNext(); ) {
            group = (IEntityGroup) it.next();
            group.setLocalGroupService(this);
            groups.add(group);
            if (cacheInUse()) {
                try {
                    if (getGroupFromCache(group.getEntityIdentifier().getKey()) == null) {
                        cacheAdd(group);
                    }
                } catch (CachingException ce) {
                    throw new GroupsException("Problem finding containing groups", ce);
                }
            }
        }
        return groups.iterator();
    }
481267
@Override
    public Set<Entity> getGroupsForMember(String memberName) {
        Set<Entity> groups = new HashSet<Entity>();
        if (StringUtils.isNotEmpty(memberName)) {
            EntityIdentifier[] identifiers =
                    GroupService.searchForEntities(
                            memberName,
                            GroupService.SearchMethod.DISCRETE,
                            EntityEnum.PERSON.getClazz());
            for (EntityIdentifier entityIdentifier : identifiers) {
                if (entityIdentifier.getType().equals(EntityEnum.PERSON.getClazz())) {
                    IGroupMember groupMember = GroupService.getGroupMember(entityIdentifier);
                    if (memberName.equalsIgnoreCase(groupMember.getKey())) {
                        Iterator it = GroupService.findParentGroups(groupMember);
                        while (it.hasNext()) {
                            IEntityGroup g = (IEntityGroup) it.next();
                            Entity e =
                                    EntityFactory.createEntity(
                                            g, EntityEnum.getEntityEnum(g.getLeafType(), true));
                            groups.add(e);
                        }
                        return groups;
                    }
                }
            }
        }
        return groups;
    }
849149
private Membership findMembershipByUserGroupAndType(Session session, String userName, String groupId, String type)
      throws Exception
   {
      MembershipImpl membership = getFromCache(userName, groupId, type);
      if (membership != null)
      {
         return membership;
      }

      try
      {
         Node groupNode = utils.getGroupNode(session, groupId);

         Node refUserNode = groupNode.getNode(JCROrganizationServiceImpl.JOS_MEMBERSHIP).getNode(userName);
         Node refTypeNode =
            refUserNode.getNode(type.equals(MembershipTypeHandler.ANY_MEMBERSHIP_TYPE)
               ? JCROrganizationServiceImpl.JOS_MEMBERSHIP_TYPE_ANY : type);

         String id = utils.composeMembershipId(groupNode, refUserNode, refTypeNode);

         membership = new MembershipImpl();
         membership.setGroupId(groupId);
         membership.setUserName(userName);
         membership.setMembershipType(type);
         membership.setId(id);

         putInCache(membership);

         return membership;
      }
      catch (PathNotFoundException e)
      {
         return null;
      }
   }
1151167
@Override
    public IEntitySearcher newEntitySearcher() throws GroupsException {
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Creating New Grouper GrouperEntitySearcherFactory");
        }
        return (IEntitySearcher) new GrouperEntityGroupStoreFactory().newGroupStore();
    }
751330
private IEntityGroup instanceFromResultSet(ResultSet rs) throws SQLException, GroupsException {
        IEntityGroup eg = null;

        String key = rs.getString(1);
        String creatorID = rs.getString(2);
        Integer entityTypeID = rs.getInt(3);
        Class entityType = EntityTypesLocator.getEntityTypes().getEntityTypeFromID(entityTypeID);
        String groupName = rs.getString(4);
        String description = rs.getString(5);

        if (key != null) {
            eg = newInstance(key, entityType, creatorID, groupName, description);
        }

        return eg;
    }
969867
@Override
    public java.util.Iterator findEntitiesForGroup(IEntityGroup group) throws GroupsException {
        if (log.isDebugEnabled())
            log.debug(
                    DEBUG_CLASS_NAME
                            + ".findEntitiesForGroup(): retrieving entities for group "
                            + group);

        Collection entities = null;
        File f = getFile(group);
        if (f.isDirectory()) {
            entities = Collections.EMPTY_LIST;
        } else {
            entities = getEntitiesFromFile(f);
        }

        return entities.iterator();
    }
978913
@Override
    public IEntity getEntity(String key, Class type) throws GroupsException {
        return getEntity(key, type, null);
    }
990131
@Override
    public void updateGroupMembers(IEntityGroup group) throws GroupsException {
        throwExceptionIfNotInternallyManaged();
        getGroupStore().updateMembers(group);
        if (cacheInUse()) {
            cacheUpdate(group);
        }
        synchronizeGroupMembersOnUpdate(group);
    }
458406
private IEntityGroup igetDistinguishedGroup(String name) throws GroupsException {
        try {
            String key = getDistinguishedGroupKey(name);
            return compositeGroupService.findGroup(key);
        } catch (Exception ex) {
            throw new GroupsException(
                    "GroupService.getDistinguishedGroup(): " + "could not find key for: " + name,
                    ex);
        }
    }
1118568
@Override
    @SuppressWarnings("unchecked")
    public Iterator findEntitiesForGroup(IEntityGroup group) throws GroupsException {

        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Searching Grouper for members of the group with key: " + group.getKey());
        }

        try {

            // execute a search for members of the specified group
            GcGetMembers getGroupsMembers = new GcGetMembers();
            getGroupsMembers.addGroupName(group.getLocalKey());
            getGroupsMembers.assignIncludeSubjectDetail(true);
            WsGetMembersResults results = getGroupsMembers.execute();

            if (results == null
                    || results.getResults() == null
                    || results.getResults().length == 0
                    || results.getResults()[0].getWsSubjects() == null) {
                LOGGER.debug("No members found for Grouper group with key " + group.getLocalKey());
                return Collections.<IGroupMember>emptyList().iterator();
            }

            WsSubject[] gInfos = results.getResults()[0].getWsSubjects();
            final List<IGroupMember> members = new ArrayList<IGroupMember>(gInfos.length);

            // add each result to the member list
            for (WsSubject gInfo : gInfos) {

                // if the member is not a group (aka person)
                if (!StringUtils.equals(gInfo.getSourceId(), "g:gsa")) {

                    if (LOGGER.isDebugEnabled()) {
                        LOGGER.debug(
                                "creating leaf member:"
                                        + gInfo.getId()
                                        + " and name: "
                                        + gInfo.getName()
                                        + " from group: "
                                        + group.getLocalKey());
                    }
                    // use the name instead of id as it shows better in the display
                    IGroupMember member = new EntityImpl(gInfo.getName(), IPerson.class);
                    members.add(member);
                }
            }

            // return an iterator for the assembled group
            return members.iterator();

        } catch (Exception e) {
            LOGGER.warn(
                    "Exception while attempting to retrieve "
                            + "member entities of group with key "
                            + group.getKey()
                            + " from Grouper web services: "
                            + e.getMessage());
            return Collections.<IGroupMember>emptyList().iterator();
        }
    }
1352415
private Collection<Membership> findMembershipsByUserAndGroup(Session session, String userName, String groupId) throws Exception
   {
      Node groupNode;
      Node refUserNode;

      try
      {
         groupNode = utils.getGroupNode(session, groupId);
         refUserNode = groupNode.getNode(JCROrganizationServiceImpl.JOS_MEMBERSHIP).getNode(userName);
      }
      catch (PathNotFoundException e)
      {
         return new ArrayList<Membership>();
      }

      return findMembershipsByUserAndGroup(session, refUserNode, groupNode);
   }
1194765
private Object[] getPersonGroupMemberKeys(IGroupMember gm) {
        Object[] keys = null;
        EntityIdentifier ei = gm.getUnderlyingEntityIdentifier();
        IPersonAttributes attr = personAttributeDao.getPerson(ei.getKey());
        if (attr != null && attr.getAttributes() != null && !attr.getAttributes().isEmpty()) {
            IPerson p = PersonFactory.createPerson();
            p.setAttributes(attr.getAttributes());
            keys = p.getAttributeValues(memberOfAttributeName);
            log.debug("Groups for person {} is: {}", p.getUserName(), Arrays.toString(keys));
        }
        return keys != null ? keys : new Object[] {};
    }
60859
public static IEntityGroup getDistinguishedGroup(String name) throws GroupsException {
        LOGGER.trace("Invoking getDistinguishedGroup for name='{}'", name);
        return instance().igetDistinguishedGroup(name);
    }