It obtains the entities in the graph "g" whose type is the same as
"typeName".

@param g The graph considered
@param typeName The type being searched
@return The list of entities
@throws NullEntity
194523
public static List<GraphEntity> getEntities(Graph g, String typeName)
            throws NullEntity {
        GraphEntity[] ge = g.getEntities();
        List<GraphEntity> result = new ArrayList<>();
        for (int k = 0; k < ge.length; k++) {
            if (ge[k].getType().equals(typeName)) {
                result.add(ge[k]);
            }
        }
        return result;
    }
1229626
public Group getGroupByName(String name) {
        List<Group> groups = getGroupsByName(name, true);

        if (!groups.isEmpty()) {
            return groups.get(0);
        }

        return null;
    }
826113
public static GraphEntity[] generateEntitiesOfType(String type,
            Browser browser) throws NotInitialised {
        Graph[] gs = browser.getGraphs();
        Sequences p = new Sequences();
        GraphEntity[] ges = browser.getAllEntities();
        HashSet actors = new HashSet();
        for (int k = 0; k < ges.length; k++) {
            if (ges[k].getType().equals(type)) {
                actors.add(ges[k]);
            }
        }
        return toGEArray(actors.toArray());
    }
561488
private <T extends IEntity> String getEntityName(T entity) {
		if (entity != null) {
			return entity.getClass().getSimpleName().toLowerCase();
		}
		return null;
	}
927493
public boolean containsEntityEntry(String entityName) {
        if (StringUtils.isBlank(entityName)) {
            throw new IllegalArgumentException("entityName cannot be null or empty.");
        }
        return entries.containsKey(entityName);
    }
461592
public <T extends BaseNlpEntity> List<T> getEntities(Class<T> clazz) {
    List<BaseNlpEntity> resultList = new ArrayList<>();
    for (BaseNlpEntity item : getEntities()) {
      if (item.getClass().equals(clazz)) {
        resultList.add(item);
      }
    }
    return (List<T>) resultList;
  }
1235219
public List<NamedEntityGraph<Entity<T>>> getAllNamedEntityGraph()
   {
      List<NamedEntityGraph<Entity<T>>> list = new ArrayList<NamedEntityGraph<Entity<T>>>();
      List<Node> nodeList = childNode.get("named-entity-graph");
      for(Node node: nodeList)
      {
         NamedEntityGraph<Entity<T>>  type = new NamedEntityGraphImpl<Entity<T>>(this, "named-entity-graph", childNode, node);
         list.add(type);
      }
      return list;
   }
95959
public String lookupEntityName(Entity entity) {
        if (entity == null) {
            return null;
        }
        EntityEnum entityEnum = EntityEnum.getEntityEnum(entity.getEntityType());
        return lookupEntityName(entityEnum, entity.getId());
    }
393425
@FFDCIgnore(Exception.class)
    public List<String> getEntityType(String entity) {

        if (isSafRegistry()) {
            try {
                if (userRegistry.isValidUser(entity)) {
                    List<String> returnValue = new ArrayList<String>();
                    returnValue.add(SchemaConstants.DO_PERSON_ACCOUNT);
                    returnValue.add(userRegistry.getUserSecurityName(entity)); // Handle SAF tokens.
                    return returnValue;
                }
            } catch (Exception e) {
                /* Ignore. */
            }

            try {
                if (userRegistry.isValidGroup(entity)) {
                    List<String> returnValue = new ArrayList<String>();
                    returnValue.add(SchemaConstants.DO_GROUP);
                    returnValue.add(userRegistry.getGroupSecurityName(entity)); // Handle SAF tokens.
                    return returnValue;
                }
            } catch (Exception e) {
                /* Ignore. */
            }
        } else {
            try {
                SearchResult result = userRegistry.getUsers(entity, 1);
                if (result != null && result.getList().size() > 0) {
                    List<String> returnValue = new ArrayList<String>();
                    returnValue.add(SchemaConstants.DO_PERSON_ACCOUNT);
                    returnValue.add(entity);
                    return returnValue;
                }
            } catch (Exception e) {
                /* Ignore. */
            }

            try {
                SearchResult result = userRegistry.getGroups(entity, 1);
                if (result != null && result.getList().size() > 0) {
                    List<String> returnValue = new ArrayList<String>();
                    returnValue.add(SchemaConstants.DO_GROUP);
                    returnValue.add(entity);
                    return returnValue;
                }
            } catch (Exception e) {
                /* Ignore. */
            }

            try {
                String result = userRegistry.getUserSecurityName(entity);
                if (result != null) {
                    List<String> returnValue = new ArrayList<String>();
                    returnValue.add(SchemaConstants.DO_PERSON_ACCOUNT);
                    returnValue.add(result);
                    return returnValue;
                }
            } catch (Exception e) {
                /* Ignore. */
            }

            try {
                String result = userRegistry.getGroupSecurityName(entity);
                if (result != null) {
                    List<String> returnValue = new ArrayList<String>();
                    returnValue.add(SchemaConstants.DO_GROUP);
                    returnValue.add(result);
                    return returnValue;
                }
            } catch (Exception e) {
                /* Ignore. */
            }
        }

        return null;
    }
491596
@Override
    @SuppressWarnings("unchecked")
    public Iterator findParentGroups(IGroupMember gm) throws GroupsException {

        final List<IEntityGroup> parents = new LinkedList<IEntityGroup>();

        GcGetGroups getGroups = new GcGetGroups();

        String uportalStem = getStemPrefix();

        // if only searching in a specific stem
        if (!StringUtils.isBlank(uportalStem)) {
            getGroups.assignStemScope(StemScope.ALL_IN_SUBTREE);
            getGroups.assignWsStemLookup(new WsStemLookup(uportalStem, null));
        }

        String key = null;
        String subjectSourceId = null;
        if (gm.isGroup()) {

            key = ((IEntityGroup) gm).getLocalKey();

            if (!validKey(key)) {
                return parents.iterator();
            }
            subjectSourceId = "g:gsa";
        } else {

            // Determine the key to use for this entity. If the entity is a
            // group, we should use the group's local key (excluding the
            // "grouper." portion of the full key. If the entity is not a
            // group type, just use the key.
            key = gm.getKey();
        }
        getGroups.addSubjectLookup(new WsSubjectLookup(null, subjectSourceId, key));

        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Searching Grouper for parent groups of the entity with key: " + key);
        }

        try {

            WsGetGroupsResults results = getGroups.execute();

            if (results == null
                    || results.getResults() == null
                    || results.getResults().length != 1) {
                LOGGER.debug("Grouper service returned no matches for key " + key);
                return parents.iterator();
            }
            WsGetGroupsResult wsg = results.getResults()[0];
            if (wsg.getWsGroups() != null) {
                for (WsGroup g : wsg.getWsGroups()) {
                    if (LOGGER.isDebugEnabled()) {
                        LOGGER.trace("Retrieved group: " + g.getName());
                    }
                    IEntityGroup parent = createUportalGroupFromGrouperGroup(g);
                    parents.add(parent);
                }
            }

            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug(
                        "Retrieved " + parents.size() + " parent groups of entity with key " + key);
            }

        } catch (Exception e) {
            LOGGER.warn(
                    "Exception while attempting to retrieve "
                            + "parents for entity with key "
                            + key
                            + " from Grouper web services: "
                            + e.getMessage());
            return Collections.<IEntityGroup>emptyList().iterator();
        }

        return parents.iterator();
    }
1136966
@GET
	@Path("getEntities")
	public List<EntityMetaData> getEntities(@QueryParam("path") String path) {
		String absolutePath = StorageConstants.NEXT_SERVER_ROOT + path;
		List<EntityMetaData> result = new ArrayList<EntityMetaData>();
		Entity[] entities = new Entity[0];
		try {
			entities = storageService.getEntityChildren(absolutePath);
		} catch (NotFoundException e) {
			// TODO
			e.printStackTrace();
		}
		
		List<Entity> list = Arrays.asList(entities);
		Collections.sort(list, new Comparator<Entity>() {
			public int compare(Entity e1, Entity e2) {
				if (e1 instanceof Folder) {
					if (e2 instanceof Folder) {
						return Collator.getInstance().compare(e1.getName(), e2.getName());
					} else {
						return -1;
					}
				} else {
					if (e2 instanceof Folder) {
						return 1;
					} else {
						return Collator.getInstance().compare(e1.getName(), e2.getName());
					}
				}
			}
		});
		
		for (Entity entity : list) {
			result.add(createMetaData(entity));
		}
		
		return  result;
	}
1203572
public Metadata getMetadata(String typeName) {
        String scope = Metadata.scopeBasedOnType(typeName);
        return this.getMetadata(typeName, scope);
    }
1070233
public Map<String, Object> all(String entityName, String groupId) throws MnoException {
		return all(entityName, groupId, null, getAuthenticatedClient());
	}
811140
@Override
    public Set<String> getEntityTypesForGroupType(String groupType) {

        // add the group type itself to the allowed list
        Set<String> set = new HashSet<String>();
        set.add(groupType);

        /*
         * If the supplied type is a person group, add the person entity type.
         * If the supplied type is a category, add the channel type.  Otherwise,
         * throw an exception.
         *
         * This method will require an update if more entity types are added
         * in the future.
         */

        EntityEnum type = EntityEnum.getEntityEnum(groupType);
        if (EntityEnum.GROUP.equals(type)) {
            set.add(EntityEnum.PERSON.toString());
        } else if (EntityEnum.CATEGORY.equals(type)) {
            set.add(EntityEnum.PORTLET.toString());
        } else {
            throw new IllegalArgumentException(
                    "Unable to determine a root entity for group type '" + groupType + "'");
        }

        return set;
    }
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();
        }
    }
377317
public List<Object> getEntities() {
		List<Object> entitiesList = new LinkedList<Object>();

		for (Result result : results) {
			entitiesList.add(result.getObject());
		}

		return entitiesList;
	}
540772
EntityType getEntityTypeBypassingRegistry(String entityTypeId) {
    return entityTypeId != null
        ? dataService.findOneById(
            ENTITY_TYPE_META_DATA, entityTypeId, getEntityTypeFetch(), EntityType.class)
        : null;
  }