Search in sources :

Example 1 with AbstractJobEntity

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

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

the class DefaultJobManager method activateSuspendedJob.

@Override
public AbstractJobEntity activateSuspendedJob(SuspendedJobEntity job) {
    AbstractJobEntity activatedJob = null;
    if (Job.JOB_TYPE_TIMER.equals(job.getJobType())) {
        activatedJob = createTimerJobFromOtherJob(job);
        processEngineConfiguration.getTimerJobEntityManager().insert((TimerJobEntity) activatedJob);
    } else {
        activatedJob = createExecutableJobFromOtherJob(job);
        JobEntity jobEntity = (JobEntity) activatedJob;
        processEngineConfiguration.getJobEntityManager().insert(jobEntity);
        triggerExecutorIfNeeded(jobEntity);
    }
    processEngineConfiguration.getSuspendedJobEntityManager().delete(job);
    return activatedJob;
}
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) AbstractJobEntity(org.activiti.engine.impl.persistence.entity.AbstractJobEntity)

Example 3 with AbstractJobEntity

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

the class DefaultJobManager method moveJobToTimerJob.

@Override
public TimerJobEntity moveJobToTimerJob(AbstractJobEntity job) {
    TimerJobEntity timerJob = createTimerJobFromOtherJob(job);
    boolean insertSuccesful = processEngineConfiguration.getTimerJobEntityManager().insertTimerJobEntity(timerJob);
    if (insertSuccesful) {
        if (job instanceof JobEntity) {
            processEngineConfiguration.getJobEntityManager().delete((JobEntity) job);
        } else if (job instanceof SuspendedJobEntity) {
            processEngineConfiguration.getSuspendedJobEntityManager().delete((SuspendedJobEntity) job);
        }
        return timerJob;
    }
    return null;
}
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) SuspendedJobEntity(org.activiti.engine.impl.persistence.entity.SuspendedJobEntity) TimerJobEntity(org.activiti.engine.impl.persistence.entity.TimerJobEntity)

Example 4 with AbstractJobEntity

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

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

the class DefaultJobManager method moveJobToSuspendedJob.

@Override
public SuspendedJobEntity moveJobToSuspendedJob(AbstractJobEntity job) {
    SuspendedJobEntity suspendedJob = createSuspendedJobFromOtherJob(job);
    processEngineConfiguration.getSuspendedJobEntityManager().insert(suspendedJob);
    if (job instanceof TimerJobEntity) {
        processEngineConfiguration.getTimerJobEntityManager().delete((TimerJobEntity) job);
    } else if (job instanceof JobEntity) {
        processEngineConfiguration.getJobEntityManager().delete((JobEntity) job);
    }
    return suspendedJob;
}
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) SuspendedJobEntity(org.activiti.engine.impl.persistence.entity.SuspendedJobEntity) TimerJobEntity(org.activiti.engine.impl.persistence.entity.TimerJobEntity)

Aggregations

AbstractJobEntity (org.activiti.engine.impl.persistence.entity.AbstractJobEntity)8 DeadLetterJobEntity (org.activiti.engine.impl.persistence.entity.DeadLetterJobEntity)6 JobEntity (org.activiti.engine.impl.persistence.entity.JobEntity)6 SuspendedJobEntity (org.activiti.engine.impl.persistence.entity.SuspendedJobEntity)5 TimerJobEntity (org.activiti.engine.impl.persistence.entity.TimerJobEntity)5 GregorianCalendar (java.util.GregorianCalendar)1 BPMNTimerImpl (org.activiti.api.runtime.model.impl.BPMNTimerImpl)1 FlowElement (org.activiti.bpmn.model.FlowElement)1 ServiceTask (org.activiti.bpmn.model.ServiceTask)1 ActivitiException (org.activiti.engine.ActivitiException)1 ActivitiIllegalArgumentException (org.activiti.engine.ActivitiIllegalArgumentException)1 JobNotFoundException (org.activiti.engine.JobNotFoundException)1 ProcessEngineConfiguration (org.activiti.engine.ProcessEngineConfiguration)1 ActivitiEventDispatcher (org.activiti.engine.delegate.event.ActivitiEventDispatcher)1 DurationHelper (org.activiti.engine.impl.calendar.DurationHelper)1 ExecutionEntity (org.activiti.engine.impl.persistence.entity.ExecutionEntity)1