
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
Fields -
Constructor Summary
ConstructorsConstructorDescriptionJpaJobPersistenceImpl(IBatch2JobInstanceRepository theJobInstanceRepository, IBatch2WorkChunkRepository theWorkChunkRepository, IBatch2WorkChunkMetadataViewRepository theWorkChunkMetadataViewRepo, IHapiTransactionService theTransactionService, jakarta.persistence.EntityManager theEntityManager, ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster theInterceptorBroadcaster) Constructor -
Method Summary
Modifier and TypeMethodDescriptionbooleanadvanceJobStepAndUpdateChunkStatus(String theJobInstanceId, String theNextStepId, boolean theIsReductionStep) cancelInstance(String theInstanceId) createWorkChunk(WorkChunk theWorkChunk) voiddeleteChunksAndMarkInstanceAsChunksPurged(String theInstanceId) voiddeleteInstanceAndChunks(String theInstanceId) voidenqueueWorkChunkForProcessing(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) booleanmarkInstanceAsStatusWhenStatusIn(String theInstanceId, StatusEnum theStatusEnum, Set<StatusEnum> thePriorStates) voidmarkWorkChunksWithStatusAndWipeData(String theInstanceId, List<String> theChunkIds, WorkChunkStatusEnum theStatus, String theErrorMessage) voidonWorkChunkCreate(WorkChunkCreateEvent theBatchWorkChunk) onWorkChunkDequeue(String theChunkId) onWorkChunkError(WorkChunkErrorEvent theParameters) voidonWorkChunkFailed(String theChunkId, String theErrorMessage) voidonWorkChunkPollDelay(String theChunkId, Date theDeadline) storeNewInstance(JobInstance theInstance) booleanupdateInstance(String theInstanceId, IJobPersistence.JobInstanceUpdateCallback theModifier) voidupdateInstanceUpdateTime(String theInstanceId) intupdatePollWaitingChunksForJobIfReady(String theInstanceId) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
onWorkChunkCreatein interfaceIWorkChunkPersistence
-
onWorkChunkDequeue
@Transactional(propagation=REQUIRED) public Optional<WorkChunk> onWorkChunkDequeue(String theChunkId) - Specified by:
onWorkChunkDequeuein interfaceIWorkChunkPersistence
-
storeNewInstance
- Specified by:
storeNewInstancein 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:
fetchInstancesin interfaceIJobPersistence
-
fetchInstancesByJobDefinitionIdAndStatus
@Transactional(propagation=REQUIRES_NEW) public List<JobInstance> fetchInstancesByJobDefinitionIdAndStatus(String theJobDefinitionId, Set<StatusEnum> theRequestedStatuses, int thePageSize, int thePageIndex) - Specified by:
fetchInstancesByJobDefinitionIdAndStatusin interfaceIJobPersistence
-
fetchInstancesByJobDefinitionId
@Transactional(propagation=REQUIRES_NEW) public List<JobInstance> fetchInstancesByJobDefinitionId(String theJobDefinitionId, int thePageSize, int thePageIndex) - Specified by:
fetchInstancesByJobDefinitionIdin interfaceIJobPersistence
-
fetchJobInstances
@Transactional(propagation=REQUIRES_NEW) public org.springframework.data.domain.Page<JobInstance> fetchJobInstances(JobInstanceFetchRequest theRequest) - Specified by:
fetchJobInstancesin interfaceIJobPersistence
-
fetchInstance
- Specified by:
fetchInstancein interfaceIJobPersistence
-
fetchWorkChunkStatusForInstance
- Specified by:
fetchWorkChunkStatusForInstancein interfaceIJobPersistence
-
fetchBatchInstanceStatus
- Specified by:
fetchBatchInstanceStatusin interfaceIJobPersistence
-
fetchInstances
@Transactional(propagation=REQUIRES_NEW) public List<JobInstance> fetchInstances(FetchJobInstancesRequest theRequest, int thePage, int theBatchSize) - Specified by:
fetchInstancesin interfaceIJobPersistence
-
fetchInstances
@Transactional(propagation=REQUIRES_NEW) public List<JobInstance> fetchInstances(int thePageSize, int thePageIndex) - Specified by:
fetchInstancesin interfaceIJobPersistence
-
enqueueWorkChunkForProcessing
- Specified by:
enqueueWorkChunkForProcessingin interfaceIJobPersistence
-
updatePollWaitingChunksForJobIfReady
- Specified by:
updatePollWaitingChunksForJobIfReadyin interfaceIJobPersistence
-
fetchRecentInstances
@Transactional(propagation=REQUIRES_NEW) public List<JobInstance> fetchRecentInstances(int thePageSize, int thePageIndex) - Specified by:
fetchRecentInstancesin interfaceIJobPersistence
-
onWorkChunkError
- Specified by:
onWorkChunkErrorin interfaceIWorkChunkPersistence
-
onWorkChunkPollDelay
- Specified by:
onWorkChunkPollDelayin interfaceIWorkChunkPersistence
-
onWorkChunkFailed
- Specified by:
onWorkChunkFailedin interfaceIWorkChunkPersistence
-
onWorkChunkCompletion
- Specified by:
onWorkChunkCompletionin interfaceIWorkChunkPersistence
-
markWorkChunksWithStatusAndWipeData
public void markWorkChunksWithStatusAndWipeData(String theInstanceId, List<String> theChunkIds, WorkChunkStatusEnum theStatus, String theErrorMessage) - Specified by:
markWorkChunksWithStatusAndWipeDatain interfaceIWorkChunkPersistence
-
getDistinctWorkChunkStatesForJobAndStep
public Set<WorkChunkStatusEnum> getDistinctWorkChunkStatesForJobAndStep(String theInstanceId, String theCurrentStepId) - Specified by:
getDistinctWorkChunkStatesForJobAndStepin interfaceIJobPersistence
-
updateInstanceUpdateTime
- Specified by:
updateInstanceUpdateTimein interfaceIJobPersistence
-
createWorkChunk
- Specified by:
createWorkChunkin interfaceIJobPersistence
-
fetchAllWorkChunksIterator
Note: Not @Transactional because the transaction happens in a lambda that's called outside of this method's scope- Specified by:
fetchAllWorkChunksIteratorin interfaceIJobPersistence- Specified by:
fetchAllWorkChunksIteratorin interfaceIWorkChunkPersistence
-
fetchAllWorkChunksForStepStream
- Specified by:
fetchAllWorkChunksForStepStreamin interfaceIJobPersistence- Specified by:
fetchAllWorkChunksForStepStreamin interfaceIWorkChunkPersistence
-
fetchAllWorkChunkMetadataForJobInStates
public org.springframework.data.domain.Page<WorkChunkMetadata> fetchAllWorkChunkMetadataForJobInStates(org.springframework.data.domain.Pageable thePageable, String theInstanceId, Set<WorkChunkStatusEnum> theStates) - Specified by:
fetchAllWorkChunkMetadataForJobInStatesin interfaceIJobPersistence
-
updateInstance
public boolean updateInstance(String theInstanceId, IJobPersistence.JobInstanceUpdateCallback theModifier) - Specified by:
updateInstancein interfaceIJobPersistence
-
deleteInstanceAndChunks
- Specified by:
deleteInstanceAndChunksin interfaceIJobPersistence
-
deleteChunksAndMarkInstanceAsChunksPurged
@Transactional(propagation=REQUIRES_NEW) public void deleteChunksAndMarkInstanceAsChunksPurged(String theInstanceId) - Specified by:
deleteChunksAndMarkInstanceAsChunksPurgedin interfaceIJobPersistence
-
markInstanceAsStatusWhenStatusIn
public boolean markInstanceAsStatusWhenStatusIn(String theInstanceId, StatusEnum theStatusEnum, Set<StatusEnum> thePriorStates) - Specified by:
markInstanceAsStatusWhenStatusInin interfaceIJobPersistence
-
cancelInstance
@Transactional(propagation=REQUIRES_NEW) public JobOperationResultJson cancelInstance(String theInstanceId) - Specified by:
cancelInstancein interfaceIJobPersistence
-
advanceJobStepAndUpdateChunkStatus
@Transactional(propagation=REQUIRES_NEW) public boolean advanceJobStepAndUpdateChunkStatus(String theJobInstanceId, String theNextStepId, boolean theIsReductionStep) - Specified by:
advanceJobStepAndUpdateChunkStatusin interfaceIJobPersistence
-