Class MdmLinkDaoSvc<P extends ca.uhn.fhir.rest.api.server.storage.IResourcePersistentId,M extends ca.uhn.fhir.mdm.api.IMdmLink<P>>

java.lang.Object
ca.uhn.fhir.jpa.mdm.dao.MdmLinkDaoSvc<P,M>

public class MdmLinkDaoSvc<P extends ca.uhn.fhir.rest.api.server.storage.IResourcePersistentId,M extends ca.uhn.fhir.mdm.api.IMdmLink<P>> extends Object
  • Constructor Details

  • Method Details

    • createOrUpdateLinkEntity

      @Transactional public M createOrUpdateLinkEntity(org.hl7.fhir.instance.model.api.IAnyResource theGoldenResource, org.hl7.fhir.instance.model.api.IAnyResource theSourceResource, ca.uhn.fhir.mdm.api.MdmMatchOutcome theMatchOutcome, ca.uhn.fhir.mdm.api.MdmLinkSourceEnum theLinkSource, @Nullable ca.uhn.fhir.mdm.model.MdmTransactionContext theMdmTransactionContext)
    • getOrCreateMdmLinkByGoldenResourceAndSourceResource

      @Nonnull public M getOrCreateMdmLinkByGoldenResourceAndSourceResource(org.hl7.fhir.instance.model.api.IAnyResource theGoldenResource, org.hl7.fhir.instance.model.api.IAnyResource theSourceResource)
    • getLinkByGoldenResourcePidAndSourceResourcePid

      @Deprecated public Optional<M> getLinkByGoldenResourcePidAndSourceResourcePid(Long theGoldenResourcePid, Long theSourceResourcePid)
      Deprecated.
      This was deprecated in favour of using ResourcePersistenceId rather than longs
      Given a golden resource Pid and source Pid, return the mdm link that matches these criterias if exists
      Parameters:
      theGoldenResourcePid -
      theSourceResourcePid -
      Returns:
    • getLinkByGoldenResourcePidAndSourceResourcePid

      public Optional<M> getLinkByGoldenResourcePidAndSourceResourcePid(P theGoldenResourcePid, P theSourceResourcePid)
      Given a golden resource Pid and source Pid, return the mdm link that matches these criterias if exists
      Parameters:
      theGoldenResourcePid - The ResourcePersistenceId of the golden resource
      theSourceResourcePid - The ResourcepersistenceId of the Source resource
      Returns:
      The IMdmLink entity that matches these criteria if exists
    • getMdmLinksBySourcePidAndMatchResult

      public List<M> getMdmLinksBySourcePidAndMatchResult(P theSourcePid, ca.uhn.fhir.mdm.api.MdmMatchResultEnum theMatchResult)
      Given a source resource Pid, and a match result, return all links that match these criteria.
      Parameters:
      theSourcePid - the source of the relationship.
      theMatchResult - the Match Result of the relationship
      Returns:
      a list of IMdmLink entities matching these criteria.
    • getMatchedLinkForSourcePid

      @Deprecated @Transactional public Optional<M> getMatchedLinkForSourcePid(P theSourcePid)
      Deprecated.
      Given a source Pid, return its Matched IMdmLink. There can only ever be at most one of these, but its possible the source has no matches, and may return an empty optional.
      Parameters:
      theSourcePid - The Pid of the source you wish to find the matching link for.
      Returns:
      the IMdmLink that contains the Match information for the source.
    • getMatchedLinkForSource

      public Optional<M> getMatchedLinkForSource(org.hl7.fhir.instance.model.api.IBaseResource theSourceResource)
      Given an IBaseResource, return its Matched IMdmLink. There can only ever be at most one of these, but its possible the source has no matches, and may return an empty optional.
      Parameters:
      theSourceResource - The IBaseResource representing the source you wish to find the matching link for.
      Returns:
      the IMdmLink that contains the Match information for the source.
    • getPossibleMatchedLinkForSource

      public Optional<M> getPossibleMatchedLinkForSource(org.hl7.fhir.instance.model.api.IBaseResource theSourceResource)
    • getMdmLinksByGoldenResourcePidSourcePidAndMatchResult

      public Optional<M> getMdmLinksByGoldenResourcePidSourcePidAndMatchResult(Long theGoldenResourcePid, Long theSourcePid, ca.uhn.fhir.mdm.api.MdmMatchResultEnum theMatchResult)
      Given a golden resource a source and a match result, return the matching IMdmLink, if it exists.
      Parameters:
      theGoldenResourcePid - The Pid of the Golden Resource in the relationship
      theSourcePid - The Pid of the source in the relationship
      theMatchResult - The MatchResult you are looking for.
      Returns:
      an Optional IMdmLink containing the matched link if it exists.
    • getMdmLinksByGoldenResourcePidSourcePidAndMatchResult

      public Optional<M> getMdmLinksByGoldenResourcePidSourcePidAndMatchResult(P theGoldenResourcePid, P theSourcePid, ca.uhn.fhir.mdm.api.MdmMatchResultEnum theMatchResult)
    • getPossibleDuplicates

      Get all IMdmLink which have MdmMatchResultEnum.POSSIBLE_DUPLICATE as their match result.
      Returns:
      A list of IMdmLink that hold potential duplicate golden resources.
    • findMdmLinkBySource

      @Transactional public Optional<M> findMdmLinkBySource(org.hl7.fhir.instance.model.api.IBaseResource theSourceResource)
    • deleteLink

      @Transactional(propagation=REQUIRES_NEW) public void deleteLink(M theMdmLink)
      Delete a given IMdmLink. Note that this does not clear out the Golden resource. It is a simple entity delete.
      Parameters:
      theMdmLink - the IMdmLink to delete.
    • findMdmLinksByGoldenResource

      @Transactional public List<M> findMdmLinksByGoldenResource(org.hl7.fhir.instance.model.api.IBaseResource theGoldenResource)
      Given a Golden Resource, return all links in which they are the source Golden Resource of the IMdmLink
      Parameters:
      theGoldenResource - The IBaseResource Golden Resource who's links you would like to retrieve.
      Returns:
      A list of all IMdmLink entities in which theGoldenResource is the source Golden Resource
    • save

      public M save(M theMdmLink)
      Persist an MDM link to the database.
      Parameters:
      theMdmLink - the link to save.
      Returns:
      the persisted IMdmLink entity.
    • executeTypedQuery

      public org.springframework.data.domain.Page<M> executeTypedQuery(ca.uhn.fhir.mdm.api.MdmQuerySearchParameters theMdmQuerySearchParameters)
      Given a list of criteria, return all links from the database which fits the criteria provided
      Parameters:
      theMdmQuerySearchParameters - The MdmQuerySearchParameters being searched.
      Returns:
      a list of IMdmLink entities which match the example.
    • findMdmLinksBySourceResource

      @Transactional public List<M> findMdmLinksBySourceResource(org.hl7.fhir.instance.model.api.IBaseResource theSourceResource)
      Given a source IBaseResource, return all IMdmLink entities in which this source is the source of the relationship. This will show you all links for a given Patient/Practitioner.
      Parameters:
      theSourceResource - the source resource to find links for.
      Returns:
      all links for the source.
    • findMdmMatchLinksByGoldenResource

      public List<M> findMdmMatchLinksByGoldenResource(org.hl7.fhir.instance.model.api.IBaseResource theGoldenResource)
      Finds all IMdmLink entities in which theGoldenResource's PID is the source of the relationship.
      Parameters:
      theGoldenResource - the source resource to find links for.
      Returns:
      all links for the source.
    • newMdmLink

      public ca.uhn.fhir.mdm.api.IMdmLink newMdmLink()
      Factory delegation method, whenever you need a new MdmLink, use this factory method. //TODO Should we make the constructor private for MdmLink? or work out some way to ensure they can only be instantiated via factory.
      Returns:
      A new IMdmLink.
    • getMatchedOrPossibleMatchedLinkForSource

      public Optional<M> getMatchedOrPossibleMatchedLinkForSource(org.hl7.fhir.instance.model.api.IAnyResource theResource)
    • getLinkByGoldenResourceAndSourceResource

      public Optional<M> getLinkByGoldenResourceAndSourceResource(@Nullable org.hl7.fhir.instance.model.api.IAnyResource theGoldenResource, @Nullable org.hl7.fhir.instance.model.api.IAnyResource theSourceResource)
    • deleteLinksWithAnyReferenceToPids

      @Transactional(propagation=MANDATORY) public void deleteLinksWithAnyReferenceToPids(List<P> theGoldenResourcePids)
    • findMdmLinkHistory

      @Deprecated(since="6.5.7", forRemoval=true) public org.springframework.data.history.Revisions<Long,M> findMdmLinkHistory(M mdmLink)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • findMdmLinkHistory

      @Transactional public List<ca.uhn.fhir.mdm.api.MdmLinkWithRevision<M>> findMdmLinkHistory(ca.uhn.fhir.mdm.api.MdmHistorySearchParameters theMdmHistorySearchParameters)