Search in sources :

Example 1 with UserOperationLogQuery

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

the class UserOperationLogRestServiceImpl method queryUserOperationEntries.

@Override
public List<UserOperationLogEntryDto> queryUserOperationEntries(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
    UserOperationLogQueryDto queryDto = new UserOperationLogQueryDto(objectMapper, uriInfo.getQueryParameters());
    UserOperationLogQuery query = queryDto.toQuery(processEngine);
    if (firstResult == null && maxResults == null) {
        return UserOperationLogEntryDto.map(query.list());
    } else {
        if (firstResult == null) {
            firstResult = 0;
        }
        if (maxResults == null) {
            maxResults = Integer.MAX_VALUE;
        }
        return UserOperationLogEntryDto.map(query.listPage(firstResult, maxResults));
    }
}
Also used : UserOperationLogQueryDto(org.camunda.bpm.engine.rest.dto.history.UserOperationLogQueryDto) UserOperationLogQuery(org.camunda.bpm.engine.history.UserOperationLogQuery)

Example 2 with UserOperationLogQuery

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

the class UserOperationLogAuthorizationTest method testQuerySuspendProcessDefinitionUserOperationLogWithoutAuthorization.

// process definition ////////////////////////////////////////////
public void testQuerySuspendProcessDefinitionUserOperationLogWithoutAuthorization() {
    // given
    suspendProcessDefinitionByKey(ONE_TASK_PROCESS_KEY);
    // when
    UserOperationLogQuery query = historyService.createUserOperationLogQuery();
    // then
    verifyQueryResults(query, 0);
    clearDatabase();
}
Also used : UserOperationLogQuery(org.camunda.bpm.engine.history.UserOperationLogQuery)

Example 3 with UserOperationLogQuery

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

the class UserOperationLogAuthorizationTest method testQueryAfterDeletingDeployment.

// delete deployment (cascade = false)
public void testQueryAfterDeletingDeployment() {
    // given
    startProcessInstanceByKey(ONE_TASK_PROCESS_KEY);
    String taskId = selectSingleTask().getId();
    setAssignee(taskId, "demo");
    createGrantAuthorization(PROCESS_DEFINITION, ONE_TASK_PROCESS_KEY, userId, READ_HISTORY);
    disableAuthorization();
    taskService.complete(taskId);
    enableAuthorization();
    deleteDeployment(deploymentId, false);
    // when
    UserOperationLogQuery query = historyService.createUserOperationLogQuery();
    // then
    verifyQueryResults(query, 2);
    disableAuthorization();
    List<HistoricProcessInstance> instances = historyService.createHistoricProcessInstanceQuery().list();
    for (HistoricProcessInstance instance : instances) {
        historyService.deleteHistoricProcessInstance(instance.getId());
    }
    enableAuthorization();
}
Also used : HistoricProcessInstance(org.camunda.bpm.engine.history.HistoricProcessInstance) UserOperationLogQuery(org.camunda.bpm.engine.history.UserOperationLogQuery)

Example 4 with UserOperationLogQuery

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

the class UserOperationLogAuthorizationTest method testQuerySetJobRetriesUserOperationLogWithReadHistoryPermissionOnProcessDefinition.

public void testQuerySetJobRetriesUserOperationLogWithReadHistoryPermissionOnProcessDefinition() {
    // given
    startProcessInstanceByKey(TIMER_BOUNDARY_PROCESS_KEY);
    String jobId = selectSingleJob().getId();
    disableAuthorization();
    managementService.setJobRetries(jobId, 5);
    enableAuthorization();
    createGrantAuthorization(PROCESS_DEFINITION, TIMER_BOUNDARY_PROCESS_KEY, userId, READ_HISTORY);
    // when
    UserOperationLogQuery query = historyService.createUserOperationLogQuery();
    // then
    verifyQueryResults(query, 1);
}
Also used : UserOperationLogQuery(org.camunda.bpm.engine.history.UserOperationLogQuery)

Example 5 with UserOperationLogQuery

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

the class UserOperationLogAuthorizationTest method testQuerySuspendProcessDefinitionUserOperationLogWithReadHistoryPermissionOnAnyProcessDefinition.

public void testQuerySuspendProcessDefinitionUserOperationLogWithReadHistoryPermissionOnAnyProcessDefinition() {
    // given
    suspendProcessDefinitionByKey(ONE_TASK_PROCESS_KEY);
    createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, READ_HISTORY);
    // when
    UserOperationLogQuery query = historyService.createUserOperationLogQuery();
    // then
    verifyQueryResults(query, 1);
    clearDatabase();
}
Also used : UserOperationLogQuery(org.camunda.bpm.engine.history.UserOperationLogQuery)

Aggregations

UserOperationLogQuery (org.camunda.bpm.engine.history.UserOperationLogQuery)67 Deployment (org.camunda.bpm.engine.test.Deployment)25 UserOperationLogEntry (org.camunda.bpm.engine.history.UserOperationLogEntry)20 Deployment (org.camunda.bpm.engine.repository.Deployment)10 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)6 Task (org.camunda.bpm.engine.task.Task)4 Date (java.util.Date)2 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)2 Batch (org.camunda.bpm.engine.batch.Batch)2 UserOperationLogQueryDto (org.camunda.bpm.engine.rest.dto.history.UserOperationLogQueryDto)2 RequiredHistoryLevel (org.camunda.bpm.engine.test.RequiredHistoryLevel)2 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)2 Test (org.junit.Test)2 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)1 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)1 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)1