use of org.hl7.gravity.refimpl.sdohexchange.util.FhirUtil in project Gravity-SDOH-Exchange-RI by FHIR.
the class ResourceLoader method getResources.
public Map<Class<? extends Resource>, List<Resource>> getResources(IGenericClient client, List<Reference> references) {
if (references.isEmpty()) {
return Collections.emptyMap();
}
Bundle loadResourcesBundle = new Bundle();
loadResourcesBundle.setType(BundleType.TRANSACTION);
references.stream().map(BaseReference::getReferenceElement).map(element -> element.getResourceType() + "/" + element.getIdPart()).map(FhirUtil::createGetEntry).forEach(loadResourcesBundle::addEntry);
return client.transaction().withBundle(loadResourcesBundle).execute().getEntry().stream().map(BundleEntryComponent::getResource).filter(Objects::nonNull).collect(Collectors.groupingBy(Resource::getClass));
}
Aggregations