/** * Returns a set with {@code termId} and the IDs of its ancestor terms. * * @param termId the term ID * @return a set with {@code termId} and the IDs of all its ancestor terms */ private Collection<String> getSelfAndAncestorTermIds(@Nonnull final String termId) { // The collection that will contain termId and the IDs of its ancestors. final Collection<String> ancestors = new HashSet<>(); ancestors.add(termId); // Find the term in the vocabulary, and if it exists, retrieve its ancestors, if any. final VocabularyTerm vocabularyTerm = this.vocabularyManager.resolveTerm(termId); if (vocabularyTerm != null) { for (VocabularyTerm ancestor : vocabularyTerm.getAncestors()) { ancestors.add(ancestor.getId()); } } else { this.logger.warn("Could not find term with ID: {} in indexed vocabularies.", termId); } return ancestors; }
/** * Returns a set with {@code termId} and the IDs of its ancestor terms. * * @param termId the term ID * @return a set with {@code termId} and the IDs of all its ancestor terms */ private Collection<String> getSelfAndAncestorTermIds(@Nonnull final String termId) { // The collection that will contain termId and the IDs of its ancestors. final Collection<String> ancestors = new HashSet<>(); ancestors.add(termId); // Find the term in the vocabulary, and if it exists, retrieve its ancestors, if any. final VocabularyTerm vocabularyTerm = this.vocabularyManager.resolveTerm(termId); if (vocabularyTerm != null) { for (VocabularyTerm ancestor : vocabularyTerm.getAncestors()) { ancestors.add(ancestor.getId()); } } else { this.logger.warn("Could not find term with ID: {} in indexed vocabularies.", termId); } return ancestors; }