Search in sources :

Example 16 with HistoricIdentityLinkLog

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

the class HistoricIdentityLinkLogTest method testShouldAddDelegateTaskCandidateforAddIdentityLink.

@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneTaskProcess.bpmn20.xml" })
public void testShouldAddDelegateTaskCandidateforAddIdentityLink() {
    // Pre test
    List<HistoricIdentityLinkLog> historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
    assertEquals(historicIdentityLinks.size(), 0);
    // given
    startProcessInstance(PROCESS_DEFINITION_KEY);
    String taskId = taskService.createTaskQuery().singleResult().getId();
    identityService.setAuthenticatedUserId(A_ASSIGNER_ID);
    taskService.addUserIdentityLink(taskId, A_USER_ID, IdentityLinkType.ASSIGNEE);
    taskService.delegateTask(taskId, B_USER_ID);
    taskService.deleteUserIdentityLink(taskId, B_USER_ID, IdentityLinkType.ASSIGNEE);
    historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
    // Addition of A_USER, Deletion of A_USER, Addition of A_USER as owner, Addition of B_USER and deletion of B_USER
    assertEquals(historicIdentityLinks.size(), 5);
    // Query test
    HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
    assertEquals(query.userId(A_USER_ID).count(), 3);
    query = historyService.createHistoricIdentityLinkLogQuery();
    assertEquals(query.userId(B_USER_ID).count(), 2);
    query = historyService.createHistoricIdentityLinkLogQuery();
    assertEquals(query.operationType(IDENTITY_LINK_ADD).count(), 3);
    query = historyService.createHistoricIdentityLinkLogQuery();
    assertEquals(query.operationType(IDENTITY_LINK_DELETE).count(), 2);
    query = historyService.createHistoricIdentityLinkLogQuery();
    assertEquals(query.type(IdentityLinkType.ASSIGNEE).count(), 4);
    assertEquals(query.type(IdentityLinkType.OWNER).count(), 1);
}
Also used : HistoricIdentityLinkLog(org.camunda.bpm.engine.history.HistoricIdentityLinkLog) HistoricIdentityLinkLogQuery(org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 17 with HistoricIdentityLinkLog

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

the class HistoricIdentityLinkLogTest method testShouldAddGroupCandidateForAddAndDeleteIdentityLink.

@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneTaskProcess.bpmn20.xml" })
public void testShouldAddGroupCandidateForAddAndDeleteIdentityLink() {
    List<HistoricIdentityLinkLog> historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
    assertEquals(historicIdentityLinks.size(), 0);
    // given
    startProcessInstance(PROCESS_DEFINITION_KEY);
    String taskId = taskService.createTaskQuery().singleResult().getId();
    // if
    identityService.setAuthenticatedUserId(A_ASSIGNER_ID);
    taskService.addCandidateGroup(taskId, A_GROUP_ID);
    taskService.deleteCandidateGroup(taskId, A_GROUP_ID);
    // then
    historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
    assertEquals(historicIdentityLinks.size(), 2);
    // Basic Query test
    HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
    assertEquals(query.groupId(A_GROUP_ID).count(), 2);
}
Also used : HistoricIdentityLinkLog(org.camunda.bpm.engine.history.HistoricIdentityLinkLog) HistoricIdentityLinkLogQuery(org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 18 with HistoricIdentityLinkLog

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

the class HistoricIdentityLinkLogTest method testShouldAddMultipleDelegateTaskCandidateforAddIdentityLink.

@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneTaskProcess.bpmn20.xml" })
public void testShouldAddMultipleDelegateTaskCandidateforAddIdentityLink() {
    // Pre test
    List<HistoricIdentityLinkLog> historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
    assertEquals(historicIdentityLinks.size(), 0);
    // given
    startProcessInstance(PROCESS_DEFINITION_KEY);
    String taskId = taskService.createTaskQuery().singleResult().getId();
    identityService.setAuthenticatedUserId(A_ASSIGNER_ID);
    taskService.addUserIdentityLink(taskId, A_USER_ID, IdentityLinkType.ASSIGNEE);
    taskService.delegateTask(taskId, B_USER_ID);
    taskService.delegateTask(taskId, C_USER_ID);
    taskService.deleteUserIdentityLink(taskId, C_USER_ID, IdentityLinkType.ASSIGNEE);
    historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
    // Addition of A_USER, Deletion of A_USER, Addition of A_USER as owner,
    // Addition of B_USER, Deletion of B_USER, Addition of C_USER, Deletion of C_USER
    assertEquals(historicIdentityLinks.size(), 7);
    // Query test
    HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
    assertEquals(query.userId(A_USER_ID).count(), 3);
    query = historyService.createHistoricIdentityLinkLogQuery();
    assertEquals(query.userId(B_USER_ID).count(), 2);
    query = historyService.createHistoricIdentityLinkLogQuery();
    assertEquals(query.userId(C_USER_ID).count(), 2);
    query = historyService.createHistoricIdentityLinkLogQuery();
    assertEquals(query.operationType(IDENTITY_LINK_ADD).count(), 4);
    query = historyService.createHistoricIdentityLinkLogQuery();
    assertEquals(query.operationType(IDENTITY_LINK_DELETE).count(), 3);
    query = historyService.createHistoricIdentityLinkLogQuery();
    assertEquals(query.type(IdentityLinkType.ASSIGNEE).count(), 6);
    query = historyService.createHistoricIdentityLinkLogQuery();
    assertEquals(query.type(IdentityLinkType.OWNER).count(), 1);
}
Also used : HistoricIdentityLinkLog(org.camunda.bpm.engine.history.HistoricIdentityLinkLog) HistoricIdentityLinkLogQuery(org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 19 with HistoricIdentityLinkLog

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

the class HistoricIdentityLinkLogRestServiceImpl method getHistoricIdentityLinks.

@Override
public List<HistoricIdentityLinkLogDto> getHistoricIdentityLinks(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
    HistoricIdentityLinkLogQueryDto queryDto = new HistoricIdentityLinkLogQueryDto(objectMapper, uriInfo.getQueryParameters());
    HistoricIdentityLinkLogQuery query = queryDto.toQuery(processEngine);
    List<HistoricIdentityLinkLog> queryResult;
    if (firstResult != null || maxResults != null) {
        queryResult = executePaginatedQuery(query, firstResult, maxResults);
    } else {
        queryResult = query.list();
    }
    List<HistoricIdentityLinkLogDto> result = new ArrayList<HistoricIdentityLinkLogDto>();
    for (HistoricIdentityLinkLog historicIdentityLink : queryResult) {
        HistoricIdentityLinkLogDto dto = HistoricIdentityLinkLogDto.fromHistoricIdentityLink(historicIdentityLink);
        result.add(dto);
    }
    return result;
}
Also used : HistoricIdentityLinkLogQueryDto(org.camunda.bpm.engine.rest.dto.history.HistoricIdentityLinkLogQueryDto) HistoricIdentityLinkLog(org.camunda.bpm.engine.history.HistoricIdentityLinkLog) ArrayList(java.util.ArrayList) HistoricIdentityLinkLogQuery(org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery) HistoricIdentityLinkLogDto(org.camunda.bpm.engine.rest.dto.history.HistoricIdentityLinkLogDto)

Example 20 with HistoricIdentityLinkLog

use of org.camunda.bpm.engine.history.HistoricIdentityLinkLog 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

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