Search in sources :

Example 1 with WorkflowFilterDto

use of eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowFilterDto in project CzechIdMng by bcvsolutions.

the class DefaultWorkflowHistoricTaskInstanceService method get.

@Override
public WorkflowHistoricTaskInstanceDto get(String historicTaskInstanceId) {
    WorkflowFilterDto filter = new WorkflowFilterDto();
    filter.setId(UUID.fromString(historicTaskInstanceId));
    filter.setSortAsc(true);
    Collection<WorkflowHistoricTaskInstanceDto> resources = this.search(filter).getResources();
    return !resources.isEmpty() ? resources.iterator().next() : null;
}
Also used : WorkflowFilterDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowFilterDto) WorkflowHistoricTaskInstanceDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowHistoricTaskInstanceDto)

Example 2 with WorkflowFilterDto

use of eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowFilterDto in project CzechIdMng by bcvsolutions.

the class DefaultWorkflowTaskInstanceService method get.

private WorkflowTaskInstanceDto get(String taskId) {
    WorkflowFilterDto filter = new WorkflowFilterDto();
    filter.setId(UUID.fromString(taskId));
    List<WorkflowTaskInstanceDto> tasks = internalSearch(filter, null).getContent();
    return tasks.isEmpty() ? null : tasks.get(0);
}
Also used : WorkflowFilterDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowFilterDto) WorkflowTaskInstanceDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowTaskInstanceDto)

Example 3 with WorkflowFilterDto

use of eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowFilterDto in project CzechIdMng by bcvsolutions.

the class DefaultIdmAutomaticRoleRequestService method cancelWF.

/**
 * Cancel unfinished workflow process for this automatic role.
 *
 * @param dto
 */
private void cancelWF(IdmAutomaticRoleRequestDto dto) {
    if (!Strings.isNullOrEmpty(dto.getWfProcessId())) {
        WorkflowFilterDto filter = new WorkflowFilterDto();
        filter.setProcessInstanceId(dto.getWfProcessId());
        Collection<WorkflowProcessInstanceDto> resources = workflowProcessInstanceService.find(filter, null).getContent();
        if (resources.isEmpty()) {
            // Process with this ID not exist ... maybe was ended
            return;
        }
        workflowProcessInstanceService.delete(dto.getWfProcessId(), "Role request use this WF, was deleted. This WF was deleted too.");
    }
}
Also used : WorkflowFilterDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowFilterDto) WorkflowProcessInstanceDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowProcessInstanceDto)

Example 4 with WorkflowFilterDto

use of eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowFilterDto in project CzechIdMng by bcvsolutions.

the class DefaultIdmRoleRequestService method cancelWF.

private void cancelWF(IdmRoleRequestDto dto) {
    if (!Strings.isNullOrEmpty(dto.getWfProcessId())) {
        WorkflowFilterDto filter = new WorkflowFilterDto();
        filter.setProcessInstanceId(dto.getWfProcessId());
        Collection<WorkflowProcessInstanceDto> resources = workflowProcessInstanceService.searchInternal(filter, false).getResources();
        if (resources.isEmpty()) {
            // Process with this ID not exist ... maybe was ended
            this.addToLog(dto, MessageFormat.format("Workflow process with ID [{0}] was not deleted, because was not found. Maybe was ended before.", dto.getWfProcessId()));
            return;
        }
        workflowProcessInstanceService.delete(dto.getWfProcessId(), "Role request use this WF, was deleted. This WF was deleted too.");
        this.addToLog(dto, MessageFormat.format("Workflow process with ID [{0}] was deleted, because this request is deleted/canceled", dto.getWfProcessId()));
    }
}
Also used : WorkflowFilterDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowFilterDto) WorkflowProcessInstanceDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowProcessInstanceDto)

Example 5 with WorkflowFilterDto

use of eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowFilterDto in project CzechIdMng by bcvsolutions.

the class HistoryProcessAndTaskTest method deployAndRunProcess.

@Test
public void deployAndRunProcess() {
    // Deploy process
    // Start instance of process
    ProcessInstance instance = processInstanceService.startProcess(PROCESS_KEY, null, InitTestData.TEST_USER_1, null, null);
    logout();
    // Log as user without ADMIN rights
    loginAsNoAdmin(InitTestData.TEST_USER_1);
    WorkflowFilterDto filter = new WorkflowFilterDto();
    filter.setProcessInstanceId(instance.getId());
    ResourcesWrapper<WorkflowProcessInstanceDto> processes = processInstanceService.search(filter);
    assertEquals(PROCESS_KEY, ((List<WorkflowProcessInstanceDto>) processes.getResources()).get(0).getName());
    WorkflowHistoricProcessInstanceDto historicProcessDto = historicProcessService.get(instance.getId());
    assertNotNull(historicProcessDto);
    this.logout();
    // Log as user without ADMIN rights
    loginAsNoAdmin(InitTestData.TEST_USER_2);
    // Applicant for this process is testUser1. For testUser2 must be result
    // null
    historicProcessDto = historicProcessService.get(instance.getId());
    assertNull(historicProcessDto);
    this.logout();
    // Log as ADMIN
    loginAsAdmin(InitTestData.TEST_USER_2);
    // Applicant for this process is testUser1. For testUser2 must be result
    // null, but as ADMIN can see all historic processes
    historicProcessDto = historicProcessService.get(instance.getId());
    assertNotNull(historicProcessDto);
    this.logout();
    this.loginAsAdmin(InitTestData.TEST_USER_1);
    completeTasksAndCheckHistory();
}
Also used : WorkflowFilterDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowFilterDto) ProcessInstance(org.activiti.engine.runtime.ProcessInstance) List(java.util.List) WorkflowProcessInstanceDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowProcessInstanceDto) WorkflowHistoricProcessInstanceDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowHistoricProcessInstanceDto) Test(org.junit.Test) AbstractCoreWorkflowIntegrationTest(eu.bcvsolutions.idm.core.AbstractCoreWorkflowIntegrationTest)

Aggregations

WorkflowFilterDto (eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowFilterDto)51 WorkflowTaskInstanceDto (eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowTaskInstanceDto)39 AbstractCoreWorkflowIntegrationTest (eu.bcvsolutions.idm.core.AbstractCoreWorkflowIntegrationTest)36 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)36 Test (org.junit.Test)36 IdmConceptRoleRequestDto (eu.bcvsolutions.idm.core.api.dto.IdmConceptRoleRequestDto)35 IdmIdentityContractDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto)35 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)35 IdmRoleRequestDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestDto)35 List (java.util.List)27 ArrayList (java.util.ArrayList)25 IdmNotificationLogDto (eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto)24 IdmNotificationFilter (eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter)24 Transactional (org.springframework.transaction.annotation.Transactional)11 WorkflowProcessInstanceDto (eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowProcessInstanceDto)7 IdmRoleGuaranteeDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleGuaranteeDto)6 WorkflowHistoricProcessInstanceDto (eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowHistoricProcessInstanceDto)3 IdmIdentityRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto)2 IdmIdentityRoleFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityRoleFilter)2 ResultCodeException (eu.bcvsolutions.idm.core.api.exception.ResultCodeException)2