Search in sources :

Example 16 with TimerJobEntity

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

the class DeleteTimerJobCmd method execute.

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

Example 17 with TimerJobEntity

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

the class AbstractSetProcessDefinitionStateCmd method createTimerForDelayedExecution.

protected void createTimerForDelayedExecution(CommandContext commandContext, List<ProcessDefinitionEntity> processDefinitions) {
    for (ProcessDefinitionEntity processDefinition : processDefinitions) {
        TimerJobEntity timer = commandContext.getTimerJobEntityManager().create();
        timer.setJobType(JobEntity.JOB_TYPE_TIMER);
        timer.setProcessDefinitionId(processDefinition.getId());
        // Inherit tenant identifier (if applicable)
        if (processDefinition.getTenantId() != null) {
            timer.setTenantId(processDefinition.getTenantId());
        }
        timer.setDuedate(executionDate);
        timer.setJobHandlerType(getDelayedExecutionJobHandlerType());
        timer.setJobHandlerConfiguration(TimerChangeProcessDefinitionSuspensionStateJobHandler.createJobHandlerConfiguration(includeProcessInstances));
        commandContext.getJobManager().scheduleTimerJob(timer);
    }
}
Also used : ProcessDefinitionEntity(org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity) TimerJobEntity(org.activiti.engine.impl.persistence.entity.TimerJobEntity)

Example 18 with TimerJobEntity

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

the class IntermediateCatchTimerEventActivityBehavior method execute.

public void execute(DelegateExecution execution) {
    JobManager jobManager = Context.getCommandContext().getJobManager();
    // end date should be ignored for intermediate timer events.
    TimerJobEntity timerJob = jobManager.createTimerJob(timerEventDefinition, false, (ExecutionEntity) execution, TriggerTimerEventJobHandler.TYPE, TimerEventHandler.createConfiguration(execution.getCurrentActivityId(), null, timerEventDefinition.getCalendarName()));
    if (timerJob != null) {
        jobManager.scheduleTimerJob(timerJob);
    }
}
Also used : JobManager(org.activiti.engine.impl.asyncexecutor.JobManager) TimerJobEntity(org.activiti.engine.impl.persistence.entity.TimerJobEntity)

Example 19 with TimerJobEntity

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

the class DefaultJobManager method createTimerJobFromOtherJob.

protected TimerJobEntity createTimerJobFromOtherJob(AbstractJobEntity otherJob) {
    TimerJobEntity timerJob = processEngineConfiguration.getTimerJobEntityManager().create();
    copyJobInfo(timerJob, otherJob);
    return timerJob;
}
Also used : TimerJobEntity(org.activiti.engine.impl.persistence.entity.TimerJobEntity)

Example 20 with TimerJobEntity

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

the class BoundaryTimerEventActivityBehavior method execute.

@Override
public void execute(DelegateExecution execution) {
    ExecutionEntity executionEntity = (ExecutionEntity) execution;
    if (!(execution.getCurrentFlowElement() instanceof BoundaryEvent)) {
        throw new ActivitiException("Programmatic error: " + this.getClass() + " should not be used for anything else than a boundary event");
    }
    JobManager jobManager = Context.getCommandContext().getJobManager();
    TimerJobEntity timerJob = jobManager.createTimerJob(timerEventDefinition, interrupting, executionEntity, TriggerTimerEventJobHandler.TYPE, TimerEventHandler.createConfiguration(execution.getCurrentActivityId(), timerEventDefinition.getEndDate(), timerEventDefinition.getCalendarName()));
    if (timerJob != null) {
        jobManager.scheduleTimerJob(timerJob);
    }
}
Also used : ActivitiException(org.activiti.engine.ActivitiException) ExecutionEntity(org.activiti.engine.impl.persistence.entity.ExecutionEntity) BoundaryEvent(org.activiti.bpmn.model.BoundaryEvent) JobManager(org.activiti.engine.impl.asyncexecutor.JobManager) TimerJobEntity(org.activiti.engine.impl.persistence.entity.TimerJobEntity)

Aggregations

TimerJobEntity (org.activiti.engine.impl.persistence.entity.TimerJobEntity)28 JobEntity (org.activiti.engine.impl.persistence.entity.JobEntity)8 SuspendedJobEntity (org.activiti.engine.impl.persistence.entity.SuspendedJobEntity)7 DeadLetterJobEntity (org.activiti.engine.impl.persistence.entity.DeadLetterJobEntity)6 Deployment (org.activiti.engine.test.Deployment)6 AbstractJobEntity (org.activiti.engine.impl.persistence.entity.AbstractJobEntity)5 Job (org.activiti.engine.runtime.Job)5 ActivitiException (org.activiti.engine.ActivitiException)4 JobManager (org.activiti.engine.impl.asyncexecutor.JobManager)4 CommandContext (org.activiti.engine.impl.interceptor.CommandContext)4 CommandExecutor (org.activiti.engine.impl.interceptor.CommandExecutor)4 Date (java.util.Date)3 ProcessDefinition (org.activiti.engine.repository.ProcessDefinition)3 Calendar (java.util.Calendar)2 FlowElement (org.activiti.bpmn.model.FlowElement)2 VariableScope (org.activiti.engine.delegate.VariableScope)2 Page (org.activiti.engine.impl.Page)2 AcquiredTimerJobEntities (org.activiti.engine.impl.asyncexecutor.AcquiredTimerJobEntities)2 AcquireTimerJobsCmd (org.activiti.engine.impl.cmd.AcquireTimerJobsCmd)2 NoExecutionVariableScope (org.activiti.engine.impl.el.NoExecutionVariableScope)2