Class MdmLinkDaoSvc

java.lang.Object
ca.uhn.fhir.jpa.mdm.dao.MdmLinkDaoSvc

public class MdmLinkDaoSvc extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    ca.uhn.fhir.mdm.api.IMdmLink
    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, ca.uhn.fhir.mdm.model.MdmTransactionContext theMdmTransactionContext)
     
    void
    deleteLink(ca.uhn.fhir.mdm.api.IMdmLink theMdmLink)
    Delete a given IMdmLink.
    void
    deleteLinksWithAnyReferenceToPids(List<ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId> theGoldenResourcePids)
     
    org.springframework.data.domain.Page<? extends ca.uhn.fhir.mdm.api.IMdmLink>
    executeTypedQuery(org.hl7.fhir.instance.model.api.IIdType theGoldenResourceId, org.hl7.fhir.instance.model.api.IIdType theSourceId, ca.uhn.fhir.mdm.api.MdmMatchResultEnum theMatchResult, ca.uhn.fhir.mdm.api.MdmLinkSourceEnum theLinkSource, ca.uhn.fhir.mdm.api.paging.MdmPageRequest thePageRequest, List<Integer> thePartitionId)
    Given a list of criteria, return all links from the database which fits the criteria provided
    Optional<? extends ca.uhn.fhir.mdm.api.IMdmLink>
    findMdmLinkBySource(org.hl7.fhir.instance.model.api.IBaseResource theSourceResource)
     
    List<? extends ca.uhn.fhir.mdm.api.IMdmLink>
    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
    List<? extends ca.uhn.fhir.mdm.api.IMdmLink>
    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.
    List<? extends ca.uhn.fhir.mdm.api.IMdmLink>
    findMdmMatchLinksByGoldenResource(org.hl7.fhir.instance.model.api.IBaseResource theGoldenResource)
    Finds all IMdmLink entities in which theGoldenResource's PID is the source of the relationship.
    Optional<? extends ca.uhn.fhir.mdm.api.IMdmLink>
    getLinkByGoldenResourceAndSourceResource(org.hl7.fhir.instance.model.api.IAnyResource theGoldenResource, org.hl7.fhir.instance.model.api.IAnyResource theSourceResource)
     
    Optional<? extends ca.uhn.fhir.mdm.api.IMdmLink>
    getLinkByGoldenResourcePidAndSourceResourcePid(ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId theGoldenResourcePid, ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId theSourceResourcePid)
    Given a golden resource Pid and source Pid, return the mdm link that matches these criterias if exists
    Optional<? extends ca.uhn.fhir.mdm.api.IMdmLink>
    getLinkByGoldenResourcePidAndSourceResourcePid(Long theGoldenResourcePid, Long theSourceResourcePid)
    Deprecated.
    This was deprecated in favour of using ResourcePersistenceId rather than longs
    Optional<? extends ca.uhn.fhir.mdm.api.IMdmLink>
    getMatchedLinkForSource(org.hl7.fhir.instance.model.api.IBaseResource theSourceResource)
    Given an IBaseResource, return its Matched IMdmLink.
    Optional<? extends ca.uhn.fhir.mdm.api.IMdmLink>
    getMatchedLinkForSourcePid(ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId theSourcePid)
    Deprecated.
    Optional<? extends ca.uhn.fhir.mdm.api.IMdmLink>
    getMatchedOrPossibleMatchedLinkForSource(org.hl7.fhir.instance.model.api.IAnyResource theResource)
     
    Optional<? extends ca.uhn.fhir.mdm.api.IMdmLink>
    getMdmLinksByGoldenResourcePidSourcePidAndMatchResult(ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId theGoldenResourcePid, ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId theSourcePid, ca.uhn.fhir.mdm.api.MdmMatchResultEnum theMatchResult)
     
    Optional<? extends ca.uhn.fhir.mdm.api.IMdmLink>
    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.
    List<? extends ca.uhn.fhir.mdm.api.IMdmLink>
    getMdmLinksBySourcePidAndMatchResult(ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId theSourcePid, ca.uhn.fhir.mdm.api.MdmMatchResultEnum theMatchResult)
    Given a source resource Pid, and a match result, return all links that match these criteria.
    ca.uhn.fhir.mdm.api.IMdmLink
    getOrCreateMdmLinkByGoldenResourceAndSourceResource(org.hl7.fhir.instance.model.api.IAnyResource theGoldenResource, org.hl7.fhir.instance.model.api.IAnyResource theSourceResource)
     
    List<? extends ca.uhn.fhir.mdm.api.IMdmLink>
    Get all IMdmLink which have MdmMatchResultEnum.POSSIBLE_DUPLICATE as their match result.
    Optional<? extends ca.uhn.fhir.mdm.api.IMdmLink>
    getPossibleMatchedLinkForSource(org.hl7.fhir.instance.model.api.IBaseResource theSourceResource)
     
    ca.uhn.fhir.mdm.api.IMdmLink
    Factory delegation method, whenever you need a new MdmLink, use this factory method.
    ca.uhn.fhir.mdm.api.IMdmLink
    save(ca.uhn.fhir.mdm.api.IMdmLink theMdmLink)
    Persist an MDM link to the database.

    Methods inherited from class java.lang.Object

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

  • Method Details

    • createOrUpdateLinkEntity

      @Transactional public ca.uhn.fhir.mdm.api.IMdmLink 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 ca.uhn.fhir.mdm.api.IMdmLink getOrCreateMdmLinkByGoldenResourceAndSourceResource(org.hl7.fhir.instance.model.api.IAnyResource theGoldenResource, org.hl7.fhir.instance.model.api.IAnyResource theSourceResource)
    • getLinkByGoldenResourcePidAndSourceResourcePid

      @Deprecated public Optional<? extends ca.uhn.fhir.mdm.api.IMdmLink> 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<? extends ca.uhn.fhir.mdm.api.IMdmLink> getLinkByGoldenResourcePidAndSourceResourcePid(ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId theGoldenResourcePid, ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId 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<? extends ca.uhn.fhir.mdm.api.IMdmLink> getMdmLinksBySourcePidAndMatchResult(ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId 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<? extends ca.uhn.fhir.mdm.api.IMdmLink> getMatchedLinkForSourcePid(ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId 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<? extends ca.uhn.fhir.mdm.api.IMdmLink> 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<? extends ca.uhn.fhir.mdm.api.IMdmLink> getPossibleMatchedLinkForSource(org.hl7.fhir.instance.model.api.IBaseResource theSourceResource)
    • getMdmLinksByGoldenResourcePidSourcePidAndMatchResult

      public Optional<? extends ca.uhn.fhir.mdm.api.IMdmLink> 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<? extends ca.uhn.fhir.mdm.api.IMdmLink> getMdmLinksByGoldenResourcePidSourcePidAndMatchResult(ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId theGoldenResourcePid, ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId theSourcePid, ca.uhn.fhir.mdm.api.MdmMatchResultEnum theMatchResult)
    • getPossibleDuplicates

      public List<? extends ca.uhn.fhir.mdm.api.IMdmLink> 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<? extends ca.uhn.fhir.mdm.api.IMdmLink> findMdmLinkBySource(org.hl7.fhir.instance.model.api.IBaseResource theSourceResource)
    • deleteLink

      @Transactional(propagation=REQUIRES_NEW) public void deleteLink(ca.uhn.fhir.mdm.api.IMdmLink 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<? extends ca.uhn.fhir.mdm.api.IMdmLink> 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 ca.uhn.fhir.mdm.api.IMdmLink save(ca.uhn.fhir.mdm.api.IMdmLink 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<? extends ca.uhn.fhir.mdm.api.IMdmLink> executeTypedQuery(org.hl7.fhir.instance.model.api.IIdType theGoldenResourceId, org.hl7.fhir.instance.model.api.IIdType theSourceId, ca.uhn.fhir.mdm.api.MdmMatchResultEnum theMatchResult, ca.uhn.fhir.mdm.api.MdmLinkSourceEnum theLinkSource, ca.uhn.fhir.mdm.api.paging.MdmPageRequest thePageRequest, List<Integer> thePartitionId)
      Given a list of criteria, return all links from the database which fits the criteria provided
      Parameters:
      theGoldenResourceId - The resource ID of the golden resource being searched.
      theSourceId - The resource ID of the source resource being searched.
      theMatchResult - the MdmMatchResultEnum being searched.
      theLinkSource - the MdmLinkSourceEnum being searched.
      thePageRequest - the MdmPageRequest paging information
      thePartitionId - List of partitions ID being searched, where the link's partition must be in the list.
      Returns:
      a list of IMdmLink entities which match the example.
    • findMdmLinksBySourceResource

      @Transactional public List<? extends ca.uhn.fhir.mdm.api.IMdmLink> 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<? extends ca.uhn.fhir.mdm.api.IMdmLink> 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<? extends ca.uhn.fhir.mdm.api.IMdmLink> getMatchedOrPossibleMatchedLinkForSource(org.hl7.fhir.instance.model.api.IAnyResource theResource)
    • getLinkByGoldenResourceAndSourceResource

      public Optional<? extends ca.uhn.fhir.mdm.api.IMdmLink> 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<ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId> theGoldenResourcePids)