Search in sources :

Example 1 with JobEntityManager

use of org.activiti.engine.impl.persistence.entity.JobEntityManager in project Activiti by Activiti.

the class DestroyScopeOperation method deleteAllScopeJobs.

private void deleteAllScopeJobs(ExecutionEntity scopeExecution, TimerJobEntityManager timerJobEntityManager) {
    Collection<TimerJobEntity> timerJobsForExecution = timerJobEntityManager.findJobsByExecutionId(scopeExecution.getId());
    for (TimerJobEntity job : timerJobsForExecution) {
        timerJobEntityManager.delete(job);
    }
    JobEntityManager jobEntityManager = commandContext.getJobEntityManager();
    Collection<JobEntity> jobsForExecution = jobEntityManager.findJobsByExecutionId(scopeExecution.getId());
    for (JobEntity job : jobsForExecution) {
        jobEntityManager.delete(job);
    }
    SuspendedJobEntityManager suspendedJobEntityManager = commandContext.getSuspendedJobEntityManager();
    Collection<SuspendedJobEntity> suspendedJobsForExecution = suspendedJobEntityManager.findJobsByExecutionId(scopeExecution.getId());
    for (SuspendedJobEntity job : suspendedJobsForExecution) {
        suspendedJobEntityManager.delete(job);
    }
    DeadLetterJobEntityManager deadLetterJobEntityManager = commandContext.getDeadLetterJobEntityManager();
    Collection<DeadLetterJobEntity> deadLetterJobsForExecution = deadLetterJobEntityManager.findJobsByExecutionId(scopeExecution.getId());
    for (DeadLetterJobEntity job : deadLetterJobsForExecution) {
        deadLetterJobEntityManager.delete(job);
    }
}
Also used : DeadLetterJobEntity(org.activiti.engine.impl.persistence.entity.DeadLetterJobEntity) SuspendedJobEntity(org.activiti.engine.impl.persistence.entity.SuspendedJobEntity) JobEntity(org.activiti.engine.impl.persistence.entity.JobEntity) TimerJobEntity(org.activiti.engine.impl.persistence.entity.TimerJobEntity) TimerJobEntityManager(org.activiti.engine.impl.persistence.entity.TimerJobEntityManager) JobEntityManager(org.activiti.engine.impl.persistence.entity.JobEntityManager) DeadLetterJobEntityManager(org.activiti.engine.impl.persistence.entity.DeadLetterJobEntityManager) SuspendedJobEntityManager(org.activiti.engine.impl.persistence.entity.SuspendedJobEntityManager) DeadLetterJobEntityManager(org.activiti.engine.impl.persistence.entity.DeadLetterJobEntityManager) SuspendedJobEntity(org.activiti.engine.impl.persistence.entity.SuspendedJobEntity) SuspendedJobEntityManager(org.activiti.engine.impl.persistence.entity.SuspendedJobEntityManager) TimerJobEntity(org.activiti.engine.impl.persistence.entity.TimerJobEntity) DeadLetterJobEntity(org.activiti.engine.impl.persistence.entity.DeadLetterJobEntity)

Example 2 with JobEntityManager

use of org.activiti.engine.impl.persistence.entity.JobEntityManager in project Activiti by Activiti.

the class IntermediateCatchTimerEventActivityBehavior method eventCancelledByEventGateway.

@Override
public void eventCancelledByEventGateway(DelegateExecution execution) {
    JobEntityManager jobEntityManager = Context.getCommandContext().getJobEntityManager();
    List<JobEntity> jobEntities = jobEntityManager.findJobsByExecutionId(execution.getId());
    for (JobEntity jobEntity : jobEntities) {
        // Should be only one
        jobEntityManager.delete(jobEntity);
    }
    Context.getCommandContext().getExecutionEntityManager().deleteExecutionAndRelatedData((ExecutionEntity) execution, DeleteReason.EVENT_BASED_GATEWAY_CANCEL);
}
Also used : JobEntity(org.activiti.engine.impl.persistence.entity.JobEntity) TimerJobEntity(org.activiti.engine.impl.persistence.entity.TimerJobEntity) JobEntityManager(org.activiti.engine.impl.persistence.entity.JobEntityManager)

Aggregations

JobEntity (org.activiti.engine.impl.persistence.entity.JobEntity)2 JobEntityManager (org.activiti.engine.impl.persistence.entity.JobEntityManager)2 TimerJobEntity (org.activiti.engine.impl.persistence.entity.TimerJobEntity)2 DeadLetterJobEntity (org.activiti.engine.impl.persistence.entity.DeadLetterJobEntity)1 DeadLetterJobEntityManager (org.activiti.engine.impl.persistence.entity.DeadLetterJobEntityManager)1 SuspendedJobEntity (org.activiti.engine.impl.persistence.entity.SuspendedJobEntity)1 SuspendedJobEntityManager (org.activiti.engine.impl.persistence.entity.SuspendedJobEntityManager)1 TimerJobEntityManager (org.activiti.engine.impl.persistence.entity.TimerJobEntityManager)1