
Package ca.uhn.fhir.jpa.util
Class ResourceCompartmentUtil
java.lang.Object
ca.uhn.fhir.jpa.util.ResourceCompartmentUtil
-
Constructor Summary
Constructors -
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 theResourceDef) Returns aRuntimeSearchParamlist with the parameters extracted from the receivedRuntimeResourceDefinition, which are of type REFERENCE and have a membership compartment for "Patient" resourcestatic List<ca.uhn.fhir.context.RuntimeSearchParam> getPatientCompartmentSearchParams(ca.uhn.fhir.context.RuntimeResourceDefinition theResourceDef, boolean theIncludeSupersets) Returns aRuntimeSearchParamlist 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 resourcestatic Stream<org.hl7.fhir.instance.model.api.IBaseReference> getResourceCompartmentReferences(org.hl7.fhir.instance.model.api.IBaseResource theResource, List<ca.uhn.fhir.context.RuntimeSearchParam> theCompartmentSps, ISearchParamExtractor mySearchParamExtractor)
-
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
-
getResourceCompartmentReferences
@Nonnull public static Stream<org.hl7.fhir.instance.model.api.IBaseReference> getResourceCompartmentReferences(org.hl7.fhir.instance.model.api.IBaseResource theResource, List<ca.uhn.fhir.context.RuntimeSearchParam> theCompartmentSps, ISearchParamExtractor mySearchParamExtractor) -
getPatientCompartmentSearchParams
@Nonnull public static List<ca.uhn.fhir.context.RuntimeSearchParam> getPatientCompartmentSearchParams(@Nonnull ca.uhn.fhir.context.RuntimeResourceDefinition theResourceDef) Returns aRuntimeSearchParamlist with the parameters extracted from the receivedRuntimeResourceDefinition, which are of type REFERENCE and have a membership compartment for "Patient" resource- Parameters:
theResourceDef- the RuntimeResourceDefinition providing the RuntimeSearchParam list- Returns:
- the RuntimeSearchParam filtered list
-
getPatientCompartmentSearchParams
@Nonnull public static List<ca.uhn.fhir.context.RuntimeSearchParam> getPatientCompartmentSearchParams(@Nonnull ca.uhn.fhir.context.RuntimeResourceDefinition theResourceDef, boolean theIncludeSupersets) Returns aRuntimeSearchParamlist with the parameters extracted from the receivedRuntimeResourceDefinition, which are of type REFERENCE and have a membership compartment for "Patient" resource- Parameters:
theResourceDef- the RuntimeResourceDefinition providing the RuntimeSearchParam listtheIncludeSupersets- Iffalse, include only the parameters explicitly defined as being a part of the Patient compartment. Iftrue, include other parameters whose path would include the same resources. For example, for theObservationresource type, the superset would include both thesubjectandpatientparameters, where the non-superset would include only thepatientparameter.- Returns:
- the RuntimeSearchParam filtered list
- Since:
- 8.6.0
-