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());
}
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());
}
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());
}
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());
}
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);
}
Aggregations