Search in sources :

Example 1 with DeadLetterJobEntity

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

the class MoveJobToDeadLetterJobCmd method execute.

public DeadLetterJobEntity execute(CommandContext commandContext) {
    if (jobId == null) {
        throw new ActivitiIllegalArgumentException("jobId and job is null");
    }
    AbstractJobEntity job = commandContext.getTimerJobEntityManager().findById(jobId);
    if (job == null) {
        job = commandContext.getJobEntityManager().findById(jobId);
    }
    if (job == null) {
        throw new JobNotFoundException(jobId);
    }
    if (log.isDebugEnabled()) {
        log.debug("Moving job to deadletter job table {}", job.getId());
    }
    DeadLetterJobEntity deadLetterJob = commandContext.getJobManager().moveJobToDeadLetterJob(job);
    return deadLetterJob;
}
Also used : ActivitiIllegalArgumentException(org.activiti.engine.ActivitiIllegalArgumentException) AbstractJobEntity(org.activiti.engine.impl.persistence.entity.AbstractJobEntity) JobNotFoundException(org.activiti.engine.JobNotFoundException) DeadLetterJobEntity(org.activiti.engine.impl.persistence.entity.DeadLetterJobEntity)

Example 2 with DeadLetterJobEntity

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

the class DeleteDeadLetterJobCmd method execute.

public Object execute(CommandContext commandContext) {
    DeadLetterJobEntity jobToDelete = getJobToDelete(commandContext);
    sendCancelEvent(jobToDelete);
    commandContext.getDeadLetterJobEntityManager().delete(jobToDelete);
    return null;
}
Also used : DeadLetterJobEntity(org.activiti.engine.impl.persistence.entity.DeadLetterJobEntity)

Example 3 with DeadLetterJobEntity

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

the class DefaultJobManager method moveJobToDeadLetterJob.

@Override
public DeadLetterJobEntity moveJobToDeadLetterJob(AbstractJobEntity job) {
    DeadLetterJobEntity deadLetterJob = createDeadLetterJobFromOtherJob(job);
    processEngineConfiguration.getDeadLetterJobEntityManager().insert(deadLetterJob);
    if (job instanceof TimerJobEntity) {
        processEngineConfiguration.getTimerJobEntityManager().delete((TimerJobEntity) job);
    } else if (job instanceof JobEntity) {
        processEngineConfiguration.getJobEntityManager().delete((JobEntity) job);
    }
    return deadLetterJob;
}
Also used : DeadLetterJobEntity(org.activiti.engine.impl.persistence.entity.DeadLetterJobEntity) SuspendedJobEntity(org.activiti.engine.impl.persistence.entity.SuspendedJobEntity) AbstractJobEntity(org.activiti.engine.impl.persistence.entity.AbstractJobEntity) JobEntity(org.activiti.engine.impl.persistence.entity.JobEntity) TimerJobEntity(org.activiti.engine.impl.persistence.entity.TimerJobEntity) TimerJobEntity(org.activiti.engine.impl.persistence.entity.TimerJobEntity) DeadLetterJobEntity(org.activiti.engine.impl.persistence.entity.DeadLetterJobEntity)

Example 4 with DeadLetterJobEntity

use of org.activiti.engine.impl.persistence.entity.DeadLetterJobEntity 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 5 with DeadLetterJobEntity

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

the class DefaultJobManager method createDeadLetterJobFromOtherJob.

protected DeadLetterJobEntity createDeadLetterJobFromOtherJob(AbstractJobEntity otherJob) {
    DeadLetterJobEntity deadLetterJob = processEngineConfiguration.getDeadLetterJobEntityManager().create();
    copyJobInfo(deadLetterJob, otherJob);
    return deadLetterJob;
}
Also used : DeadLetterJobEntity(org.activiti.engine.impl.persistence.entity.DeadLetterJobEntity)

Aggregations

DeadLetterJobEntity (org.activiti.engine.impl.persistence.entity.DeadLetterJobEntity)6 AbstractJobEntity (org.activiti.engine.impl.persistence.entity.AbstractJobEntity)3 JobEntity (org.activiti.engine.impl.persistence.entity.JobEntity)3 SuspendedJobEntity (org.activiti.engine.impl.persistence.entity.SuspendedJobEntity)3 TimerJobEntity (org.activiti.engine.impl.persistence.entity.TimerJobEntity)3 ActivitiIllegalArgumentException (org.activiti.engine.ActivitiIllegalArgumentException)2 JobNotFoundException (org.activiti.engine.JobNotFoundException)1 DeadLetterJobEntityManager (org.activiti.engine.impl.persistence.entity.DeadLetterJobEntityManager)1 JobEntityManager (org.activiti.engine.impl.persistence.entity.JobEntityManager)1 SuspendedJobEntityManager (org.activiti.engine.impl.persistence.entity.SuspendedJobEntityManager)1 TimerJobEntityManager (org.activiti.engine.impl.persistence.entity.TimerJobEntityManager)1