Package org.camunda.bpm.engine.runtime

Examples of org.camunda.bpm.engine.runtime.Job


    // the job definition is created
    Assert.assertEquals(1, managementService.createJobDefinitionQuery().processDefinitionKey(key).count());

    // the existing job is NOT associated with the new job definition
    Job migratedJob = managementService.createJobQuery().processInstanceId(migratedInstance.getId()).singleResult();
    Assert.assertNull(migratedJob.getJobDefinitionId());

    // the new job is associated with the new job definition
    Job newJob = managementService.createJobQuery().processInstanceId(newInstance.getId()).singleResult();
    Assert.assertNotNull(newJob.getJobDefinitionId());

    // I can complete both instances:
    managementService.executeJob(migratedJob.getId());
    managementService.executeJob(newJob.getId());


  }
View Full Code Here


    ExecutionQuery executionQuery = runtimeService.createExecutionQuery().processInstanceId(pi.getId());
    JobQuery jobQuery = managementService.createJobQuery().processInstanceId(pi.getId());
    TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(pi.getId());

    Execution execution = executionQuery.singleResult();
    Job job = jobQuery.singleResult();

    // add a variable
    runtimeService.setVariableLocal(execution.getId(), "aVariableName", "aVariableValue");

    // execute available job
    managementService.executeJob(job.getId());

    // update execution reference
    execution = executionQuery.singleResult();

    // update variable
    runtimeService.setVariableLocal(execution.getId(), "aVariableName", "newVariableValue");

    // add another new variable
    runtimeService.setVariableLocal(execution.getId(), "anotherVariableName", "anotherVariableValue");

    // update job reference
    job = jobQuery.singleResult();
    // execute available job
    managementService.executeJob(job.getId());

    // get current task
    Task task = taskQuery.singleResult();

    // add a new task variable
View Full Code Here

    Execution execution = executionQuery.singleResult();

    // update existing variable
    runtimeService.setVariableLocal(execution.getId(), "anotherVariableName", "aNewFinalValue");

    Job job = jobQuery.singleResult();
    managementService.executeJob(job.getId());

    // the process instance is completed
    Assert.assertEquals(0, processInstanceQuery.count());

  }
View Full Code Here

  }

  @Override
  public JobDto getJob() {
    ManagementService managementService = engine.getManagementService();
    Job job = managementService.createJobQuery().jobId(jobId).singleResult();

    if (job == null) {
      throw new InvalidRequestException(Status.NOT_FOUND, "Job with id " + jobId + " does not exist");
    }
View Full Code Here

    // Complete 1 tasks
    taskService.complete(taskService.createTaskQuery().singleResult().getId());

    // Fire timer
    Job timer = managementService.createJobQuery().singleResult();
    managementService.executeJob(timer.getId());

    Task taskAfterTimer = taskService.createTaskQuery().singleResult();
    assertEquals("taskAfterTimer", taskAfterTimer.getTaskDefinitionKey());
    taskService.complete(taskAfterTimer.getId());
    assertProcessEnded(procId);
View Full Code Here

    List<Task> tasks = taskService.createTaskQuery().list();
    taskService.complete(tasks.get(0).getId());

    // Fire timer
    Job timer = managementService.createJobQuery().singleResult();
    managementService.executeJob(timer.getId());

    Task taskAfterTimer = taskService.createTaskQuery().singleResult();
    assertEquals("taskAfterTimer", taskAfterTimer.getTaskDefinitionKey());
    taskService.complete(taskAfterTimer.getId());
    assertProcessEnded(procId);
View Full Code Here

    taskService.complete(tasks.get(1).getId());
    tasks = taskService.createTaskQuery().list();
    assertEquals(2, tasks.size());

    // Fire timer
    Job timer = managementService.createJobQuery().singleResult();
    managementService.executeJob(timer.getId());

    Task taskAfterTimer = taskService.createTaskQuery().singleResult();
    assertEquals("taskAfterTimer", taskAfterTimer.getTaskDefinitionKey());
    taskService.complete(taskAfterTimer.getId());
View Full Code Here

    // Complete one task, to make it a bit more trickier
    List<Task> tasks = taskService.createTaskQuery().taskAssignee("kermit").list();
    taskService.complete(tasks.get(0).getId());

    // Fire timer
    Job timer = managementService.createJobQuery().singleResult();
    managementService.executeJob(timer.getId());

    Task taskAfterTimer = taskService.createTaskQuery().singleResult();
    assertEquals("taskAfterTimer", taskAfterTimer.getTaskDefinitionKey());
    taskService.complete(taskAfterTimer.getId());
View Full Code Here

    // Complete two tasks
    taskService.complete(tasks.get(0).getId());
    taskService.complete(tasks.get(1).getId());

    // Fire timer
    Job timer = managementService.createJobQuery().singleResult();
    managementService.executeJob(timer.getId());

    Task taskAfterTimer = taskService.createTaskQuery().singleResult();
    assertEquals("taskAfterTimer", taskAfterTimer.getTaskDefinitionKey());
    taskService.complete(taskAfterTimer.getId());
View Full Code Here

    for (int i=0; i<3; i++) {
      taskService.complete(tasks.get(i).getId());
    }

    // Fire timer
    Job timer = managementService.createJobQuery().singleResult();
    managementService.executeJob(timer.getId());

    Task taskAfterTimer = taskService.createTaskQuery().singleResult();
    assertEquals("taskAfterTimer", taskAfterTimer.getTaskDefinitionKey());
    taskService.complete(taskAfterTimer.getId());
View Full Code Here

TOP

Related Classes of org.camunda.bpm.engine.runtime.Job

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.