/** * Converts a {@link Bundle} into a map grouped by the entry resources types * * @param bundle Bundle * @return map of entries grouped by their resource type */ public static Map<ResourceType, List<Bundle.BundleEntryComponent>> getBundleEntries(Bundle bundle) { return bundle.getEntry().stream() .collect(Collectors.groupingBy(entry -> { Bundle.BundleEntryRequestComponent request = entry.getRequest(); if (request == null || request.getUrl() == null) { throw unprocessableEntity( OperationOutcome.IssueSeverity.ERROR, OperationOutcome.IssueType.INVALID, null, null, "Invalid bundle entry request element %s", entry); } return entry.getResource().getResourceType(); } , LinkedHashMap::new, Collectors.toList())); }
public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent(); copyElement(src, tgt); tgt.setMethod(convertHTTPVerb(src.getMethod())); tgt.setUrl(src.getUrl()); if (src.hasIfNoneMatch()) tgt.setIfNoneMatch(src.getIfNoneMatch()); if (src.hasIfModifiedSince()) tgt.setIfModifiedSince(src.getIfModifiedSince()); if (src.hasIfMatch()) tgt.setIfMatch(src.getIfMatch()); if (src.hasIfNoneExist()) tgt.setIfNoneExist(src.getIfNoneExist()); return tgt; }
public org.hl7.fhir.instance.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.instance.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.instance.model.Bundle.BundleEntryRequestComponent(); copyElement(src, tgt); tgt.setMethod(convertHTTPVerb(src.getMethod())); tgt.setUrl(src.getUrl()); tgt.setIfNoneMatch(src.getIfNoneMatch()); tgt.setIfModifiedSince(src.getIfModifiedSince()); tgt.setIfMatch(src.getIfMatch()); tgt.setIfNoneExist(src.getIfNoneExist()); return tgt; }
@Override public String getEntryRequestUrl(Bundle.BundleEntryComponent theEntry) { return theEntry.getRequest().getUrl(); }
public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent(); copyElement(src, tgt); tgt.setMethod(convertHTTPVerb(src.getMethod())); tgt.setUrl(src.getUrl()); if (src.hasIfNoneMatch()) tgt.setIfNoneMatch(src.getIfNoneMatch()); if (src.hasIfModifiedSince()) tgt.setIfModifiedSince(src.getIfModifiedSince()); if (src.hasIfMatch()) tgt.setIfMatch(src.getIfMatch()); if (src.hasIfNoneExist()) tgt.setIfNoneExist(src.getIfNoneExist()); return tgt; }
public org.hl7.fhir.instance.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.instance.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.instance.model.Bundle.BundleEntryRequestComponent(); copyElement(src, tgt); tgt.setMethod(convertHTTPVerb(src.getMethod())); tgt.setUrl(src.getUrl()); tgt.setIfNoneMatch(src.getIfNoneMatch()); tgt.setIfModifiedSince(src.getIfModifiedSince()); tgt.setIfMatch(src.getIfMatch()); tgt.setIfNoneExist(src.getIfNoneExist()); return tgt; }
@Override public String getEntryRequestUrl(Bundle.BundleEntryComponent theEntry) { return theEntry.getRequest().getUrl(); }