/** * Retrieves a list of vocabulary ids that are available for use with {@link #getVocabulary(String)}. * * @return a list of {@link Vocabulary#getIdentifier() vocabulary identifiers}, one for each vocabulary * @since 1.3 */ public List<String> getAvailableVocabularies() { return this.manager.getAvailableVocabularies(); }
@Override public Vocabularies getAllVocabularies() { Vocabularies result = new Vocabularies(); List<String> vocabularyIDs = this.vm.getAvailableVocabularies(); List<org.phenotips.vocabularies.rest.model.Vocabulary> availableVocabs = vocabularyIDs.stream() .map(vocabularyID -> this.vm.getVocabulary(vocabularyID)) .map(vocab -> this.objectFactory.createLinkedVocabularyRepresentation(vocab, getVocabularyLinks(), this::getCategoriesForVocabulary)) .collect(Collectors.toList()); result.withVocabularies(availableVocabs); result.withLinks(this.autolinker.get().forResource(getClass(), this.uriInfo).build()); return result; }
@Override public Vocabularies getAllVocabularies() { Vocabularies result = new Vocabularies(); List<String> vocabularyIDs = this.vm.getAvailableVocabularies(); List<org.phenotips.vocabularies.rest.model.Vocabulary> availableVocabs = new ArrayList<>(); for (String vocabularyID : vocabularyIDs) { Vocabulary vocab = this.vm.getVocabulary(vocabularyID); org.phenotips.vocabularies.rest.model.Vocabulary rep = this.objectFactory.createVocabularyRepresentation(vocab); rep.withLinks(this.autolinker.get().forSecondaryResource(VocabularyResource.class, this.uriInfo) .withActionableResources(VocabularyTermSuggestionsResource.class) .withExtraParameters("vocabulary-id", vocabularyID) .withGrantedRight(userIsAdmin() ? Right.ADMIN : Right.VIEW) .build()); availableVocabs.add(rep); } result.withVocabularies(availableVocabs); result.withLinks(this.autolinker.get().forResource(getClass(), this.uriInfo).build()); return result; }