
Package ca.uhn.fhir.replacereferences
Class ReplaceReferencesProvenanceSvc
java.lang.Object
ca.uhn.fhir.replacereferences.ReplaceReferencesProvenanceSvc
- Direct Known Subclasses:
MergeProvenanceSvc
This service is used to create a Provenance resource for the $replace-references operation
and also used as a base class for
MergeProvenanceSvc
used in $merge operations.
The two operations use different activity codes.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
createProvenance
(org.hl7.fhir.instance.model.api.IIdType theTargetId, org.hl7.fhir.instance.model.api.IIdType theSourceId, List<org.hl7.fhir.r4.model.Bundle> thePatchResultBundles, Date theStartTime, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, List<ca.uhn.fhir.model.api.IProvenanceAgent> theProvenanceAgents, List<org.hl7.fhir.instance.model.api.IBaseResource> theContainedResources) Creates a Provenance resource for the $replace-references and $merge operations.protected void
createProvenance
(org.hl7.fhir.instance.model.api.IIdType theTargetId, org.hl7.fhir.instance.model.api.IIdType theSourceId, List<org.hl7.fhir.r4.model.Bundle> thePatchResultBundles, Date theStartTime, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, List<ca.uhn.fhir.model.api.IProvenanceAgent> theProvenanceAgents, List<org.hl7.fhir.instance.model.api.IBaseResource> theContainedResources, boolean theCreateEvenWhenNoReferencesWereUpdated) protected org.hl7.fhir.r4.model.Provenance
createProvenanceObject
(org.hl7.fhir.r4.model.Reference theTargetReference, org.hl7.fhir.r4.model.Reference theSourceReference, List<org.hl7.fhir.r4.model.Reference> theUpdatedReferencingResources, Date theStartTime, List<ca.uhn.fhir.model.api.IProvenanceAgent> theProvenanceAgents, List<org.hl7.fhir.instance.model.api.IBaseResource> theContainedResources) protected List
<org.hl7.fhir.r4.model.Reference> extractUpdatedResourceReferences
(List<org.hl7.fhir.r4.model.Bundle> thePatchBundles) org.hl7.fhir.r4.model.Provenance
findProvenance
(org.hl7.fhir.instance.model.api.IIdType theTargetId, org.hl7.fhir.instance.model.api.IIdType theSourceId, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, String theOperationName) Finds a Provenance resource that contain the given target and source references, and with the activity code this class generates Provenance resource with.protected org.hl7.fhir.r4.model.CodeableConcept
protected List
<org.hl7.fhir.r4.model.Provenance> getProvenancesOfTargetsFilteredByActivity
(List<org.hl7.fhir.instance.model.api.IIdType> theTargetIds, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails) boolean
isTargetAndSourceInCorrectOrder
(org.hl7.fhir.r4.model.Provenance provenance, org.hl7.fhir.instance.model.api.IIdType theTargetId, org.hl7.fhir.instance.model.api.IIdType theSourceId) Checks if the first 'Provenance.target' reference matches theTargetId and the second matches theSourceId.
-
Field Details
-
ACTIVITY_CODE_SYSTEM
- See Also:
-
-
Constructor Details
-
ReplaceReferencesProvenanceSvc
-
-
Method Details
-
getActivityCodeableConcept
-
createProvenanceObject
protected org.hl7.fhir.r4.model.Provenance createProvenanceObject(org.hl7.fhir.r4.model.Reference theTargetReference, @Nullable org.hl7.fhir.r4.model.Reference theSourceReference, List<org.hl7.fhir.r4.model.Reference> theUpdatedReferencingResources, Date theStartTime, List<ca.uhn.fhir.model.api.IProvenanceAgent> theProvenanceAgents, List<org.hl7.fhir.instance.model.api.IBaseResource> theContainedResources) -
createProvenance
public void createProvenance(org.hl7.fhir.instance.model.api.IIdType theTargetId, org.hl7.fhir.instance.model.api.IIdType theSourceId, List<org.hl7.fhir.r4.model.Bundle> thePatchResultBundles, Date theStartTime, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, List<ca.uhn.fhir.model.api.IProvenanceAgent> theProvenanceAgents, List<org.hl7.fhir.instance.model.api.IBaseResource> theContainedResources) Creates a Provenance resource for the $replace-references and $merge operations.- Parameters:
theTargetId
- the versioned id of the target resource of the operation.theSourceId
- the versioned id of the source resource of the operation.thePatchResultBundles
- the list of patch result bundles that contain the updated resources.theStartTime
- the start time of the operation.theRequestDetails
- the request detailstheProvenanceAgents
- the list of agents to be included in the Provenance resource.
-
createProvenance
protected void createProvenance(org.hl7.fhir.instance.model.api.IIdType theTargetId, org.hl7.fhir.instance.model.api.IIdType theSourceId, List<org.hl7.fhir.r4.model.Bundle> thePatchResultBundles, Date theStartTime, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, List<ca.uhn.fhir.model.api.IProvenanceAgent> theProvenanceAgents, List<org.hl7.fhir.instance.model.api.IBaseResource> theContainedResources, boolean theCreateEvenWhenNoReferencesWereUpdated) -
findProvenance
@Nullable public org.hl7.fhir.r4.model.Provenance findProvenance(org.hl7.fhir.instance.model.api.IIdType theTargetId, org.hl7.fhir.instance.model.api.IIdType theSourceId, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, String theOperationName) Finds a Provenance resource that contain the given target and source references, and with the activity code this class generates Provenance resource with. If multiple Provenance resources found, returns the most recent one based on the 'recorded' field.- Parameters:
theTargetId
- the target resource idtheSourceId
- the source resource idtheRequestDetails
- the request detailstheOperationName
- the name of operation trying to find the provenance resource, used for logging.- Returns:
- the found Provenance resource, or null if not found.
-
getProvenancesOfTargetsFilteredByActivity
protected List<org.hl7.fhir.r4.model.Provenance> getProvenancesOfTargetsFilteredByActivity(List<org.hl7.fhir.instance.model.api.IIdType> theTargetIds, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails) -
isTargetAndSourceInCorrectOrder
public boolean isTargetAndSourceInCorrectOrder(org.hl7.fhir.r4.model.Provenance provenance, org.hl7.fhir.instance.model.api.IIdType theTargetId, org.hl7.fhir.instance.model.api.IIdType theSourceId) Checks if the first 'Provenance.target' reference matches theTargetId and the second matches theSourceId. The $hapi.fhir.replace-references and $merge operations create their Provenance resource with targets in that order.- Parameters:
provenance
- The Provenance resource to check.theTargetId
- The expected target IIdType for the first reference.theSourceId
- The expected source IIdType for the second reference.- Returns:
- true if both match, false otherwise.
-
extractUpdatedResourceReferences
protected List<org.hl7.fhir.r4.model.Reference> extractUpdatedResourceReferences(List<org.hl7.fhir.r4.model.Bundle> thePatchBundles)
-