
Package ca.uhn.fhir.util
Class ResourceUtil
java.lang.Object
ca.uhn.fhir.util.ResourceUtil
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA strategy object that specifies which rules to apply when mergingCodingandCodeableConceptfields -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddRawDataToResource(IBaseResource theResource, EncodingEnum theEncodingType, String theSerializedData) static EncodingEnumgetEncodingTypeFromUserData(IBaseResource theResource) static StringgetRawStringFromResourceOrNull(IBaseResource theResource) static voidmergeAllFields(FhirContext theFhirContext, IBase theSource, IBase theTarget) Merges all fields on the provided instance.static voidmergeAllFields(FhirContext theFhirContext, IBase theSource, IBase theTarget, ResourceUtil.MergeControlParameters theMergeControlParameters) Merges all fields on the provided instance.static voidmergeField(FhirContext theFhirContext, String theFieldName, IBaseResource theSource, IBaseResource theTarget) Merges value of the specified field fromtheSourceresource totheTargetresource.static voidmergeField(FhirContext theFhirContext, String theFieldName, IBaseResource theSource, IBaseResource theTarget, ResourceUtil.MergeControlParameters theMergeControlParameters) Merges value of the specified field fromtheSourceresource totheTargetresource.static voidmergeFields(FhirContext theFhirContext, IBase theSource, IBase theTarget, Predicate<String> theInclusionStrategy) Merges values of all field fromtheSourceresource totheTargetresource.static voidmergeFields(FhirContext theFhirContext, IBase theSource, IBase theTarget, Predicate<String> theInclusionStrategy, ResourceUtil.MergeControlParameters theMergeControlParameters) Merges values of all field fromtheSourceresource totheTargetresource.static voidremoveNarrative(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
-
Field Details
-
DATA_ABSENT_REASON_EXTENSION_URI
- See Also:
-
INCLUDE_ALL
Exclusion predicate for keeping all fields.
-
-
Method Details
-
removeNarrative
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 contexttheInput- The resource to remove the narrative from
-
addRawDataToResource
public static void addRawDataToResource(@Nonnull IBaseResource theResource, @Nonnull EncodingEnum theEncodingType, String theSerializedData) -
getEncodingTypeFromUserData
-
getRawStringFromResourceOrNull
-
mergeAllFields
Merges all fields on the provided instance.theTargetwill contain a union of all values fromtheSourceinstance andtheTargetinstance.- Parameters:
theFhirContext- Context holding resource definitiontheSource- The FHIR element to merge the fields fromtheTarget- 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.theTargetwill contain a union of all values fromtheSourceinstance andtheTargetinstance.- Parameters:
theFhirContext- Context holding resource definitiontheSource- The FHIR element to merge the fields fromtheTarget- The FHIR element to merge the fields intotheMergeControlParameters- 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 fromtheSourceresource totheTargetresource. Fields values are compared via the equalsDeep method, or via object identity if this method is not available.- Parameters:
theFhirContext- Context holding resource definitiontheSource- Resource to merge the specified field fromtheTarget- Resource to merge the specified field intotheInclusionStrategy- 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 fromtheSourceresource totheTargetresource. Fields with typeCodingorCodeableConceptwill be recursively merged according to the strategy specified bytheMergeControlParameters. 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 definitiontheSource- Resource to merge the specified field fromtheTarget- Resource to merge the specified field intotheInclusionStrategy- Predicate to test which fields should be mergedtheMergeControlParameters- 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 fromtheSourceresource totheTargetresource. Fields values are compared via the equalsDeep method, or via object identity if this method is not available.- Parameters:
theFhirContext- Context holding resource definitiontheFieldName- Name of the child filed to mergetheSource- Resource to merge the specified field fromtheTarget- 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 fromtheSourceresource totheTargetresource. Fields with typeCodingorCodeableConceptwill be recursively merged according to the strategy specified bytheMergeControlParameters. 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 definitiontheFieldName- Name of the child filed to mergetheSource- Resource to merge the specified field fromtheTarget- Resource to merge the specified field intotheMergeControlParameters- Parameters to provide fine-grained control over the behaviour of the merge
-