use of org.icgc.dcc.song.importer.model.PortalDonorMetadata in project SONG by overture-stack.
the class DonorDao method createDonorDao.
public static DonorDao createDonorDao(Iterable<PortalDonorMetadata> portalDonorMetadataIterable) {
val map = Maps.<String, PortalDonorMetadata>newHashMap();
for (val portalDonorMetadata : portalDonorMetadataIterable) {
val donorId = DonorConverter.getDonorId(portalDonorMetadata);
checkArgument(!map.containsKey(donorId), "Map cannot have duplicates for donorId [%s]", donorId);
map.put(donorId, portalDonorMetadata);
}
return createDonorDao(ImmutableMap.copyOf(map));
}
use of org.icgc.dcc.song.importer.model.PortalDonorMetadata in project SONG by overture-stack.
the class DonorFetcher method fetchPortalDonorMetadataSet.
public Set<PortalDonorMetadata> fetchPortalDonorMetadataSet(List<PortalFileMetadata> portalFileMetadataList) {
val donorSet = ImmutableSet.<PortalDonorMetadata>builder();
val donorIdSet = Sets.<String>newHashSet();
int numErrorDonorIds = 0;
for (val portalFileMetadata : portalFileMetadataList) {
val donorId = portalFileMetadata.getDonorId();
val fileId = portalFileMetadata.getFileId();
if (!donorIdSet.contains(donorId)) {
// Want to minimize redundant network traffic (fetching)
try {
val portalDonorMetadata = fetchPortalDonorMetadata(donorId);
donorSet.add(portalDonorMetadata);
} catch (Throwable t) {
log.error("DONOR_FETCH_ERROR[{}]: donorId [{}] data is malformed in FileId [{}]. Error recorded", ++numErrorDonorIds, donorId, fileId);
}
donorIdSet.add(donorId);
}
}
return donorSet.build();
}
Aggregations