Given a set of IDs, return a set that contains all of the IDs, the
parents of those IDs, the grandparents, etc.

@param termIds
The initial "seed" IDs.
@return The full set of IDs.
776576
public Set<String> getIdsForIdsWithAncestors(Collection<String> termIds) {
        Stack<String> idsToConsider = new Stack<String>();
        idsToConsider.addAll(termIds);
        Set<String> resultIds = new HashSet<String>();
        while (!idsToConsider.isEmpty()) {
            String id = idsToConsider.pop();
            if (!resultIds.contains(id)) {
                resultIds.add(id);
                if (terms.containsKey(id))
                    idsToConsider.addAll(terms.get(id).getIsA());
            }
        }
        return resultIds;
    }
704126
public List<Term> getAllTerms() {
        List<Term> ret = new ArrayList<Term>();

        if (terms != null) {
            ret.addAll(terms);
            for (final Term term : terms) {
                ret.addAll(term.getAllTerms());
            }
        }

        return ret;
    }
1050212
public List<T> list(List<Long> ids)
    {
        List<T> ret = new ArrayList<T>();

        if(ids != null)
        {
            for(Long id : ids)
            {
                T resource = get(id);
                if(resource != null)
                    ret.add(resource);
            }
        }

        return ret;
    }
1156771
public static Iterator findParentGroups(IGroupMember gm) throws GroupsException {
        LOGGER.trace("Invoking findParentGroups for IGroupMember [{}]", gm);
        return instance().ifindParentGroups(gm);
    }
678826
protected String genIdString (int[] userIds)
    {
        // build up the string we need for the query
        StringBuilder ids = new StringBuilder();
        for (int i = 0; i < userIds.length; i++) {
            if (ids.length() > 0) {
                ids.append(",");
            }
            ids.append(userIds[i]);
        }

        return ids.toString();
    }
905962
public QueryBuilder addParentIds(final Collection<Integer> ids) {
        if (ids != null) {
            parentIds.addAll(ids);
        }
        return this;
    }
277871
public java.util.List<String> getIds() {
        if (ids == null) {
            ids = new com.amazonaws.internal.SdkInternalList<String>();
        }
        return ids;
    }
870211
public function getCollectionParentIDs()
    {
        $cIDs = array($this->cParentID);
        $db = Database::connection();
        $aliasedParents = $db->fetchAll('SELECT cParentID FROM Pages WHERE cPointerID = ?', array($this->cID));
        foreach ($aliasedParents as $aliasedParent) {
            $cIDs[] = $aliasedParent['cParentID'];
        }

        return $cIDs;
    }
103386
public Set<N> getParents(N n)
    {
        Pair<HashSet<N>, HashSet<N>> p = nodes.get(n);
        
        if(p == null)
            return null;
        
        return p.getIncoming();
    }
829700
public StringArray getFirstIds() {
    if (Cooccurrence_Type.featOkTst && ((Cooccurrence_Type)jcasType).casFeat_firstIds == null)
      jcasType.jcas.throwFeatMissing("firstIds", "ch.epfl.bbp.uima.types.Cooccurrence");
    return (StringArray)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefValue(addr, ((Cooccurrence_Type)jcasType).casFeatCode_firstIds)));}
1229049
private String getPrimaryGroupId(List<String> uniqueGroupIds) {
        return uniqueGroupIds.isEmpty() ? null : uniqueGroupIds.get(0);
    }
246422
@SuppressWarnings("unchecked")
    private String[] getGroupIds(WSCredential cred) {
        Collection<String> ids = null;
        if (cred != null) {
            try {
                ids = cred.getGroupIds();
            } catch (CredentialExpiredException e) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Caught exception getting the group access ids: " + e);
                }
            } catch (CredentialDestroyedException e) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Caught exception getting the group access ids: " + e);
                }
            }
            if (ids != null) {
                return ids.toArray(new String[ids.size()]);
            }
        }
        return null;
        // TODO if ignoreCase is Collection, then lower case the groupids
    }
1055210
private Set<String> searchForIds(Context context, BooleanQuery query, ConsistencyLevel readConsistency) {
        Set<String> ids = Sets.newTreeSet();

        for (BooleanClause clause : query.getClauses()) {
            Set<String> subQueryIds;

            Query subQuery = clause.getQuery();
            if (subQuery instanceof BooleanQuery) {
                subQueryIds = searchForIds(context, (BooleanQuery)subQuery, readConsistency);
            } else if (subQuery instanceof TermQuery) {
                subQueryIds = searchForIds(context, (TermQuery)subQuery, readConsistency);
            } else {
                throw new IllegalStateException("Unsupported query: " + subQuery);
            }

            switch (clause.getOperator()) {
                case AND: // Intersect
                    ids.retainAll(subQueryIds);
                    break;
                case OR: // Union
                    ids.addAll(subQueryIds);
                    break;
                default:
                    throw new IllegalStateException("Unsupported operator: " + clause.getOperator());
            }
        }

        return ids;
    }
1009818
private Set<String> searchForIds(Context context, TermQuery query, ConsistencyLevel readConsistency) {
        Set<String> ids = Sets.newTreeSet();

        BoundStatement bindStatement = m_searchStatement.bind();
        bindStatement.setString(Schema.C_TERMS_CONTEXT, context.getId());
        bindStatement.setString(Schema.C_TERMS_FIELD, query.getTerm().getField(Constants.DEFAULT_TERM_FIELD));
        bindStatement.setString(Schema.C_TERMS_VALUE, query.getTerm().getValue());
        bindStatement.setConsistencyLevel(readConsistency);

        for (Row row : m_session.execute(bindStatement)) {
            ids.add(row.getString(Constants.Schema.C_TERMS_RESOURCE));
        }

        return ids;
    }
1236462
public List<MetadataReference> queryByMetadataParent(long parentId)
			throws SQLException {

		QueryBuilder<MetadataReference, Void> qb = queryBuilder();
		qb.where().eq(MetadataReference.COLUMN_PARENT_ID, parentId);
		List<MetadataReference> metadataReferences = qb.query();

		return metadataReferences;
	}
706629
public List<String> getStringChildren(Long parentId) {
		ArrayList<String> strings = new ArrayList<>();
		List<StringEntity> entities = getByField(Column.PARENT_ID, parentId);
		for (StringEntity entity : entities) {
			strings.add(entity.getValue());
		}
		return strings;
	}
1011803
public List<Relation> getRelations(Collection<Long> relationIds)
	{
		if(relationIds.isEmpty()) return Collections.emptyList();
		return getSomeElements(RELATION + "s?" + RELATION + "s=" + toCommaList(relationIds), Relation.class);
	}