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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations