Search in sources :

Example 6 with TimerEntity

use of org.camunda.bpm.engine.impl.persistence.entity.TimerEntity in project camunda-bpm-platform by camunda.

the class TimerDeclarationImpl method createTimer.

public TimerEntity createTimer(ExecutionEntity execution) {
    TimerEntity timer = super.createJobInstance(execution);
    scheduleTimer(timer);
    return timer;
}
Also used : TimerEntity(org.camunda.bpm.engine.impl.persistence.entity.TimerEntity)

Example 7 with TimerEntity

use of org.camunda.bpm.engine.impl.persistence.entity.TimerEntity in project camunda-bpm-platform by camunda.

the class AbstractSetStateCmd method scheduleSuspensionStateUpdate.

protected void scheduleSuspensionStateUpdate(CommandContext commandContext) {
    TimerEntity timer = new TimerEntity();
    JobHandlerConfiguration jobHandlerConfiguration = getJobHandlerConfiguration();
    timer.setDuedate(executionDate);
    timer.setJobHandlerType(getDelayedExecutionJobHandlerType());
    timer.setJobHandlerConfigurationRaw(jobHandlerConfiguration.toCanonicalString());
    commandContext.getJobManager().schedule(timer);
}
Also used : TimerEntity(org.camunda.bpm.engine.impl.persistence.entity.TimerEntity) JobHandlerConfiguration(org.camunda.bpm.engine.impl.jobexecutor.JobHandlerConfiguration)

Example 8 with TimerEntity

use of org.camunda.bpm.engine.impl.persistence.entity.TimerEntity in project camunda-bpm-platform by camunda.

the class InputOutputEventTest method testTimerCatchEvent.

@Deployment
public void testTimerCatchEvent() {
    Map<String, Object> variables = new HashMap<String, Object>();
    Date dueDate = DateTimeUtil.now().plusMinutes(5).toDate();
    variables.put("outerVariable", new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(dueDate));
    runtimeService.startProcessInstanceByKey("testProcess", variables);
    Job job = managementService.createJobQuery().singleResult();
    TimerEntity timer = (TimerEntity) job;
    assertDateEquals(dueDate, timer.getDuedate());
}
Also used : HashMap(java.util.HashMap) TimerEntity(org.camunda.bpm.engine.impl.persistence.entity.TimerEntity) Job(org.camunda.bpm.engine.runtime.Job) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

TimerEntity (org.camunda.bpm.engine.impl.persistence.entity.TimerEntity)8 Date (java.util.Date)4 CommandContext (org.camunda.bpm.engine.impl.interceptor.CommandContext)3 CommandExecutor (org.camunda.bpm.engine.impl.interceptor.CommandExecutor)3 JobManager (org.camunda.bpm.engine.impl.persistence.entity.JobManager)2 PrintWriter (java.io.PrintWriter)1 StringWriter (java.io.StringWriter)1 SimpleDateFormat (java.text.SimpleDateFormat)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 AcquireJobsCmd (org.camunda.bpm.engine.impl.cmd.AcquireJobsCmd)1 AcquiredJobs (org.camunda.bpm.engine.impl.jobexecutor.AcquiredJobs)1 JobExecutor (org.camunda.bpm.engine.impl.jobexecutor.JobExecutor)1 JobHandlerConfiguration (org.camunda.bpm.engine.impl.jobexecutor.JobHandlerConfiguration)1 Job (org.camunda.bpm.engine.runtime.Job)1 Deployment (org.camunda.bpm.engine.test.Deployment)1