Package ca.uhn.fhir.jpa.batch2
Class JpaJobPersistenceImpl
java.lang.Object
ca.uhn.fhir.jpa.batch2.JpaJobPersistenceImpl
- All Implemented Interfaces:
IJobPersistence
,IWorkChunkPersistence
-
Nested Class Summary
Nested classes/interfaces inherited from interface ca.uhn.fhir.batch2.api.IJobPersistence
IJobPersistence.CreateResult, IJobPersistence.JobInstanceUpdateCallback
-
Field Summary
-
Constructor Summary
ConstructorDescriptionJpaJobPersistenceImpl
(IBatch2JobInstanceRepository theJobInstanceRepository, IBatch2WorkChunkRepository theWorkChunkRepository, IBatch2WorkChunkMetadataViewRepository theWorkChunkMetadataViewRepo, IHapiTransactionService theTransactionService, jakarta.persistence.EntityManager theEntityManager, ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster theInterceptorBroadcaster) Constructor -
Method Summary
Modifier and TypeMethodDescriptionboolean
advanceJobStepAndUpdateChunkStatus
(String theJobInstanceId, String theNextStepId, boolean theIsReductionStep) cancelInstance
(String theInstanceId) createWorkChunk
(WorkChunk theWorkChunk) void
deleteChunksAndMarkInstanceAsChunksPurged
(String theInstanceId) void
deleteInstanceAndChunks
(String theInstanceId) void
enqueueWorkChunkForProcessing
(String theChunkId, Consumer<Integer> theCallback) org.springframework.data.domain.Page
<WorkChunkMetadata> fetchAllWorkChunkMetadataForJobInStates
(org.springframework.data.domain.Pageable thePageable, String theInstanceId, Set<WorkChunkStatusEnum> theStates) fetchAllWorkChunksForStepStream
(String theInstanceId, String theStepId) fetchAllWorkChunksIterator
(String theInstanceId, boolean theWithData) Note: Not @Transactional because the transaction happens in a lambda that's called outside of this method's scopefetchBatchInstanceStatus
(String theInstanceId) fetchInstance
(String theInstanceId) fetchInstances
(int thePageSize, int thePageIndex) fetchInstances
(FetchJobInstancesRequest theRequest, int thePage, int theBatchSize) fetchInstances
(String theJobDefinitionId, Set<StatusEnum> theStatuses, Date theCutoff, org.springframework.data.domain.Pageable thePageable) fetchInstancesByJobDefinitionId
(String theJobDefinitionId, int thePageSize, int thePageIndex) fetchInstancesByJobDefinitionIdAndStatus
(String theJobDefinitionId, Set<StatusEnum> theRequestedStatuses, int thePageSize, int thePageIndex) org.springframework.data.domain.Page
<JobInstance> fetchJobInstances
(JobInstanceFetchRequest theRequest) fetchRecentInstances
(int thePageSize, int thePageIndex) fetchWorkChunkStatusForInstance
(String theInstanceId) getDistinctWorkChunkStatesForJobAndStep
(String theInstanceId, String theCurrentStepId) boolean
markInstanceAsStatusWhenStatusIn
(String theInstanceId, StatusEnum theStatusEnum, Set<StatusEnum> thePriorStates) void
markWorkChunksWithStatusAndWipeData
(String theInstanceId, List<String> theChunkIds, WorkChunkStatusEnum theStatus, String theErrorMessage) void
onWorkChunkCreate
(WorkChunkCreateEvent theBatchWorkChunk) onWorkChunkDequeue
(String theChunkId) onWorkChunkError
(WorkChunkErrorEvent theParameters) void
onWorkChunkFailed
(String theChunkId, String theErrorMessage) void
onWorkChunkPollDelay
(String theChunkId, Date theDeadline) storeNewInstance
(JobInstance theInstance) boolean
updateInstance
(String theInstanceId, IJobPersistence.JobInstanceUpdateCallback theModifier) void
updateInstanceUpdateTime
(String theInstanceId) int
updatePollWaitingChunksForJobIfReady
(String theInstanceId) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ca.uhn.fhir.batch2.api.IJobPersistence
onChunkDequeued, onCreateWithFirstChunk
-
Field Details
-
CREATE_TIME
- See Also:
-
-
Constructor Details
-
JpaJobPersistenceImpl
public JpaJobPersistenceImpl(IBatch2JobInstanceRepository theJobInstanceRepository, IBatch2WorkChunkRepository theWorkChunkRepository, IBatch2WorkChunkMetadataViewRepository theWorkChunkMetadataViewRepo, IHapiTransactionService theTransactionService, jakarta.persistence.EntityManager theEntityManager, ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster theInterceptorBroadcaster) Constructor
-
-
Method Details
-
onWorkChunkCreate
@Transactional(propagation=REQUIRED) public String onWorkChunkCreate(WorkChunkCreateEvent theBatchWorkChunk) - Specified by:
onWorkChunkCreate
in interfaceIWorkChunkPersistence
-
onWorkChunkDequeue
@Transactional(propagation=REQUIRED) public Optional<WorkChunk> onWorkChunkDequeue(String theChunkId) - Specified by:
onWorkChunkDequeue
in interfaceIWorkChunkPersistence
-
storeNewInstance
- Specified by:
storeNewInstance
in interfaceIJobPersistence
-
fetchInstances
@Transactional(propagation=REQUIRES_NEW) public List<JobInstance> fetchInstances(String theJobDefinitionId, Set<StatusEnum> theStatuses, Date theCutoff, org.springframework.data.domain.Pageable thePageable) - Specified by:
fetchInstances
in interfaceIJobPersistence
-
fetchInstancesByJobDefinitionIdAndStatus
@Transactional(propagation=REQUIRES_NEW) public List<JobInstance> fetchInstancesByJobDefinitionIdAndStatus(String theJobDefinitionId, Set<StatusEnum> theRequestedStatuses, int thePageSize, int thePageIndex) - Specified by:
fetchInstancesByJobDefinitionIdAndStatus
in interfaceIJobPersistence
-
fetchInstancesByJobDefinitionId
@Transactional(propagation=REQUIRES_NEW) public List<JobInstance> fetchInstancesByJobDefinitionId(String theJobDefinitionId, int thePageSize, int thePageIndex) - Specified by:
fetchInstancesByJobDefinitionId
in interfaceIJobPersistence
-
fetchJobInstances
@Transactional(propagation=REQUIRES_NEW) public org.springframework.data.domain.Page<JobInstance> fetchJobInstances(JobInstanceFetchRequest theRequest) - Specified by:
fetchJobInstances
in interfaceIJobPersistence
-
fetchInstance
- Specified by:
fetchInstance
in interfaceIJobPersistence
-
fetchWorkChunkStatusForInstance
- Specified by:
fetchWorkChunkStatusForInstance
in interfaceIJobPersistence
-
fetchBatchInstanceStatus
- Specified by:
fetchBatchInstanceStatus
in interfaceIJobPersistence
-
fetchInstances
@Transactional(propagation=REQUIRES_NEW) public List<JobInstance> fetchInstances(FetchJobInstancesRequest theRequest, int thePage, int theBatchSize) - Specified by:
fetchInstances
in interfaceIJobPersistence
-
fetchInstances
@Transactional(propagation=REQUIRES_NEW) public List<JobInstance> fetchInstances(int thePageSize, int thePageIndex) - Specified by:
fetchInstances
in interfaceIJobPersistence
-
enqueueWorkChunkForProcessing
- Specified by:
enqueueWorkChunkForProcessing
in interfaceIJobPersistence
-
updatePollWaitingChunksForJobIfReady
- Specified by:
updatePollWaitingChunksForJobIfReady
in interfaceIJobPersistence
-
fetchRecentInstances
@Transactional(propagation=REQUIRES_NEW) public List<JobInstance> fetchRecentInstances(int thePageSize, int thePageIndex) - Specified by:
fetchRecentInstances
in interfaceIJobPersistence
-
onWorkChunkError
- Specified by:
onWorkChunkError
in interfaceIWorkChunkPersistence
-
onWorkChunkPollDelay
- Specified by:
onWorkChunkPollDelay
in interfaceIWorkChunkPersistence
-
onWorkChunkFailed
- Specified by:
onWorkChunkFailed
in interfaceIWorkChunkPersistence
-
onWorkChunkCompletion
- Specified by:
onWorkChunkCompletion
in interfaceIWorkChunkPersistence
-
markWorkChunksWithStatusAndWipeData
public void markWorkChunksWithStatusAndWipeData(String theInstanceId, List<String> theChunkIds, WorkChunkStatusEnum theStatus, String theErrorMessage) - Specified by:
markWorkChunksWithStatusAndWipeData
in interfaceIWorkChunkPersistence
-
getDistinctWorkChunkStatesForJobAndStep
public Set<WorkChunkStatusEnum> getDistinctWorkChunkStatesForJobAndStep(String theInstanceId, String theCurrentStepId) - Specified by:
getDistinctWorkChunkStatesForJobAndStep
in interfaceIJobPersistence
-
updateInstanceUpdateTime
- Specified by:
updateInstanceUpdateTime
in interfaceIJobPersistence
-
createWorkChunk
- Specified by:
createWorkChunk
in interfaceIJobPersistence
-
fetchAllWorkChunksIterator
Note: Not @Transactional because the transaction happens in a lambda that's called outside of this method's scope- Specified by:
fetchAllWorkChunksIterator
in interfaceIJobPersistence
- Specified by:
fetchAllWorkChunksIterator
in interfaceIWorkChunkPersistence
-
fetchAllWorkChunksForStepStream
- Specified by:
fetchAllWorkChunksForStepStream
in interfaceIJobPersistence
- Specified by:
fetchAllWorkChunksForStepStream
in interfaceIWorkChunkPersistence
-
fetchAllWorkChunkMetadataForJobInStates
public org.springframework.data.domain.Page<WorkChunkMetadata> fetchAllWorkChunkMetadataForJobInStates(org.springframework.data.domain.Pageable thePageable, String theInstanceId, Set<WorkChunkStatusEnum> theStates) - Specified by:
fetchAllWorkChunkMetadataForJobInStates
in interfaceIJobPersistence
-
updateInstance
public boolean updateInstance(String theInstanceId, IJobPersistence.JobInstanceUpdateCallback theModifier) - Specified by:
updateInstance
in interfaceIJobPersistence
-
deleteInstanceAndChunks
- Specified by:
deleteInstanceAndChunks
in interfaceIJobPersistence
-
deleteChunksAndMarkInstanceAsChunksPurged
@Transactional(propagation=REQUIRES_NEW) public void deleteChunksAndMarkInstanceAsChunksPurged(String theInstanceId) - Specified by:
deleteChunksAndMarkInstanceAsChunksPurged
in interfaceIJobPersistence
-
markInstanceAsStatusWhenStatusIn
public boolean markInstanceAsStatusWhenStatusIn(String theInstanceId, StatusEnum theStatusEnum, Set<StatusEnum> thePriorStates) - Specified by:
markInstanceAsStatusWhenStatusIn
in interfaceIJobPersistence
-
cancelInstance
@Transactional(propagation=REQUIRES_NEW) public JobOperationResultJson cancelInstance(String theInstanceId) - Specified by:
cancelInstance
in interfaceIJobPersistence
-
advanceJobStepAndUpdateChunkStatus
@Transactional(propagation=REQUIRES_NEW) public boolean advanceJobStepAndUpdateChunkStatus(String theJobInstanceId, String theNextStepId, boolean theIsReductionStep) - Specified by:
advanceJobStepAndUpdateChunkStatus
in interfaceIJobPersistence
-