Class ResourceUtil

java.lang.Object
ca.uhn.fhir.util.ResourceUtil

public class ResourceUtil extends Object
  • Field Details

  • Method Details

    • removeNarrative

      public static void removeNarrative(FhirContext theContext, IBaseResource theInput)
      This method removes the narrative from the resource, or if the resource is a bundle, removes the narrative from all of the resources in the bundle
      Parameters:
      theContext - The fhir context
      theInput - The resource to remove the narrative from
    • addRawDataToResource

      public static void addRawDataToResource(@Nonnull IBaseResource theResource, @Nonnull EncodingEnum theEncodingType, String theSerializedData)
    • getEncodingTypeFromUserData

      public static EncodingEnum getEncodingTypeFromUserData(@Nonnull IBaseResource theResource)
    • getRawStringFromResourceOrNull

      public static String getRawStringFromResourceOrNull(@Nonnull IBaseResource theResource)
    • mergeAllFields

      public static void mergeAllFields(FhirContext theFhirContext, IBase theSource, IBase theTarget)
      Merges all fields on the provided instance. theTarget will contain a union of all values from theSource instance and theTarget instance.
      Parameters:
      theFhirContext - Context holding resource definition
      theSource - The FHIR element to merge the fields from
      theTarget - The FHIR element to merge the fields into
    • mergeAllFields

      public static void mergeAllFields(FhirContext theFhirContext, IBase theSource, IBase theTarget, ResourceUtil.MergeControlParameters theMergeControlParameters)
      Merges all fields on the provided instance. theTarget will contain a union of all values from theSource instance and theTarget instance.
      Parameters:
      theFhirContext - Context holding resource definition
      theSource - The FHIR element to merge the fields from
      theTarget - The FHIR element to merge the fields into
      theMergeControlParameters - Parameters to provide fine-grained control over the behaviour of the merge
    • mergeFields

      public static void mergeFields(FhirContext theFhirContext, IBase theSource, IBase theTarget, Predicate<String> theInclusionStrategy)
      Merges values of all field from theSource resource to theTarget resource. Fields values are compared via the equalsDeep method, or via object identity if this method is not available.
      Parameters:
      theFhirContext - Context holding resource definition
      theSource - Resource to merge the specified field from
      theTarget - Resource to merge the specified field into
      theInclusionStrategy - Predicate to test which fields should be merged
    • mergeFields

      public static void mergeFields(FhirContext theFhirContext, IBase theSource, IBase theTarget, Predicate<String> theInclusionStrategy, ResourceUtil.MergeControlParameters theMergeControlParameters)
      Merges values of all field from theSource resource to theTarget resource. Fields with type Coding or CodeableConcept will be recursively merged according to the strategy specified by theMergeControlParameters. Fields of other types are compared via the equalsDeep method, or via object identity if this method is not available.
      Parameters:
      theFhirContext - Context holding resource definition
      theSource - Resource to merge the specified field from
      theTarget - Resource to merge the specified field into
      theInclusionStrategy - Predicate to test which fields should be merged
      theMergeControlParameters - Parameters to provide fine-grained control over the behaviour of the merge
    • mergeField

      public static void mergeField(FhirContext theFhirContext, String theFieldName, IBaseResource theSource, IBaseResource theTarget)
      Merges value of the specified field from theSource resource to theTarget resource. Fields values are compared via the equalsDeep method, or via object identity if this method is not available.
      Parameters:
      theFhirContext - Context holding resource definition
      theFieldName - Name of the child filed to merge
      theSource - Resource to merge the specified field from
      theTarget - Resource to merge the specified field into
    • mergeField

      public static void mergeField(FhirContext theFhirContext, String theFieldName, IBaseResource theSource, IBaseResource theTarget, ResourceUtil.MergeControlParameters theMergeControlParameters)
      Merges value of the specified field from theSource resource to theTarget resource. Fields with type Coding or CodeableConcept will be recursively merged according to the strategy specified by theMergeControlParameters. Fields of other types are compared via the equalsDeep method, or via object identity if this method is not available.
      Parameters:
      theFhirContext - Context holding resource definition
      theFieldName - Name of the child filed to merge
      theSource - Resource to merge the specified field from
      theTarget - Resource to merge the specified field into
      theMergeControlParameters - Parameters to provide fine-grained control over the behaviour of the merge