List of usage examples for org.apache.commons.collections4 MultiValuedMap put
boolean put(K key, V value);
From source file:org.openecomp.sdc.vendorlicense.licenseartifacts.impl.VendorLicenseArtifactsServiceImpl.java
private static MultiValuedMap<String, VersionableEntity> mapById( Collection<? extends VersionableEntity> versionableEntities) { MultiValuedMap<String, VersionableEntity> mappedById = new ArrayListValuedHashMap<>(); for (VersionableEntity ve : versionableEntities) { mappedById.put(ve.getId(), ve); }/*from w ww .j a v a 2s . c o m*/ return mappedById; }
From source file:org.phenotips.vocabulary.AbstractCSVAnnotationsExtension.java
/** * Processes and caches the row data. By default, it simply copies every mapped value from the row. Override if * further processing of the data is needed. * * @param row the {@link CSVRecord data row} to process * @param vocabulary the vocabulary being indexed *///w w w .jav a2 s . c om protected void processCSVRecordRow(final CSVRecord row, final Vocabulary vocabulary) { Map<String, String> csvData = row.toMap(); MultiValuedMap<String, String> termData = this.data.get(row.get(ID_KEY)); if (termData == null) { termData = new ArrayListValuedHashMap<>(); this.data.put(row.get(ID_KEY), termData); } for (Map.Entry<String, String> item : csvData.entrySet()) { if (!ID_KEY.equals(item.getKey()) && StringUtils.isNoneBlank(item.getKey(), item.getValue())) { termData.put(item.getKey(), item.getValue()); } } }
From source file:org.phenotips.vocabulary.internal.hpoannotations.AbstractPhenotypeForDiseaseAnnotationsExtension.java
@Override protected void processCSVRecordRow(@Nonnull final CSVRecord row, @Nonnull final Vocabulary vocabulary) { // The annotation source file contains data for several disorder databases. Only want to look at data that is // relevant for the current vocabulary. final String dbName = getRowItem(row, VOCABULARY_ID_COLUMN); if (StringUtils.isNotBlank(dbName)) { String diseaseId = getRowItem(row, TERM_ID_COLUMN); final String symptomId = getRowItem(row, PHENOTYPE_COLUMN); if (StringUtils.isNotBlank(diseaseId) && StringUtils.isNotBlank(symptomId)) { diseaseId = vocabularyIdToTermPrefix(dbName) + diseaseId; MultiValuedMap<String, String> termData = this.data.get(diseaseId); if (termData == null) { termData = new HashSetValuedHashMap<>(); this.data.put(diseaseId, termData); }//from www. ja v a2s . co m termData.put(getDirectPhenotypesLabel(), symptomId); termData.putAll(getAllAncestorPhenotypesLabel(), getSelfAndAncestorTermIds(symptomId)); } } }