
Package ca.uhn.fhir.util
Class BundleUtil
- java.lang.Object
-
- ca.uhn.fhir.util.BundleUtil
-
public class BundleUtil extends Object
Fetch resources from a bundle
-
-
Constructor Summary
Constructors Constructor Description BundleUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<org.apache.commons.lang3.tuple.Pair<String,IBaseResource>>
getBundleEntryUrlsAndResources(FhirContext theContext, IBaseBundle theBundle)
static String
getBundleType(FhirContext theContext, IBaseBundle theBundle)
static String
getLinkUrlOfType(FhirContext theContext, IBaseBundle theBundle, String theLinkRelation)
static Integer
getTotal(FhirContext theContext, IBaseBundle theBundle)
static boolean
isDstu3TransactionPatch(FhirContext theContext, IBaseResource thePayloadResource)
DSTU3 did not allow the PATCH verb for transaction bundles- so instead we infer that a bundle is a patch if the payload is a binary resource containing a patch.static void
processEntries(FhirContext theContext, IBaseBundle theBundle, Consumer<ModifiableBundleEntry> theProcessor)
static void
setBundleType(FhirContext theContext, IBaseBundle theBundle, String theType)
static void
setTotal(FhirContext theContext, IBaseBundle theBundle, Integer theTotal)
static List<BundleEntryParts>
toListOfEntries(FhirContext theContext, IBaseBundle theBundle)
Extract all of the resources from a given bundlestatic List<IBaseResource>
toListOfResources(FhirContext theContext, IBaseBundle theBundle)
Extract all of the resources from a given bundlestatic <T extends IBaseResource>
List<T>toListOfResourcesOfType(FhirContext theContext, IBaseBundle theBundle, Class<T> theTypeToInclude)
Extract all of the resources of a given type from a given bundle
-
-
-
Constructor Detail
-
BundleUtil
public BundleUtil()
-
-
Method Detail
-
getLinkUrlOfType
public static String getLinkUrlOfType(FhirContext theContext, IBaseBundle theBundle, String theLinkRelation)
- Returns:
- Returns
null
if the link isn't found or has no value
-
getBundleEntryUrlsAndResources
public static List<org.apache.commons.lang3.tuple.Pair<String,IBaseResource>> getBundleEntryUrlsAndResources(FhirContext theContext, IBaseBundle theBundle)
-
getBundleType
public static String getBundleType(FhirContext theContext, IBaseBundle theBundle)
-
setBundleType
public static void setBundleType(FhirContext theContext, IBaseBundle theBundle, String theType)
-
getTotal
public static Integer getTotal(FhirContext theContext, IBaseBundle theBundle)
-
setTotal
public static void setTotal(FhirContext theContext, IBaseBundle theBundle, Integer theTotal)
-
toListOfEntries
public static List<BundleEntryParts> toListOfEntries(FhirContext theContext, IBaseBundle theBundle)
Extract all of the resources from a given bundle
-
processEntries
public static void processEntries(FhirContext theContext, IBaseBundle theBundle, Consumer<ModifiableBundleEntry> theProcessor)
-
toListOfResources
public static List<IBaseResource> toListOfResources(FhirContext theContext, IBaseBundle theBundle)
Extract all of the resources from a given bundle
-
toListOfResourcesOfType
public static <T extends IBaseResource> List<T> toListOfResourcesOfType(FhirContext theContext, IBaseBundle theBundle, Class<T> theTypeToInclude)
Extract all of the resources of a given type from a given bundle
-
isDstu3TransactionPatch
public static boolean isDstu3TransactionPatch(FhirContext theContext, IBaseResource thePayloadResource)
DSTU3 did not allow the PATCH verb for transaction bundles- so instead we infer that a bundle is a patch if the payload is a binary resource containing a patch. This method tests whether a resource (which should have come fromBundle.entry.resource
is a Binary resource with a patch payload type.
-
-