Interface IMdmLinkJpaRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<MdmLink,Long>, IHapiFhirJpaRepository, org.springframework.data.jpa.repository.JpaRepository<MdmLink,Long>, org.springframework.data.repository.ListCrudRepository<MdmLink,Long>, org.springframework.data.repository.ListPagingAndSortingRepository<MdmLink,Long>, org.springframework.data.repository.PagingAndSortingRepository<MdmLink,Long>, org.springframework.data.repository.query.QueryByExampleExecutor<MdmLink>, org.springframework.data.repository.Repository<MdmLink,Long>, org.springframework.data.repository.history.RevisionRepository<MdmLink,Long,Long>

@Repository public interface IMdmLinkJpaRepository extends org.springframework.data.repository.history.RevisionRepository<MdmLink,Long,Long>, org.springframework.data.jpa.repository.JpaRepository<MdmLink,Long>, IHapiFhirJpaRepository
  • Method Details

    • deleteWithAnyReferenceToPid

      @Modifying @Query("DELETE FROM MdmLink f WHERE myGoldenResourcePid = :pid OR mySourcePid = :pid") int deleteWithAnyReferenceToPid(@Param("pid") Long thePid)
    • deleteWithAnyReferenceToPidAndMatchResultNot

      @Modifying @Query("DELETE FROM MdmLink f WHERE (myGoldenResourcePid = :pid OR mySourcePid = :pid) AND myMatchResult <> :matchResult") int deleteWithAnyReferenceToPidAndMatchResultNot(@Param("pid") Long thePid, @Param("matchResult") ca.uhn.fhir.mdm.api.MdmMatchResultEnum theMatchResult)
    • deleteLinksWithAnyReferenceToPids

      @Modifying @Query("DELETE FROM MdmLink f WHERE myGoldenResourcePid IN (:goldenPids) OR mySourcePid IN (:goldenPids)") void deleteLinksWithAnyReferenceToPids(@Param("goldenPids") List<Long> theResourcePids)
    • deleteLinksHistoryWithAnyReferenceToPids

      @Modifying @Query(value="DELETE FROM MPI_LINK_AUD WHERE GOLDEN_RESOURCE_PID IN (:goldenPids) OR TARGET_PID IN (:goldenPids)", nativeQuery=true) void deleteLinksHistoryWithAnyReferenceToPids(@Param("goldenPids") List<Long> theResourcePids)
    • expandPidsFromGroupPidGivenMatchResult

      @Query("SELECT lookup_links.myGoldenResourcePid as goldenPid, gld_rt.myPartitionIdValue as goldenPartitionId, lookup_links.mySourcePid as sourcePid, lookup_links.myPartitionIdValue as sourcePartitionId FROM MdmLink lookup_links INNER JOIN ResourceTable gld_rt on lookup_links.myGoldenResourcePid=gld_rt.myId WHERE lookup_links.myMatchResult=:matchResult AND lookup_links.myGoldenResourcePid IN (SELECT inner_mdm_link.myGoldenResourcePid FROM MdmLink inner_mdm_link INNER JOIN ResourceLink inner_res_link ON inner_res_link.myTargetResourcePid=inner_mdm_link.mySourcePid AND inner_res_link.mySourceResourcePid=:groupPid AND inner_res_link.mySourcePath=\'Group.member.entity\' AND inner_res_link.myTargetResourceType=\'Patient\')") List<IMdmLinkJpaRepository.MdmPidTuple> expandPidsFromGroupPidGivenMatchResult(@Param("groupPid") Long theGroupPid, @Param("matchResult") ca.uhn.fhir.mdm.api.MdmMatchResultEnum theMdmMatchResultEnum)
    • findBySourcePidAndMatchResult

      @Query("SELECT ml FROM MdmLink ml WHERE ml.mySourcePid = :sourcePid AND ml.myMatchResult = :matchResult") Optional<MdmLink> findBySourcePidAndMatchResult(@Param("sourcePid") Long theSourcePid, @Param("matchResult") ca.uhn.fhir.mdm.api.MdmMatchResultEnum theMatch)
    • expandPidsBySourcePidAndMatchResult

      @Query("SELECT lookup_link.myGoldenResourcePid as goldenPid, gld_rt.myPartitionIdValue as goldenPartitionId, lookup_link.mySourcePid as sourcePid, lookup_link.myPartitionIdValue as sourcePartitionId FROM MdmLink lookup_link INNER JOIN MdmLink gld_link on lookup_link.myGoldenResourcePid=gld_link.myGoldenResourcePid INNER JOIN ResourceTable gld_rt on gld_link.myGoldenResourcePid=gld_rt.myId WHERE gld_link.mySourcePid=:sourcePid AND gld_link.myMatchResult=:matchResult AND lookup_link.myMatchResult=:matchResult") List<IMdmLinkJpaRepository.MdmPidTuple> expandPidsBySourcePidAndMatchResult(@Param("sourcePid") Long theSourcePid, @Param("matchResult") ca.uhn.fhir.mdm.api.MdmMatchResultEnum theMdmMatchResultEnum)
    • findLinksAssociatedWithGoldenResourceOfSourceResourceExcludingMatchResult

      @Query("SELECT ml FROM MdmLink ml INNER JOIN MdmLink ml2 on ml.myGoldenResourcePid=ml2.myGoldenResourcePid WHERE ml2.mySourcePid=:sourcePid AND ml2.myMatchResult!=:matchResult") List<MdmLink> findLinksAssociatedWithGoldenResourceOfSourceResourceExcludingMatchResult(@Param("sourcePid") Long theSourcePid, @Param("matchResult") ca.uhn.fhir.mdm.api.MdmMatchResultEnum theMdmMatchResultEnumToExclude)
    • expandPidsByGoldenResourcePidAndMatchResult

      @Query("SELECT lookup_link.myGoldenResourcePid as goldenPid, gld_rt.myPartitionIdValue as goldenPartitionId, lookup_link.mySourcePid as sourcePid, lookup_link.myPartitionIdValue as sourcePartitionId FROM MdmLink lookup_link INNER JOIN ResourceTable gld_rt on lookup_link.myGoldenResourcePid=gld_rt.myId WHERE lookup_link.myGoldenResourcePid = :goldenPid AND lookup_link.myMatchResult = :matchResult") List<IMdmLinkJpaRepository.MdmPidTuple> expandPidsByGoldenResourcePidAndMatchResult(@Param("goldenPid") Long theSourcePid, @Param("matchResult") ca.uhn.fhir.mdm.api.MdmMatchResultEnum theMdmMatchResultEnum)
    • expandPidsByGoldenResourcePidsOrSourcePidsAndMatchResult

      @Query("SELECT lookup_link.myGoldenResourcePid as goldenPid, gld_rt.myPartitionIdValue as goldenPartitionId, lookup_link.mySourcePid as sourcePid, lookup_link.myPartitionIdValue as sourcePartitionId FROM MdmLink lookup_link INNER JOIN ResourceTable gld_rt on lookup_link.myGoldenResourcePid=gld_rt.myId WHERE (lookup_link.myGoldenResourcePid IN (:pids) OR lookup_link.mySourcePid IN (:pids))AND lookup_link.myMatchResult = :matchResult") List<IMdmLinkJpaRepository.MdmPidTuple> expandPidsByGoldenResourcePidsOrSourcePidsAndMatchResult(@Param("pids") Collection<Long> theSourcePid, @Param("matchResult") ca.uhn.fhir.mdm.api.MdmMatchResultEnum theMdmMatchResultEnum)
    • findPidByResourceNameAndThreshold

      @Query("SELECT ml.myId FROM MdmLink ml WHERE ml.myMdmSourceType = :resourceName AND ml.myCreated <= :highThreshold ORDER BY ml.myCreated DESC") List<Long> findPidByResourceNameAndThreshold(@Param("resourceName") String theResourceName, @Param("highThreshold") Date theHighThreshold, org.springframework.data.domain.Pageable thePageable)
    • findPidByResourceNameAndThresholdAndPartitionId

      @Query("SELECT ml.myId FROM MdmLink ml WHERE ml.myMdmSourceType = :resourceName AND ml.myCreated <= :highThreshold AND ml.myPartitionIdValue IN :partitionId ORDER BY ml.myCreated DESC") List<Long> findPidByResourceNameAndThresholdAndPartitionId(@Param("resourceName") String theResourceName, @Param("highThreshold") Date theHighThreshold, @Param("partitionId") List<Integer> thePartitionIds, org.springframework.data.domain.Pageable thePageable)