/** * Constructs a map of vocabularies, categorized according to their type. * * @return a map where the key is the vocabulary category, and the value is the collection of {@link Vocabulary * vocabularies} implementing that category */ private Map<String, Set<Vocabulary>> constructVocabulariesByCategory() { final Map<String, Set<Vocabulary>> categorizedVocabularies = new HashMap<>(); for (final Vocabulary vocabulary : this.vocabularies.get().values()) { final Collection<String> supportedCategories = vocabulary.getSupportedCategories(); for (final String category : supportedCategories) { final Set<Vocabulary> vocabularySet = generateVocabSetForCategory(category, categorizedVocabularies); vocabularySet.add(vocabulary); } } return Collections.unmodifiableMap(categorizedVocabularies); }
/** * Returns a list of {@link org.phenotips.vocabularies.rest.model.Category} for a specified vocabulary. * * @param vocab a {@link Vocabulary} of interest * @return a list of {@link org.phenotips.vocabularies.rest.model.Category} associated with the {@code vocab} */ private List<org.phenotips.vocabularies.rest.model.Category> getCategoriesForVocabulary(final Vocabulary vocab) { final Collection<String> categories = vocab.getSupportedCategories(); return this.objectFactory.createCategoriesRepresentation(categories, getCategoryLinks(), null); }
/** * Returns a list of {@link org.phenotips.vocabularies.rest.model.Category} for a specified vocabulary. * * @param vocab a {@link Vocabulary} of interest * @return a list of {@link org.phenotips.vocabularies.rest.model.Category} associated with the {@code vocab} */ private List<org.phenotips.vocabularies.rest.model.Category> getCategoriesForVocabulary(final Vocabulary vocab) { final Collection<String> categories = vocab.getSupportedCategories(); return this.objectFactory.createCategoriesRepresentation(categories, getCategoryLinks(), null); }