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
    Modifier and Type
    Field
    Description
    protected static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • getActivityCodeableConcept

      protected org.hl7.fhir.r4.model.CodeableConcept 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 details
      theProvenanceAgents - 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 id
      theSourceId - the source resource id
      theRequestDetails - the request details
      theOperationName - 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)