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