Package ca.uhn.fhir.jpa.util
Class ResourceCompartmentUtil
java.lang.Object
ca.uhn.fhir.jpa.util.ResourceCompartmentUtil
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetPatientCompartmentIdentity
(org.hl7.fhir.instance.model.api.IBaseResource theResource, ca.uhn.fhir.context.FhirContext theFhirContext, ISearchParamExtractor theSearchParamExtractor) Extract, if exists, the patient compartment identity of the received resource.static List
<ca.uhn.fhir.context.RuntimeSearchParam> getPatientCompartmentSearchParams
(ca.uhn.fhir.context.RuntimeResourceDefinition resourceDef) Returns aRuntimeSearchParam
list with the parameters extracted from the receivedRuntimeResourceDefinition
, which are of type REFERENCE and have a membership compartment for "Patient" resourcegetResourceCompartment
(String theCompartmentName, org.hl7.fhir.instance.model.api.IBaseResource theResource, List<ca.uhn.fhir.context.RuntimeSearchParam> theCompartmentSps, ISearchParamExtractor mySearchParamExtractor) Extracts and returns an optional compartment of the received resource
-
Constructor Details
-
ResourceCompartmentUtil
public ResourceCompartmentUtil()
-
-
Method Details
-
getPatientCompartmentIdentity
public static Optional<String> getPatientCompartmentIdentity(org.hl7.fhir.instance.model.api.IBaseResource theResource, ca.uhn.fhir.context.FhirContext theFhirContext, ISearchParamExtractor theSearchParamExtractor) Extract, if exists, the patient compartment identity of the received resource. It must be invoked in patient compartment mode.- Parameters:
theResource
- the resource to which extract the patient compartment identitytheFhirContext
- the active FhirContexttheSearchParamExtractor
- the configured search parameter extractor- Returns:
- the optional patient compartment identifier
- Throws:
ca.uhn.fhir.rest.server.exceptions.MethodNotAllowedException
- if received resource is of type "Patient" and ID is not assigned.
-
getResourceCompartment
public static Optional<String> getResourceCompartment(String theCompartmentName, org.hl7.fhir.instance.model.api.IBaseResource theResource, List<ca.uhn.fhir.context.RuntimeSearchParam> theCompartmentSps, ISearchParamExtractor mySearchParamExtractor) Extracts and returns an optional compartment of the received resource- Parameters:
theCompartmentName
- the name of the compartmenttheResource
- source resource which compartment is extractedtheCompartmentSps
- the RuntimeSearchParam list involving the searched compartmentmySearchParamExtractor
- the ISearchParamExtractor to be used to extract the parameter values- Returns:
- optional compartment of the received resource
-
getPatientCompartmentSearchParams
@Nonnull public static List<ca.uhn.fhir.context.RuntimeSearchParam> getPatientCompartmentSearchParams(ca.uhn.fhir.context.RuntimeResourceDefinition resourceDef) Returns aRuntimeSearchParam
list with the parameters extracted from the receivedRuntimeResourceDefinition
, which are of type REFERENCE and have a membership compartment for "Patient" resource- Parameters:
resourceDef
- the RuntimeResourceDefinition providing the RuntimeSearchParam list- Returns:
- the RuntimeSearchParam filtered list
-