Returns an <code>Iterator</code> over the <code>Collection</code> of <code>IEntityGroups
</code> that the <code>IEntity</code> belongs to.

@return java.util.Iterator
@param ent org.apereo.portal.groups.IEntityGroup
329362
protected Iterator findParentGroups(IEntity ent) throws GroupsException {
        if (log.isDebugEnabled()) log.debug(DEBUG_CLASS_NAME + ".findParentGroups(): for " + ent);

        List groups = new ArrayList();
        File root = getFileRoot(ent.getType());
        if (root != null) {
            File[] files = getAllFilesBelow(root);

            try {
                for (int i = 0; i < files.length; i++) {
                    Collection ids = getEntityIdsFromFile(files[i]);
                    if (ids.contains(ent.getKey())) {
                        groups.add(find(files[i]));
                    }
                }
            } catch (IOException ex) {
                throw new GroupsException("Problem reading group files", ex);
            }
        }

        return groups.iterator();
    }
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();
        }
    }
1135209
protected IEntityGroup createUportalGroupFromGrouperGroup(WsGroup wsGroup) {
        IEntityGroup iEntityGroup = new EntityGroupImpl(wsGroup.getName(), IPerson.class);

        // need to set the group name and description to the actual
        // display name and description
        iEntityGroup.setName(wsGroup.getDisplayName());
        iEntityGroup.setDescription(wsGroup.getDescription());
        return iEntityGroup;
    }
1034781
@Override
    public IEntity getEntity(String key, Class type) throws GroupsException {
        IEntity ent = primGetEntity(key, type);

        if (cacheInUse()) {
            try {
                IEntity cachedEnt = getEntityFromCache(ent.getEntityIdentifier().getKey());
                if (cachedEnt == null) {
                    cacheAdd(ent);
                } else {
                    ent = cachedEnt;
                }
            } catch (CachingException ce) {
                throw new GroupsException(
                        "Problem retrieving group member " + type + "(" + key + ")", ce);
            }
        }
        return ent;
    }
64096
@Override
    public IEntityGroup newGroup(Class type, Name serviceName) throws GroupsException {
        return getComponentService(serviceName).newGroup(type);
    }
420632
@SuppressWarnings("unchecked")
    @Override
	public <T extends ApiUser> List<T> getUsersInGroup(String groupId) {
	    Collection<User> sfsUsers = getZone().getUsersInGroup(groupId);
	    List<T> anwser = new ArrayList<>();
	    for(User sfsUser : sfsUsers)
	        if(sfsUser.containsProperty(APIKey.USER))
	            anwser.add((T) sfsUser.getProperty(APIKey.USER));
	    return anwser;
	}
86606
public static <T> Iterator<T> iterator(Enumeration<T> enumeration) {
		return new Iterator<T>() {
			@Override
			public boolean hasNext() {
				return enumeration.hasMoreElements();
			}
			
			@Override
			public T next() {
				return enumeration.nextElement();
			}
		};
	}
729104
protected IEntityGroup getGroupFromCache(String key) throws CachingException {
        return (IEntityGroup)
                EntityCachingService.instance().get(ICompositeGroupService.GROUP_ENTITY_TYPE, key);
    }
60859
public static IEntityGroup getDistinguishedGroup(String name) throws GroupsException {
        LOGGER.trace("Invoking getDistinguishedGroup for name='{}'", name);
        return instance().igetDistinguishedGroup(name);
    }
1308285
public static Iterable<BoxGroup.Info> getAllGroups(final BoxAPIConnection api) {
        return new Iterable<BoxGroup.Info>() {
            public Iterator<BoxGroup.Info> iterator() {
                URL url = GROUPS_URL_TEMPLATE.build(api.getBaseURL());
                return new BoxGroupIterator(api, url);
            }
        };
    }
34069
@Override
    public IEntityGroup findGroup(String key) throws GroupsException {
        CompositeEntityIdentifier ent = newCompositeEntityIdentifier(key);
        IIndividualGroupService service = getComponentService(ent);
        return (service == null) ? null : service.findGroup(ent);
    }
719681
public java.util.List<NodeGroupMember> getNodeGroupMembers() {
        if (nodeGroupMembers == null) {
            nodeGroupMembers = new com.amazonaws.internal.SdkInternalList<NodeGroupMember>();
        }
        return nodeGroupMembers;
    }
650543
public static <T extends BaseObject<Long>> List<Long> convert2IdList(
            List<T> enTs) {
        List<Long> result = new ArrayList<Long>();

        if (enTs == null) {
            return result;
        }

        for (T t : enTs) {
            result.add(t.getId());
        }

        return result;
    }
914292
@Override
    public IGroupMember getGroupMember(EntityIdentifier underlyingEntityIdentifier)
            throws GroupsException {
        return getGroupMember(
                underlyingEntityIdentifier.getKey(), underlyingEntityIdentifier.getType());
    }
1151167
@Override
    public IEntitySearcher newEntitySearcher() throws GroupsException {
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Creating New Grouper GrouperEntitySearcherFactory");
        }
        return (IEntitySearcher) new GrouperEntityGroupStoreFactory().newGroupStore();
    }
1177176
protected IEntityGroup findGroupWithCache(CompositeEntityIdentifier ent)
            throws GroupsException {
        try {
            IEntityGroup group = getGroupFromCache(ent.getKey());
            if (group == null) {
                group = primFindGroup(ent.getLocalKey());
                if (group != null) {
                    cacheAdd(group);
                }
            }
            return group;
        } catch (CachingException ce) {
            throw new GroupsException("Problem retrieving group " + ent.getKey(), ce);
        }
    }
974945
public static Iterable<BoxGroup.Info> getAllGroups(final BoxAPIConnection api, String ... fields) {
        final QueryStringBuilder builder = new QueryStringBuilder();
        if (fields.length > 0) {
            builder.appendParam("fields", fields);
        }
        return new Iterable<BoxGroup.Info>() {
            public Iterator<BoxGroup.Info> iterator() {
                URL url = GROUPS_URL_TEMPLATE.buildWithQuery(api.getBaseURL(), builder.toString());
                return new BoxGroupIterator(api, url);
            }
        };
    }