Search in sources :

Example 21 with HistoricIdentityLinkLogQuery

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

the class HistoricIdentityLinkLogRestServiceImpl method getHistoricIdentityLinksCount.

@Override
public CountResultDto getHistoricIdentityLinksCount(UriInfo uriInfo) {
    HistoricIdentityLinkLogQueryDto queryDto = new HistoricIdentityLinkLogQueryDto(objectMapper, uriInfo.getQueryParameters());
    HistoricIdentityLinkLogQuery query = queryDto.toQuery(processEngine);
    long count = query.count();
    CountResultDto result = new CountResultDto();
    result.setCount(count);
    return result;
}
Also used : HistoricIdentityLinkLogQueryDto(org.camunda.bpm.engine.rest.dto.history.HistoricIdentityLinkLogQueryDto) CountResultDto(org.camunda.bpm.engine.rest.dto.CountResultDto) HistoricIdentityLinkLogQuery(org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery)

Example 22 with HistoricIdentityLinkLogQuery

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

the class HistoricIdentityLinkLogAuthorizationTest method testQueryForTaskHistoricIdentityLinkWithoutUserPermission.

public void testQueryForTaskHistoricIdentityLinkWithoutUserPermission() {
    // given
    disableAuthorization();
    startProcessInstanceByKey(ONE_PROCESS_KEY);
    String taskId = taskService.createTaskQuery().singleResult().getId();
    // if
    identityService.setAuthenticatedUserId("aAssignerId");
    taskService.addCandidateUser(taskId, "aUserId");
    enableAuthorization();
    // when
    HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
    // then
    verifyQueryResults(query, 0);
}
Also used : HistoricIdentityLinkLogQuery(org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery)

Example 23 with HistoricIdentityLinkLogQuery

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

the class HistoricIdentityLinkLogAuthorizationTest method testMixedQuery.

public void testMixedQuery() {
    disableAuthorization();
    // given
    startProcessInstanceByKey(ONE_PROCESS_KEY);
    startProcessInstanceByKey(ONE_PROCESS_KEY);
    startProcessInstanceByKey(ONE_PROCESS_KEY);
    createCaseInstanceByKey(CASE_KEY);
    taskService.addCandidateUser(taskService.createTaskQuery().list().get(3).getId(), "dUserId");
    createCaseInstanceByKey(CASE_KEY);
    taskService.addCandidateUser(taskService.createTaskQuery().list().get(4).getId(), "eUserId");
    createTaskAndAssignUser("one");
    createTaskAndAssignUser("two");
    createTaskAndAssignUser("three");
    createTaskAndAssignUser("four");
    createTaskAndAssignUser("five");
    enableAuthorization();
    // when
    HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
    // then
    verifyQueryResults(query, 7);
    disableAuthorization();
    query = historyService.createHistoricIdentityLinkLogQuery();
    // then
    verifyQueryResults(query, 10);
    // if
    createGrantAuthorization(PROCESS_DEFINITION, ONE_PROCESS_KEY, userId, READ_HISTORY);
    enableAuthorization();
    query = historyService.createHistoricIdentityLinkLogQuery();
    // then
    verifyQueryResults(query, 10);
    deleteTask("one", true);
    deleteTask("two", true);
    deleteTask("three", true);
    deleteTask("four", true);
    deleteTask("five", true);
}
Also used : HistoricIdentityLinkLogQuery(org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery)

Example 24 with HistoricIdentityLinkLogQuery

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

the class HistoricIdentityLinkLogAuthorizationTest method testQueryWithMultiple.

public void testQueryWithMultiple() {
    // given
    disableAuthorization();
    startProcessInstanceByKey(ONE_PROCESS_KEY);
    // if
    createGrantAuthorization(PROCESS_DEFINITION, ONE_PROCESS_KEY, userId, READ_HISTORY);
    createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, READ_HISTORY);
    enableAuthorization();
    // when
    HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
    // then
    verifyQueryResults(query, 1);
}
Also used : HistoricIdentityLinkLogQuery(org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery)

Example 25 with HistoricIdentityLinkLogQuery

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

the class MultiTenancyHistoricIdentityLinkLogQueryTest method historicIdentityLinkForMultipleTenant.

@Test
public void historicIdentityLinkForMultipleTenant() {
    startProcessInstanceForTenant(TENANT_1);
    // Query test
    HistoricIdentityLinkLog historicIdentityLink = historyService.createHistoricIdentityLinkLogQuery().singleResult();
    assertEquals(historicIdentityLink.getTenantId(), TENANT_1);
    // start process instance for another tenant
    startProcessInstanceForTenant(TENANT_2);
    // Query test
    List<HistoricIdentityLinkLog> historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
    assertEquals(historicIdentityLinks.size(), 2);
    HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
    assertEquals(query.tenantIdIn(TENANT_1).count(), 1);
    query = historyService.createHistoricIdentityLinkLogQuery();
    assertEquals(query.tenantIdIn(TENANT_2).count(), 1);
}
Also used : HistoricIdentityLinkLog(org.camunda.bpm.engine.history.HistoricIdentityLinkLog) HistoricIdentityLinkLogQuery(org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery) Test(org.junit.Test)

Aggregations

HistoricIdentityLinkLogQuery (org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery)33 HistoricIdentityLinkLog (org.camunda.bpm.engine.history.HistoricIdentityLinkLog)23 Deployment (org.camunda.bpm.engine.test.Deployment)19 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)4 Test (org.junit.Test)4 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)3 IdentityLink (org.camunda.bpm.engine.task.IdentityLink)3 Task (org.camunda.bpm.engine.task.Task)3 HistoricIdentityLinkLogQueryDto (org.camunda.bpm.engine.rest.dto.history.HistoricIdentityLinkLogQueryDto)2 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)1 HistoricIdentityLinkLogDto (org.camunda.bpm.engine.rest.dto.history.HistoricIdentityLinkLogDto)1