Package org.camunda.bpm.engine.history

Examples of org.camunda.bpm.engine.history.HistoricTaskInstanceQuery


  }

  private void createHistoricTaskInstanceMock() {
    List<HistoricTaskInstance> tasks = MockProvider.createMockHistoricTaskInstances();

    HistoricTaskInstanceQuery query = mock(HistoricTaskInstanceQuery.class);
    when(mockHistoryService.createHistoricTaskInstanceQuery()).thenReturn(query);
    when(query.list()).thenReturn(tasks);
  }
View Full Code Here


  }

  @Override
  public List<HistoricTaskInstanceDto> queryHistoricTaskInstances(HistoricTaskInstanceQueryDto queryDto, Integer firstResult, Integer maxResults) {
    queryDto.setObjectMapper(objectMapper);
    HistoricTaskInstanceQuery query = queryDto.toQuery(processEngine);

    List<HistoricTaskInstance> match;
    if (firstResult != null || maxResults != null) {
      match = executePaginatedQuery(query, firstResult, maxResults);
    } else {
      match = query.list();
    }

    List<HistoricTaskInstanceDto> result = new ArrayList<HistoricTaskInstanceDto>();
    for (HistoricTaskInstance taskInstance : match) {
      HistoricTaskInstanceDto taskInstanceDto = HistoricTaskInstanceDto.fromHistoricTaskInstance(taskInstance);
View Full Code Here

  }

  @Override
  public CountResultDto queryHistoricTaskInstancesCount(HistoricTaskInstanceQueryDto queryDto) {
    queryDto.setObjectMapper(objectMapper);
    HistoricTaskInstanceQuery query = queryDto.toQuery(processEngine);

    long count = query.count();
    CountResultDto result = new CountResultDto();
    result.setCount(count);

    return result;
  }
View Full Code Here

    assertEquals(caseInstanceId, task.getCaseInstanceId());
    assertEquals(humanTaskId, task.getCaseExecutionId());
  }

  public void testQueryByInvalidCaseDefinitionKey() {
    HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery();

    query.caseDefinitionKey("invalid");

    assertEquals(0, query.count());
    assertEquals(0, query.list().size());
    assertNull(query.singleResult());

    query.caseDefinitionKey(null);

    assertEquals(0, query.count());
    assertEquals(0, query.list().size());
    assertNull(query.singleResult());

  }
View Full Code Here

    caseService
      .withCaseExecution(humanTaskId)
      .manualStart();

    // then
    HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery();

    query.caseDefinitionName(caseDefinitionName);

    assertEquals(1, query.count());
    assertEquals(1, query.list().size());
    assertNotNull(query.singleResult());

    HistoricTaskInstance task = query.singleResult();
    assertNotNull(task);

    assertEquals(caseDefinitionId, task.getCaseDefinitionId());
    assertEquals(caseInstanceId, task.getCaseInstanceId());
    assertEquals(humanTaskId, task.getCaseExecutionId());
View Full Code Here

    assertEquals(caseInstanceId, task.getCaseInstanceId());
    assertEquals(humanTaskId, task.getCaseExecutionId());
  }

  public void testQueryByInvalidCaseDefinitionName() {
    HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery();

    query.caseDefinitionName("invalid");

    assertEquals(0, query.count());
    assertEquals(0, query.list().size());
    assertNull(query.singleResult());

    query.caseDefinitionName(null);

    assertEquals(0, query.count());
    assertEquals(0, query.list().size());
    assertNull(query.singleResult());

  }
View Full Code Here

    caseService
      .withCaseExecution(humanTaskId)
      .manualStart();

    // then
    HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery();

    query.caseInstanceId(caseInstanceId);

    assertEquals(1, query.count());
    assertEquals(1, query.list().size());
    assertNotNull(query.singleResult());

    HistoricTaskInstance task = query.singleResult();
    assertNotNull(task);

    assertEquals(caseDefinitionId, task.getCaseDefinitionId());
    assertEquals(caseInstanceId, task.getCaseInstanceId());
    assertEquals(humanTaskId, task.getCaseExecutionId());
View Full Code Here

    caseService
      .withCaseExecution(processTaskId)
      .manualStart();

    // then
    HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery();

    query.caseInstanceId(caseInstanceId);

    assertEquals(2, query.count());
    assertEquals(2, query.list().size());

    for (HistoricTaskInstance task : query.list()) {
      assertEquals(caseInstanceId, task.getCaseInstanceId());

      assertNull(task.getCaseDefinitionId());
      assertNull(task.getCaseExecutionId());

      taskService.complete(task.getId());
    }

    assertEquals(3, query.count());
    assertEquals(3, query.list().size());

    for (HistoricTaskInstance task : query.list()) {
      assertEquals(caseInstanceId, task.getCaseInstanceId());

      assertNull(task.getCaseDefinitionId());
      assertNull(task.getCaseExecutionId());
    }
View Full Code Here

    }

  }

  public void testQueryByInvalidCaseInstanceId() {
    HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery();

    query.caseInstanceId("invalid");

    assertEquals(0, query.count());
    assertEquals(0, query.list().size());
    assertNull(query.singleResult());

    query.caseInstanceId(null);

    assertEquals(0, query.count());
    assertEquals(0, query.list().size());
    assertNull(query.singleResult());

  }
View Full Code Here

    caseService
      .withCaseExecution(humanTaskId)
      .manualStart();

    // then
    HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery();

    query.caseExecutionId(humanTaskId);

    assertEquals(1, query.count());
    assertEquals(1, query.list().size());
    assertNotNull(query.singleResult());

    HistoricTaskInstance task = query.singleResult();
    assertNotNull(task);

    assertEquals(caseDefinitionId, task.getCaseDefinitionId());
    assertEquals(caseInstanceId, task.getCaseInstanceId());
    assertEquals(humanTaskId, task.getCaseExecutionId());
View Full Code Here

TOP

Related Classes of org.camunda.bpm.engine.history.HistoricTaskInstanceQuery

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.