Package org.camunda.bpm.engine.task

Examples of org.camunda.bpm.engine.task.TaskQuery


    assertEquals("Task 1", task.getName());
    assertEquals("task1", task.getId());
  }

  public void testExecuteTaskQueryCount() {
    TaskQuery query = taskService.createTaskQuery();

    saveQuery(query);

    long count = filterService.count(filter.getId());
    assertEquals(3, count);

    query.taskDelegationState(DelegationState.RESOLVED);

    saveQuery(query);

    count = filterService.count(filter.getId());
    assertEquals(2, count);
View Full Code Here


    count = filterService.count(filter.getId());
    assertEquals(2, count);
  }

  public void testExtendingTaskQueryCount() {
    TaskQuery query = taskService.createTaskQuery();

    saveQuery(query);

    TaskQuery extendingQuery = taskService.createTaskQuery();

    extendingQuery.taskId("task3");

    long count = filterService.count(filter.getId());

    assertEquals(3, count);
View Full Code Here

    assertEquals(1, count);
  }

  public void testSpecialExtendingQuery() {
    TaskQuery query = taskService.createTaskQuery();

    saveQuery(query);

    long count = filterService.count(filter.getId(), (Query) null);
    assertEquals(3, count);
View Full Code Here

    query = filter.getQuery();
    String orderBy = query.getOrderBy();
    assertEquals(AbstractQuery.DEFAULT_ORDER_BY, orderBy);

    // extend query by new task query with sorting
    TaskQuery sortQuery = taskService.createTaskQuery().orderByTaskName().asc();
    Filter extendedFilter = filter.extend(sortQuery);
    query = extendedFilter.getQuery();
    orderBy = query.getOrderBy();

    assertEquals(sortByNameAsc, orderBy);

    // extend query by new task query with additional sorting
    TaskQuery extendingQuery = taskService.createTaskQuery().orderByTaskAssignee().desc();
    extendedFilter = extendedFilter.extend(extendingQuery);
    query = extendedFilter.getQuery();
    orderBy = query.getOrderBy();

    assertEquals(sortByNameAsc + ", " + sortByAssigneeDesc, orderBy);
View Full Code Here

  @Deployment(resources={"org/camunda/bpm/engine/test/api/task/oneTaskWithFormKeyProcess.bpmn20.xml"})
    public void testInitializeFormKeysEnabled() {
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testProcess");

    TaskQuery query = taskService.createTaskQuery()
      .processInstanceId(processInstance.getId());

    saveQuery(query);

    Task task = (Task) filterService.list(filter.getId()).get(0);
View Full Code Here

    runtimeService.deleteProcessInstance(processInstance.getId(), "test");
  }

  public void testExtendingVariableQuery() {
    TaskQuery taskQuery = taskService.createTaskQuery().processVariableValueEquals("hello", "world");
    saveQuery(taskQuery);

    // variables won't overridden variables with same name in different scopes
    TaskQuery extendingQuery = taskService.createTaskQuery()
      .taskVariableValueEquals("hello", "world")
      .caseInstanceVariableValueEquals("hello", "world");

    Filter extendedFilter = filter.extend(extendingQuery);
    TaskQueryImpl extendedQuery = extendedFilter.getQuery();
View Full Code Here

    compareFilter(filter, filter2);
  }

  public void testExtendFilter() {
    TaskQuery extendingQuery = taskService.createTaskQuery()
      .taskName("newName")
      .taskOwner("newOwner");
    Filter newFilter = filter.extend(extendingQuery);
    assertNull(newFilter.getId());
View Full Code Here

    ProcessInstance pi = runtimeService
        .startProcessInstanceByKey("TestFixture70.testVariableMigration", params);

    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
    taskService.setVariableLocal(task.getId(), "aLocalTaskVariableName", "aLocalTaskVariableValue");

    // add "aVariableName" variable as local task variable
View Full Code Here

    // get process instance
    ProcessInstance pi = processInstanceQuery.processDefinitionKey(key).singleResult();

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

    Task task = taskQuery.singleResult();

    // there should be five variable instance (3 process instance variables) and...
    Assert.assertEquals(5, variableInstanceQuery.count());

    // ...2 task variable
View Full Code Here

  public void testCallActivityByExpression() throws Exception {
    // Start process (main)
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testCallActivityByExpression");

    // one task in the subprocess should be active after starting the process instance
    TaskQuery taskQuery = taskService.createTaskQuery();
    Task taskBeforeSubProcess = taskQuery.singleResult();
    assertEquals("Task before subprocess", taskBeforeSubProcess.getName());

    // Completing the task continues the process which leads to calling the subprocess. The sub process we want to
    // call is passed in as a variable into this task
    taskService.complete(taskBeforeSubProcess.getId());
    Task taskInSubProcess = taskQuery.singleResult();
    assertEquals("Task in subprocess", taskInSubProcess.getName());

    // Completing the task in the subprocess, finishes the subprocess
    taskService.complete(taskInSubProcess.getId());
    Task taskAfterSubProcess = taskQuery.singleResult();
    assertEquals("Task after subprocess", taskAfterSubProcess.getName());

    // Completing this task end the process instance
    taskService.complete(taskAfterSubProcess.getId());
    assertProcessEnded(processInstance.getId());
View Full Code Here

TOP

Related Classes of org.camunda.bpm.engine.task.TaskQuery

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.