Package ca.uhn.fhir.jpa.dao.data
Interface IResourceTableDao
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<ResourceTable,
,Long> IForcedIdQueries
,IHapiFhirJpaRepository
,org.springframework.data.jpa.repository.JpaRepository<ResourceTable,
,Long> org.springframework.data.repository.ListCrudRepository<ResourceTable,
,Long> org.springframework.data.repository.ListPagingAndSortingRepository<ResourceTable,
,Long> org.springframework.data.repository.PagingAndSortingRepository<ResourceTable,
,Long> org.springframework.data.repository.query.QueryByExampleExecutor<ResourceTable>
,org.springframework.data.repository.Repository<ResourceTable,
Long>
@Transactional(propagation=MANDATORY)
public interface IResourceTableDao
extends org.springframework.data.jpa.repository.JpaRepository<ResourceTable,Long>, IHapiFhirJpaRepository, IForcedIdQueries
-
Method Summary
Modifier and TypeMethodDescriptionvoid
deleteByPid
(Long theId) findAllByIdAndLoadForcedIds
(List<Long> thePids) findByTypeAndFhirId
(String theResourceName, String theFhirId) findCurrentVersionByPid
(Long thePid) org.springframework.data.domain.Slice
<Long> findIdsOfDeletedResources
(org.springframework.data.domain.Pageable thePageable) org.springframework.data.domain.Slice
<Long> findIdsOfDeletedResourcesOfType
(org.springframework.data.domain.Pageable thePageable, Long theResourceId, String theResourceName) org.springframework.data.domain.Slice
<Long> findIdsOfDeletedResourcesOfType
(org.springframework.data.domain.Pageable thePageable, String theResourceName) org.springframework.data.domain.Slice
<Long> findIdsOfPartitionedResourcesWithinUpdatedRangeOrderedFromOldest
(org.springframework.data.domain.Pageable thePage, Date theLow, Date theHigh, Integer theRequestPartitionId) org.springframework.data.domain.Slice
<Long> findIdsOfResourcesWithinUpdatedRangeOrderedFromNewest
(org.springframework.data.domain.Pageable thePage, Date theLow, Date theHigh) org.springframework.data.domain.Slice
<Long> findIdsOfResourcesWithinUpdatedRangeOrderedFromOldest
(org.springframework.data.domain.Pageable thePage, String theResourceType, Date theLow, Date theHigh) org.springframework.data.domain.Slice
<Long> findIdsOfResourcesWithinUpdatedRangeOrderedFromOldest
(org.springframework.data.domain.Pageable thePage, Date theLow, Date theHigh) org.springframework.data.domain.Slice
<Object[]> findIdsTypesAndUpdateTimesOfResourcesWithinUpdatedRangeOrderedFromOldestForDefaultPartition
(org.springframework.data.domain.Pageable thePage, Date theLow, Date theHigh) org.springframework.data.domain.Slice
<Object[]> findIdsTypesAndUpdateTimesOfResourcesWithinUpdatedRangeOrderedFromOldestForPartitionIds
(org.springframework.data.domain.Pageable thePage, Date theLow, Date theHigh, List<Integer> theRequestPartitionIds) Collection
<Object[]> findLookupFieldsByResourcePid
(List<Long> thePids) This method returns a Collection where each row is an element in the collection.Collection
<Object[]> findLookupFieldsByResourcePidInPartitionIds
(List<Long> thePids, Collection<Integer> thePartitionId) This method returns a Collection where each row is an element in the collection.Collection
<Object[]> findLookupFieldsByResourcePidInPartitionIdsOrNullPartition
(List<Long> thePids, Collection<Integer> thePartitionId) This method returns a Collection where each row is an element in the collection.Collection
<Object[]> This method returns a Collection where each row is an element in the collection.Collection
<Object[]> This query will return rows with the following values: Id (resource pid - long), ResourceType (Patient, etc), version (long) Order matters!readByPartitionId
(int thePartitionId, Long theResourceId) readByPartitionIdNull
(Long theResourceId) readByPartitionIds
(Collection<Integer> thrValues, Long theResourceId) readByPartitionIdsOrNull
(Collection<Integer> thrValues, Long theResourceId) streamIdsTypesAndUpdateTimesOfResourcesWithinUpdatedRangeOrderedFromOldest
(Date theLow, Date theHigh) streamIdsTypesAndUpdateTimesOfResourcesWithinUpdatedRangeOrderedFromOldestForDefaultPartition
(Date theLow, Date theHigh) streamIdsTypesAndUpdateTimesOfResourcesWithinUpdatedRangeOrderedFromOldestForPartitionIds
(Date theLow, Date theHigh, List<Integer> theRequestPartitionIds) void
updateIndexStatus
(Long theId, Long theIndexStatus) void
updateLastUpdated
(Long theId, Date theUpdated) Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, save
Methods inherited from interface ca.uhn.fhir.jpa.dao.data.custom.IForcedIdQueries
findAndResolveByForcedIdWithNoType, findAndResolveByForcedIdWithNoTypeIncludeDeleted, findAndResolveByForcedIdWithNoTypeInPartition, findAndResolveByForcedIdWithNoTypeInPartitionIdOrNullPartitionId, findAndResolveByForcedIdWithNoTypeInPartitionNull
Methods inherited from interface org.springframework.data.jpa.repository.JpaRepository
deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlush
Methods inherited from interface org.springframework.data.repository.ListCrudRepository
findAll, findAllById, saveAll
Methods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository
findAll
Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAll
Methods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
-
Method Details
-
findIdsOfDeletedResources
@Query("SELECT t.myId FROM ResourceTable t WHERE t.myDeleted IS NOT NULL") org.springframework.data.domain.Slice<Long> findIdsOfDeletedResources(org.springframework.data.domain.Pageable thePageable) -
findIdsOfDeletedResourcesOfType
@Query("SELECT t.myId FROM ResourceTable t WHERE t.myResourceType = :restype AND t.myDeleted IS NOT NULL") org.springframework.data.domain.Slice<Long> findIdsOfDeletedResourcesOfType(org.springframework.data.domain.Pageable thePageable, @Param("restype") String theResourceName) -
findIdsOfDeletedResourcesOfType
@Query("SELECT t.myId FROM ResourceTable t WHERE t.myId = :resid AND t.myResourceType = :restype AND t.myDeleted IS NOT NULL") org.springframework.data.domain.Slice<Long> findIdsOfDeletedResourcesOfType(org.springframework.data.domain.Pageable thePageable, @Param("resid") Long theResourceId, @Param("restype") String theResourceName) -
getResourceCounts
@Query("SELECT t.myResourceType as type, COUNT(t.myResourceType) as count FROM ResourceTable t GROUP BY t.myResourceType") List<Map<?,?>> getResourceCounts() -
findIdsOfResourcesWithinUpdatedRangeOrderedFromNewest
@Query("SELECT t.myId FROM ResourceTable t WHERE t.myUpdated >= :low AND t.myUpdated <= :high ORDER BY t.myUpdated DESC") org.springframework.data.domain.Slice<Long> findIdsOfResourcesWithinUpdatedRangeOrderedFromNewest(org.springframework.data.domain.Pageable thePage, @Param("low") Date theLow, @Param("high") Date theHigh) -
findIdsOfResourcesWithinUpdatedRangeOrderedFromOldest
@Query("SELECT t.myId FROM ResourceTable t WHERE t.myUpdated >= :low AND t.myUpdated <= :high ORDER BY t.myUpdated ASC") org.springframework.data.domain.Slice<Long> findIdsOfResourcesWithinUpdatedRangeOrderedFromOldest(org.springframework.data.domain.Pageable thePage, @Param("low") Date theLow, @Param("high") Date theHigh) -
streamIdsTypesAndUpdateTimesOfResourcesWithinUpdatedRangeOrderedFromOldest
@Query("SELECT t.myId, t.myResourceType, t.myUpdated FROM ResourceTable t WHERE t.myUpdated >= :low AND t.myUpdated <= :high ORDER BY t.myUpdated ASC") Stream<Object[]> streamIdsTypesAndUpdateTimesOfResourcesWithinUpdatedRangeOrderedFromOldest(@Param("low") Date theLow, @Param("high") Date theHigh) -
findIdsTypesAndUpdateTimesOfResourcesWithinUpdatedRangeOrderedFromOldestForPartitionIds
@Query("SELECT t.myId, t.myResourceType, t.myUpdated FROM ResourceTable t WHERE t.myUpdated >= :low AND t.myUpdated <= :high AND t.myPartitionIdValue IN (:partition_ids) ORDER BY t.myUpdated ASC") org.springframework.data.domain.Slice<Object[]> findIdsTypesAndUpdateTimesOfResourcesWithinUpdatedRangeOrderedFromOldestForPartitionIds(org.springframework.data.domain.Pageable thePage, @Param("low") Date theLow, @Param("high") Date theHigh, @Param("partition_ids") List<Integer> theRequestPartitionIds) - Returns:
- List of arrays containing [PID, resourceType, lastUpdated]
-
streamIdsTypesAndUpdateTimesOfResourcesWithinUpdatedRangeOrderedFromOldestForPartitionIds
@Query("SELECT t.myId, t.myResourceType, t.myUpdated FROM ResourceTable t WHERE t.myUpdated >= :low AND t.myUpdated <= :high AND t.myPartitionIdValue IN (:partition_ids) ORDER BY t.myUpdated ASC") Stream<Object[]> streamIdsTypesAndUpdateTimesOfResourcesWithinUpdatedRangeOrderedFromOldestForPartitionIds(@Param("low") Date theLow, @Param("high") Date theHigh, @Param("partition_ids") List<Integer> theRequestPartitionIds) -
findIdsTypesAndUpdateTimesOfResourcesWithinUpdatedRangeOrderedFromOldestForDefaultPartition
@Query("SELECT t.myId, t.myResourceType, t.myUpdated FROM ResourceTable t WHERE t.myUpdated >= :low AND t.myUpdated <= :high ORDER BY t.myUpdated ASC") org.springframework.data.domain.Slice<Object[]> findIdsTypesAndUpdateTimesOfResourcesWithinUpdatedRangeOrderedFromOldestForDefaultPartition(org.springframework.data.domain.Pageable thePage, @Param("low") Date theLow, @Param("high") Date theHigh) - Returns:
- List of arrays containing [PID, resourceType, lastUpdated]
-
streamIdsTypesAndUpdateTimesOfResourcesWithinUpdatedRangeOrderedFromOldestForDefaultPartition
@Query("SELECT t.myId, t.myResourceType, t.myUpdated FROM ResourceTable t WHERE t.myUpdated >= :low AND t.myUpdated <= :high ORDER BY t.myUpdated ASC") Stream<Object[]> streamIdsTypesAndUpdateTimesOfResourcesWithinUpdatedRangeOrderedFromOldestForDefaultPartition(@Param("low") Date theLow, @Param("high") Date theHigh) -
findIdsOfPartitionedResourcesWithinUpdatedRangeOrderedFromOldest
@Query("SELECT t.myId FROM ResourceTable t WHERE t.myUpdated >= :low AND t.myUpdated <= :high AND t.myPartitionIdValue = :partition_id ORDER BY t.myUpdated ASC") org.springframework.data.domain.Slice<Long> findIdsOfPartitionedResourcesWithinUpdatedRangeOrderedFromOldest(org.springframework.data.domain.Pageable thePage, @Param("low") Date theLow, @Param("high") Date theHigh, @Param("partition_id") Integer theRequestPartitionId) -
findIdsOfResourcesWithinUpdatedRangeOrderedFromOldest
@Query("SELECT t.myId FROM ResourceTable t WHERE t.myUpdated >= :low AND t.myUpdated <= :high AND t.myResourceType = :restype ORDER BY t.myUpdated ASC") org.springframework.data.domain.Slice<Long> findIdsOfResourcesWithinUpdatedRangeOrderedFromOldest(org.springframework.data.domain.Pageable thePage, @Param("restype") String theResourceType, @Param("low") Date theLow, @Param("high") Date theHigh) -
updateIndexStatus
@Modifying @Query("UPDATE ResourceTable t SET t.myIndexStatus = :status WHERE t.myId = :id") void updateIndexStatus(@Param("id") Long theId, @Param("status") Long theIndexStatus) -
updateLastUpdated
@Modifying @Query("UPDATE ResourceTable t SET t.myUpdated = :updated WHERE t.myId = :id") void updateLastUpdated(@Param("id") Long theId, @Param("updated") Date theUpdated) -
deleteByPid
@Modifying @Query("DELETE FROM ResourceTable t WHERE t.myId = :pid") void deleteByPid(@Param("pid") Long theId) -
findLookupFieldsByResourcePid
@Query("SELECT t.myResourceType, t.myId, t.myDeleted, t.myPartitionIdValue, t.myPartitionDateValue FROM ResourceTable t WHERE t.myId IN (:pid)") Collection<Object[]> findLookupFieldsByResourcePid(@Param("pid") List<Long> thePids) This method returns a Collection where each row is an element in the collection. Each element in the collection is an object array, where the order matters (the array represents columns returned by the query). Be careful if you change this query in any way. -
findLookupFieldsByResourcePidInPartitionIds
@Query("SELECT t.myResourceType, t.myId, t.myDeleted, t.myPartitionIdValue, t.myPartitionDateValue FROM ResourceTable t WHERE t.myId IN (:pid) AND t.myPartitionIdValue IN :partition_id") Collection<Object[]> findLookupFieldsByResourcePidInPartitionIds(@Param("pid") List<Long> thePids, @Param("partition_id") Collection<Integer> thePartitionId) This method returns a Collection where each row is an element in the collection. Each element in the collection is an object array, where the order matters (the array represents columns returned by the query). Be careful if you change this query in any way. -
findLookupFieldsByResourcePidInPartitionIdsOrNullPartition
@Query("SELECT t.myResourceType, t.myId, t.myDeleted, t.myPartitionIdValue, t.myPartitionDateValue FROM ResourceTable t WHERE t.myId IN (:pid) AND (t.myPartitionIdValue IS NULL OR t.myPartitionIdValue IN :partition_id)") Collection<Object[]> findLookupFieldsByResourcePidInPartitionIdsOrNullPartition(@Param("pid") List<Long> thePids, @Param("partition_id") Collection<Integer> thePartitionId) This method returns a Collection where each row is an element in the collection. Each element in the collection is an object array, where the order matters (the array represents columns returned by the query). Be careful if you change this query in any way. -
findLookupFieldsByResourcePidInPartitionNull
@Query("SELECT t.myResourceType, t.myId, t.myDeleted, t.myPartitionIdValue, t.myPartitionDateValue FROM ResourceTable t WHERE t.myId IN (:pid) AND t.myPartitionIdValue IS NULL") Collection<Object[]> findLookupFieldsByResourcePidInPartitionNull(@Param("pid") List<Long> thePids) This method returns a Collection where each row is an element in the collection. Each element in the collection is an object array, where the order matters (the array represents columns returned by the query). Be careful if you change this query in any way. -
findCurrentVersionByPid
@Query("SELECT t.myVersion FROM ResourceTable t WHERE t.myId = :pid") Long findCurrentVersionByPid(@Param("pid") Long thePid) -
getResourceVersionsForPid
@Query("SELECT t.myId, t.myResourceType, t.myVersion FROM ResourceTable t WHERE t.myId IN ( :pid )") Collection<Object[]> getResourceVersionsForPid(@Param("pid") List<Long> pid) This query will return rows with the following values: Id (resource pid - long), ResourceType (Patient, etc), version (long) Order matters!- Parameters:
pid
- - list of pids to get versions for- Returns:
-
readByPartitionIdNull
@Query("SELECT t FROM ResourceTable t WHERE t.myPartitionId.myPartitionId IS NULL AND t.myId = :pid") Optional<ResourceTable> readByPartitionIdNull(@Param("pid") Long theResourceId) -
readByPartitionId
@Query("SELECT t FROM ResourceTable t WHERE t.myPartitionId.myPartitionId = :partitionId AND t.myId = :pid") Optional<ResourceTable> readByPartitionId(@Param("partitionId") int thePartitionId, @Param("pid") Long theResourceId) -
readByPartitionIdsOrNull
@Query("SELECT t FROM ResourceTable t WHERE (t.myPartitionId.myPartitionId IS NULL OR t.myPartitionId.myPartitionId IN (:partitionIds)) AND t.myId = :pid") Optional<ResourceTable> readByPartitionIdsOrNull(@Param("partitionIds") Collection<Integer> thrValues, @Param("pid") Long theResourceId) -
readByPartitionIds
@Query("SELECT t FROM ResourceTable t WHERE t.myPartitionId.myPartitionId IN (:partitionIds) AND t.myId = :pid") Optional<ResourceTable> readByPartitionIds(@Param("partitionIds") Collection<Integer> thrValues, @Param("pid") Long theResourceId) -
findAllByIdAndLoadForcedIds
@Query("SELECT t FROM ResourceTable t WHERE t.myId IN :pids") List<ResourceTable> findAllByIdAndLoadForcedIds(@Param("pids") List<Long> thePids) -
findByTypeAndFhirId
@Query("SELECT t FROM ResourceTable t where t.myResourceType = :restype and t.myFhirId = :fhirId") Optional<ResourceTable> findByTypeAndFhirId(@Param("restype") String theResourceName, @Param("fhirId") String theFhirId)
-