Search in sources :

Example 1 with HistoricProcessInstanceDto

use of org.camunda.bpm.engine.rest.dto.history.HistoricProcessInstanceDto in project camunda-bpm-platform by camunda.

the class HistoricProcessInstanceRestServiceImpl method queryHistoricProcessInstances.

@Override
public List<HistoricProcessInstanceDto> queryHistoricProcessInstances(HistoricProcessInstanceQueryDto queryDto, Integer firstResult, Integer maxResults) {
    queryDto.setObjectMapper(objectMapper);
    HistoricProcessInstanceQuery query = queryDto.toQuery(processEngine);
    List<HistoricProcessInstance> matchingHistoricProcessInstances;
    if (firstResult != null || maxResults != null) {
        matchingHistoricProcessInstances = executePaginatedQuery(query, firstResult, maxResults);
    } else {
        matchingHistoricProcessInstances = query.list();
    }
    List<HistoricProcessInstanceDto> historicProcessInstanceDtoResults = new ArrayList<HistoricProcessInstanceDto>();
    for (HistoricProcessInstance historicProcessInstance : matchingHistoricProcessInstances) {
        HistoricProcessInstanceDto resultHistoricProcessInstanceDto = HistoricProcessInstanceDto.fromHistoricProcessInstance(historicProcessInstance);
        historicProcessInstanceDtoResults.add(resultHistoricProcessInstanceDto);
    }
    return historicProcessInstanceDtoResults;
}
Also used : HistoricProcessInstanceQuery(org.camunda.bpm.engine.history.HistoricProcessInstanceQuery) HistoricProcessInstance(org.camunda.bpm.engine.history.HistoricProcessInstance) ArrayList(java.util.ArrayList) HistoricProcessInstanceDto(org.camunda.bpm.engine.rest.dto.history.HistoricProcessInstanceDto)

Example 2 with HistoricProcessInstanceDto

use of org.camunda.bpm.engine.rest.dto.history.HistoricProcessInstanceDto in project camunda-bpm-platform by camunda.

the class ProcessInstanceRestServiceInteractionTest method testActivateHistoricProcessInstanceQuery.

@Test
public void testActivateHistoricProcessInstanceQuery() {
    HistoricProcessInstanceDto query = new HistoricProcessInstanceDto();
    Map<String, Object> messageBodyJson = new HashMap<String, Object>();
    messageBodyJson.put("historicProcessInstanceQuery", query);
    messageBodyJson.put("suspended", false);
    given().contentType(ContentType.JSON).body(messageBodyJson).then().expect().statusCode(Status.NO_CONTENT.getStatusCode()).when().put(PROCESS_INSTANCE_SUSPENDED_URL);
    verify(mockUpdateSuspensionStateSelectBuilder).byHistoricProcessInstanceQuery(any(HistoricProcessInstanceQuery.class));
    verify(mockUpdateProcessInstancesSuspensionStateBuilder).activate();
}
Also used : HistoricProcessInstanceQuery(org.camunda.bpm.engine.history.HistoricProcessInstanceQuery) HashMap(java.util.HashMap) ExampleVariableObject(org.camunda.bpm.engine.rest.helper.ExampleVariableObject) HistoricProcessInstanceDto(org.camunda.bpm.engine.rest.dto.history.HistoricProcessInstanceDto) Test(org.junit.Test)

Aggregations

HistoricProcessInstanceQuery (org.camunda.bpm.engine.history.HistoricProcessInstanceQuery)2 HistoricProcessInstanceDto (org.camunda.bpm.engine.rest.dto.history.HistoricProcessInstanceDto)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)1 ExampleVariableObject (org.camunda.bpm.engine.rest.helper.ExampleVariableObject)1 Test (org.junit.Test)1