/** * Constructs a map of vocabularies, where each vocabulary is also listed under each of its aliases. * * @return a map where the key is a vocabulary name or alias, and the value is the {@link Vocabulary} with that name * or alias */ private Map<String, Vocabulary> constructVocabulariesByAlias() { Map<String, Vocabulary> aliasVocabularies = new HashMap<>(); for (Vocabulary vocabulary : this.vocabularies.get().values()) { for (String alias : vocabulary.getAliases()) { aliasVocabularies.put(alias, vocabulary); } } return aliasVocabularies; }
@Override public org.phenotips.vocabularies.rest.model.Vocabulary createVocabularyRepresentation(Vocabulary vocabulary) { org.phenotips.vocabularies.rest.model.Vocabulary result = new org.phenotips.vocabularies.rest.model.Vocabulary(); result .withIdentifier(vocabulary.getIdentifier()) .withName(vocabulary.getName()) .withAliases(vocabulary.getAliases()) .withSize(vocabulary.size()) .withVersion(vocabulary.getVersion()); try { result.withDefaultSourceLocation(vocabulary.getDefaultSourceLocation()); } catch (UnsupportedOperationException e) { // Don't do anything and leave source empty } return result; }
@Override public org.phenotips.vocabularies.rest.model.Vocabulary createVocabularyRepresentation(Vocabulary vocabulary) { org.phenotips.vocabularies.rest.model.Vocabulary result = new org.phenotips.vocabularies.rest.model.Vocabulary(); result .withIdentifier(vocabulary.getIdentifier()) .withName(vocabulary.getName()) .withAliases(vocabulary.getAliases()) .withSize(vocabulary.size()) .withVersion(vocabulary.getVersion()); try { result.withDefaultSourceLocation(vocabulary.getDefaultSourceLocation()); } catch (UnsupportedOperationException e) { // Don't do anything and leave source empty } return result; }