Search in sources :

Example 26 with UserOperationLogQuery

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

the class UserOperationLogDeletionTest method assertUserOperationLogs.

public void assertUserOperationLogs() {
    List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery().list();
    UserOperationLogQuery userOperationLogQuery = historyService.createUserOperationLogQuery().operationType(UserOperationLogEntry.OPERATION_TYPE_DELETE);
    List<UserOperationLogEntry> userOperationLogs = userOperationLogQuery.list();
    assertEquals(3, userOperationLogs.size());
    for (ProcessDefinition processDefinition : processDefinitions) {
        UserOperationLogEntry userOperationLogEntry = userOperationLogQuery.deploymentId(processDefinition.getDeploymentId()).singleResult();
        assertEquals(EntityTypes.PROCESS_DEFINITION, userOperationLogEntry.getEntityType());
        assertEquals(processDefinition.getId(), userOperationLogEntry.getProcessDefinitionId());
        assertEquals(processDefinition.getKey(), userOperationLogEntry.getProcessDefinitionKey());
        assertEquals(processDefinition.getDeploymentId(), userOperationLogEntry.getDeploymentId());
        assertEquals(UserOperationLogEntry.OPERATION_TYPE_DELETE, userOperationLogEntry.getOperationType());
        assertEquals("cascade", userOperationLogEntry.getProperty());
        assertFalse(Boolean.valueOf(userOperationLogEntry.getOrgValue()));
        assertTrue(Boolean.valueOf(userOperationLogEntry.getNewValue()));
        assertEquals(USER_ID, userOperationLogEntry.getUserId());
        assertNull(userOperationLogEntry.getJobDefinitionId());
        assertNull(userOperationLogEntry.getProcessInstanceId());
        assertNull(userOperationLogEntry.getCaseInstanceId());
        assertNull(userOperationLogEntry.getCaseDefinitionId());
    }
    assertEquals(6, historyService.createUserOperationLogQuery().count());
}
Also used : UserOperationLogEntry(org.camunda.bpm.engine.history.UserOperationLogEntry) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) UserOperationLogQuery(org.camunda.bpm.engine.history.UserOperationLogQuery)

Example 27 with UserOperationLogQuery

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

the class UserOperationLogDeletionTest method testDeleteDeploymentKeepUserOperationLog.

@Deployment(resources = PROCESS_PATH)
public void testDeleteDeploymentKeepUserOperationLog() {
    // given
    String deploymentId = repositoryService.createDeploymentQuery().singleResult().getId();
    String processDefinitionId = repositoryService.createProcessDefinitionQuery().singleResult().getId();
    repositoryService.suspendProcessDefinitionById(processDefinitionId);
    UserOperationLogQuery query = historyService.createUserOperationLogQuery().processDefinitionId(processDefinitionId);
    assertEquals(1, query.count());
    // when
    repositoryService.deleteDeployment(deploymentId, true);
    // then
    assertEquals(1, query.count());
}
Also used : UserOperationLogQuery(org.camunda.bpm.engine.history.UserOperationLogQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 28 with UserOperationLogQuery

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

the class UserOperationLogRestServiceImpl method queryUserOperationCount.

@Override
public CountResultDto queryUserOperationCount(UriInfo uriInfo) {
    UserOperationLogQueryDto queryDto = new UserOperationLogQueryDto(objectMapper, uriInfo.getQueryParameters());
    UserOperationLogQuery query = queryDto.toQuery(processEngine);
    return new CountResultDto(query.count());
}
Also used : UserOperationLogQueryDto(org.camunda.bpm.engine.rest.dto.history.UserOperationLogQueryDto) CountResultDto(org.camunda.bpm.engine.rest.dto.CountResultDto) UserOperationLogQuery(org.camunda.bpm.engine.history.UserOperationLogQuery)

Example 29 with UserOperationLogQuery

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

the class BatchSuspensionTest method testUserOperationLogQueryByBatchId.

@Test
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL)
public void testUserOperationLogQueryByBatchId() {
    // given
    Batch batch1 = helper.migrateProcessInstancesAsync(1);
    Batch batch2 = helper.migrateProcessInstancesAsync(1);
    // when
    identityService.setAuthenticatedUserId(USER_ID);
    managementService.suspendBatchById(batch1.getId());
    managementService.suspendBatchById(batch2.getId());
    managementService.activateBatchById(batch1.getId());
    identityService.clearAuthentication();
    // then
    UserOperationLogQuery query = historyService.createUserOperationLogQuery().batchId(batch1.getId());
    assertEquals(2, query.count());
    assertEquals(2, query.list().size());
    query = historyService.createUserOperationLogQuery().batchId(batch2.getId());
    assertEquals(1, query.count());
    assertEquals(1, query.list().size());
}
Also used : Batch(org.camunda.bpm.engine.batch.Batch) UserOperationLogQuery(org.camunda.bpm.engine.history.UserOperationLogQuery) Test(org.junit.Test) RequiredHistoryLevel(org.camunda.bpm.engine.test.RequiredHistoryLevel)

Example 30 with UserOperationLogQuery

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

the class UserOperationLogAuthorizationTest method testQuerySetAssigneeTaskUserOperationLogWithMultiple.

public void testQuerySetAssigneeTaskUserOperationLogWithMultiple() {
    // given
    startProcessInstanceByKey(ONE_TASK_PROCESS_KEY);
    String taskId = selectSingleTask().getId();
    setAssignee(taskId, "demo");
    createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, READ_HISTORY);
    createGrantAuthorization(PROCESS_DEFINITION, ONE_TASK_PROCESS_KEY, userId, READ_HISTORY);
    // when
    UserOperationLogQuery query = historyService.createUserOperationLogQuery();
    // then
    verifyQueryResults(query, 1);
}
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