Package ca.uhn.fhir.jpa.dao.data
Interface IBatch2WorkChunkRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<Batch2WorkChunkEntity,,String> IHapiFhirJpaRepository,org.springframework.data.jpa.repository.JpaRepository<Batch2WorkChunkEntity,,String> org.springframework.data.repository.PagingAndSortingRepository<Batch2WorkChunkEntity,,String> org.springframework.data.repository.query.QueryByExampleExecutor<Batch2WorkChunkEntity>,org.springframework.data.repository.Repository<Batch2WorkChunkEntity,String>
public interface IBatch2WorkChunkRepository
extends org.springframework.data.jpa.repository.JpaRepository<Batch2WorkChunkEntity,String>, IHapiFhirJpaRepository
-
Method Summary
Modifier and TypeMethodDescriptionintdeleteAllForInstance(String theInstanceId) fetchAllChunkIdsForStepWithStatus(String theInstanceId, String theStepId, WorkChunkStatusEnum theStatus) fetchChunks(org.springframework.data.domain.Pageable thePageRequest, String theInstanceId) fetchChunksForStep(String theInstanceId, String theTargetStepId) fetchChunksNoData(org.springframework.data.domain.Pageable thePageRequest, String theInstanceId) A projection query to avoid fetching the CLOB over the wire.getDistinctStatusesForStep(String theInstanceId, String theStepId) voidupdateAllChunksForInstanceStatusClearDataAndSetError(List<String> theChunkIds, Date theEndTime, WorkChunkStatusEnum theInProgress, String theError) voidupdateChunkStatusAndClearDataForEndSuccess(String theChunkId, Date theEndTime, int theRecordsProcessed, int theErrorRetries, WorkChunkStatusEnum theInProgress, String theWarningMessage) intupdateChunkStatusAndIncrementErrorCountForEndError(String theChunkId, Date theEndTime, String theErrorMessage, WorkChunkStatusEnum theInProgress) intupdateChunkStatusForStart(String theChunkId, Date theStartedTime, WorkChunkStatusEnum theInProgress, Collection<WorkChunkStatusEnum> theStartStatuses) Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, saveMethods inherited from interface org.springframework.data.jpa.repository.JpaRepository
deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, findAll, findAll, findAllById, flush, getById, getOne, getReferenceById, saveAll, saveAllAndFlush, saveAndFlushMethods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
-
Method Details
-
fetchChunks
@Query("SELECT e FROM Batch2WorkChunkEntity e WHERE e.myInstanceId = :instanceId ORDER BY e.mySequence ASC, e.myId ASC") List<Batch2WorkChunkEntity> fetchChunks(org.springframework.data.domain.Pageable thePageRequest, @Param("instanceId") String theInstanceId) -
fetchChunksNoData
@Query("SELECT new Batch2WorkChunkEntity(e.myId, e.mySequence, e.myJobDefinitionId, e.myJobDefinitionVersion, e.myInstanceId, e.myTargetStepId, e.myStatus,e.myCreateTime, e.myStartTime, e.myUpdateTime, e.myEndTime,e.myErrorMessage, e.myErrorCount, e.myRecordsProcessed, e.myWarningMessage) FROM Batch2WorkChunkEntity e WHERE e.myInstanceId = :instanceId ORDER BY e.mySequence ASC, e.myId ASC") List<Batch2WorkChunkEntity> fetchChunksNoData(org.springframework.data.domain.Pageable thePageRequest, @Param("instanceId") String theInstanceId) A projection query to avoid fetching the CLOB over the wire. Otherwise, the same as fetchChunks. -
getDistinctStatusesForStep
@Query("SELECT DISTINCT e.myStatus from Batch2WorkChunkEntity e where e.myInstanceId = :instanceId AND e.myTargetStepId = :stepId") Set<WorkChunkStatusEnum> getDistinctStatusesForStep(@Param("instanceId") String theInstanceId, @Param("stepId") String theStepId) -
fetchChunksForStep
@Query("SELECT e FROM Batch2WorkChunkEntity e WHERE e.myInstanceId = :instanceId AND e.myTargetStepId = :targetStepId ORDER BY e.mySequence ASC") Stream<Batch2WorkChunkEntity> fetchChunksForStep(@Param("instanceId") String theInstanceId, @Param("targetStepId") String theTargetStepId) -
updateChunkStatusAndClearDataForEndSuccess
@Modifying @Query("UPDATE Batch2WorkChunkEntity e SET e.myStatus = :status, e.myEndTime = :et, e.myRecordsProcessed = :rp, e.myErrorCount = e.myErrorCount + :errorRetries, e.mySerializedData = null, e.myWarningMessage = :warningMessage WHERE e.myId = :id") void updateChunkStatusAndClearDataForEndSuccess(@Param("id") String theChunkId, @Param("et") Date theEndTime, @Param("rp") int theRecordsProcessed, @Param("errorRetries") int theErrorRetries, @Param("status") WorkChunkStatusEnum theInProgress, @Param("warningMessage") String theWarningMessage) -
updateAllChunksForInstanceStatusClearDataAndSetError
@Modifying @Query("UPDATE Batch2WorkChunkEntity e SET e.myStatus = :status, e.myEndTime = :et, e.mySerializedData = null, e.myErrorMessage = :em WHERE e.myId IN(:ids)") void updateAllChunksForInstanceStatusClearDataAndSetError(@Param("ids") List<String> theChunkIds, @Param("et") Date theEndTime, @Param("status") WorkChunkStatusEnum theInProgress, @Param("em") String theError) -
updateChunkStatusAndIncrementErrorCountForEndError
@Modifying @Query("UPDATE Batch2WorkChunkEntity e SET e.myStatus = :status, e.myEndTime = :et, e.myErrorMessage = :em, e.myErrorCount = e.myErrorCount + 1 WHERE e.myId = :id") int updateChunkStatusAndIncrementErrorCountForEndError(@Param("id") String theChunkId, @Param("et") Date theEndTime, @Param("em") String theErrorMessage, @Param("status") WorkChunkStatusEnum theInProgress) -
updateChunkStatusForStart
@Modifying @Query("UPDATE Batch2WorkChunkEntity e SET e.myStatus = :status, e.myStartTime = :st WHERE e.myId = :id AND e.myStatus IN :startStatuses") int updateChunkStatusForStart(@Param("id") String theChunkId, @Param("st") Date theStartedTime, @Param("status") WorkChunkStatusEnum theInProgress, @Param("startStatuses") Collection<WorkChunkStatusEnum> theStartStatuses) -
deleteAllForInstance
@Modifying @Query("DELETE FROM Batch2WorkChunkEntity e WHERE e.myInstanceId = :instanceId") int deleteAllForInstance(@Param("instanceId") String theInstanceId) -
fetchAllChunkIdsForStepWithStatus
@Query("SELECT e.myId from Batch2WorkChunkEntity e where e.myInstanceId = :instanceId AND e.myTargetStepId = :stepId AND e.myStatus = :status") List<String> fetchAllChunkIdsForStepWithStatus(@Param("instanceId") String theInstanceId, @Param("stepId") String theStepId, @Param("status") WorkChunkStatusEnum theStatus)
-