Search in sources :

Example 26 with HistoricDetailQuery

use of org.camunda.bpm.engine.history.HistoricDetailQuery in project camunda-bpm-platform by camunda.

the class HistoricDetailRestServiceImpl method getHistoricDetails.

@Override
public List<HistoricDetailDto> getHistoricDetails(UriInfo uriInfo, Integer firstResult, Integer maxResults, boolean deserializeObjectValues) {
    HistoricDetailQueryDto queryDto = new HistoricDetailQueryDto(objectMapper, uriInfo.getQueryParameters());
    HistoricDetailQuery query = queryDto.toQuery(processEngine);
    query.disableBinaryFetching();
    if (!deserializeObjectValues) {
        query.disableCustomObjectDeserialization();
    }
    List<HistoricDetail> queryResult;
    if (firstResult != null || maxResults != null) {
        queryResult = executePaginatedQuery(query, firstResult, maxResults);
    } else {
        queryResult = query.list();
    }
    List<HistoricDetailDto> result = new ArrayList<HistoricDetailDto>();
    for (HistoricDetail historicDetail : queryResult) {
        HistoricDetailDto dto = HistoricDetailDto.fromHistoricDetail(historicDetail);
        result.add(dto);
    }
    return result;
}
Also used : HistoricDetail(org.camunda.bpm.engine.history.HistoricDetail) HistoricDetailQueryDto(org.camunda.bpm.engine.rest.dto.history.HistoricDetailQueryDto) ArrayList(java.util.ArrayList) HistoricDetailQuery(org.camunda.bpm.engine.history.HistoricDetailQuery) HistoricDetailDto(org.camunda.bpm.engine.rest.dto.history.HistoricDetailDto)

Example 27 with HistoricDetailQuery

use of org.camunda.bpm.engine.history.HistoricDetailQuery in project camunda-bpm-platform by camunda.

the class FullHistoryTest method testHistoricDetailQueryByInvalidVariableInstanceId.

@Test
public void testHistoricDetailQueryByInvalidVariableInstanceId() {
    HistoricDetailQuery query = historyService.createHistoricDetailQuery();
    query.variableInstanceId("invalid");
    assertEquals(0, query.count());
    try {
        query.variableInstanceId(null);
        fail("A ProcessEngineExcpetion was expected.");
    } catch (ProcessEngineException e) {
    }
    try {
        query.variableInstanceId((String) null);
        fail("A ProcessEngineExcpetion was expected.");
    } catch (ProcessEngineException e) {
    }
}
Also used : HistoricDetailQuery(org.camunda.bpm.engine.history.HistoricDetailQuery) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException) Test(org.junit.Test)

Example 28 with HistoricDetailQuery

use of org.camunda.bpm.engine.history.HistoricDetailQuery in project camunda-bpm-platform by camunda.

the class HistoricDetailAuthorizationTest method testSimpleFormFieldQueryWithoutAuthorization.

// historic form field query //////////////////////////////////////////////////////
public void testSimpleFormFieldQueryWithoutAuthorization() {
    // given
    startProcessInstanceByKey(PROCESS_KEY);
    String taskId = selectSingleTask().getId();
    disableAuthorization();
    formService.submitTaskForm(taskId, getVariables());
    enableAuthorization();
    // when
    HistoricDetailQuery query = historyService.createHistoricDetailQuery().formFields();
    // then
    verifyQueryResults(query, 0);
}
Also used : HistoricDetailQuery(org.camunda.bpm.engine.history.HistoricDetailQuery)

Example 29 with HistoricDetailQuery

use of org.camunda.bpm.engine.history.HistoricDetailQuery in project camunda-bpm-platform by camunda.

the class HistoricDetailAuthorizationTest method testMixedQueryWithReadHistoryPermissionOnAnyProcessDefinition.

public void testMixedQueryWithReadHistoryPermissionOnAnyProcessDefinition() {
    // given
    startProcessInstanceByKey(PROCESS_KEY, getVariables());
    startProcessInstanceByKey(PROCESS_KEY, getVariables());
    startProcessInstanceByKey(PROCESS_KEY, getVariables());
    startProcessInstanceByKey(MESSAGE_START_PROCESS_KEY, getVariables());
    startProcessInstanceByKey(MESSAGE_START_PROCESS_KEY, getVariables());
    startProcessInstanceByKey(MESSAGE_START_PROCESS_KEY, getVariables());
    startProcessInstanceByKey(MESSAGE_START_PROCESS_KEY, getVariables());
    createTask("one");
    createTask("two");
    createTask("three");
    createTask("four");
    createTask("five");
    disableAuthorization();
    taskService.setVariables("one", getVariables());
    taskService.setVariables("two", getVariables());
    taskService.setVariables("three", getVariables());
    taskService.setVariables("four", getVariables());
    taskService.setVariables("five", getVariables());
    enableAuthorization();
    createCaseInstanceByKey(CASE_KEY, getVariables());
    createCaseInstanceByKey(CASE_KEY, getVariables());
    createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, READ_HISTORY);
    // when
    HistoricDetailQuery query = historyService.createHistoricDetailQuery().variableUpdates();
    // then
    verifyQueryResults(query, 14);
    deleteTask("one", true);
    deleteTask("two", true);
    deleteTask("three", true);
    deleteTask("four", true);
    deleteTask("five", true);
}
Also used : HistoricDetailQuery(org.camunda.bpm.engine.history.HistoricDetailQuery)

Example 30 with HistoricDetailQuery

use of org.camunda.bpm.engine.history.HistoricDetailQuery in project camunda-bpm-platform by camunda.

the class HistoricDetailAuthorizationTest method testSimpleFormFieldQueryWithReadHistoryPermissionOnProcessDefinition.

public void testSimpleFormFieldQueryWithReadHistoryPermissionOnProcessDefinition() {
    // given
    startProcessInstanceByKey(PROCESS_KEY);
    String taskId = selectSingleTask().getId();
    createGrantAuthorization(PROCESS_DEFINITION, PROCESS_KEY, userId, READ_HISTORY);
    disableAuthorization();
    formService.submitTaskForm(taskId, getVariables());
    enableAuthorization();
    // when
    HistoricDetailQuery query = historyService.createHistoricDetailQuery().formFields();
    // then
    verifyQueryResults(query, 1);
}
Also used : HistoricDetailQuery(org.camunda.bpm.engine.history.HistoricDetailQuery)

Aggregations

HistoricDetailQuery (org.camunda.bpm.engine.history.HistoricDetailQuery)49 Test (org.junit.Test)7 Deployment (org.camunda.bpm.engine.test.Deployment)5 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)2 HistoricDetail (org.camunda.bpm.engine.history.HistoricDetail)2 HistoricDetailQueryDto (org.camunda.bpm.engine.rest.dto.history.HistoricDetailQueryDto)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)1 HistoricVariableInstance (org.camunda.bpm.engine.history.HistoricVariableInstance)1 HistoricVariableUpdate (org.camunda.bpm.engine.history.HistoricVariableUpdate)1 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)1 HistoricDetailDto (org.camunda.bpm.engine.rest.dto.history.HistoricDetailDto)1 Task (org.camunda.bpm.engine.task.Task)1 FileValue (org.camunda.bpm.engine.variable.value.FileValue)1 Ignore (org.junit.Ignore)1 Matchers.anyString (org.mockito.Matchers.anyString)1