use of eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowProcessInstanceDto in project CzechIdMng by bcvsolutions.
the class DefaultWorkflowProcessInstanceService method delete.
@Override
public WorkflowProcessInstanceDto delete(String processInstanceId, String deleteReason) {
if (processInstanceId == null) {
return null;
}
if (deleteReason == null) {
deleteReason = "Deleted by " + securityService.getUsername();
}
WorkflowFilterDto filter = new WorkflowFilterDto();
filter.setProcessInstanceId(processInstanceId);
Collection<WorkflowProcessInstanceDto> resources = this.searchInternal(filter, false).getResources();
WorkflowProcessInstanceDto processInstanceToDelete = null;
if (!resources.isEmpty()) {
processInstanceToDelete = resources.iterator().next();
}
if (processInstanceToDelete == null) {
throw new ResultCodeException(CoreResultCode.FORBIDDEN, "You do not have permission for delete process instance with ID: %s !", ImmutableMap.of("processInstanceId", processInstanceId));
}
runtimeService.deleteProcessInstance(processInstanceToDelete.getProcessInstanceId(), deleteReason);
return processInstanceToDelete;
}
use of eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowProcessInstanceDto in project CzechIdMng by bcvsolutions.
the class DefaultIdmAutomaticRoleRequestService method toDto.
@Override
public IdmAutomaticRoleRequestDto toDto(IdmAutomaticRoleRequest entity, IdmAutomaticRoleRequestDto dto) {
IdmAutomaticRoleRequestDto requestDto = super.toDto(entity, dto);
if (requestDto != null && requestDto.getWfProcessId() != null) {
WorkflowProcessInstanceDto processDto = workflowProcessInstanceService.get(requestDto.getWfProcessId(), false);
// TODO: create trimmed variant in workflow process instance service
if (processDto != null) {
processDto.setProcessVariables(null);
}
requestDto.getEmbedded().put(IdmRoleRequestDto.WF_PROCESS_FIELD, processDto);
}
return requestDto;
}
use of eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowProcessInstanceDto in project CzechIdMng by bcvsolutions.
the class DefaultIdmConceptRoleRequestService method deleteInternal.
@Override
public void deleteInternal(IdmConceptRoleRequestDto 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()));
} else {
workflowProcessInstanceService.delete(dto.getWfProcessId(), "Role concept use this WF, was deleted. This WF was deleted too.");
this.addToLog(dto, MessageFormat.format("Workflow process with ID [{0}] was deleted, because this concept is deleted/canceled", dto.getWfProcessId()));
}
}
super.deleteInternal(dto);
}
use of eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowProcessInstanceDto in project CzechIdMng by bcvsolutions.
the class DefaultIdmRoleRequestService method toDto.
@Override
public IdmRoleRequestDto toDto(IdmRoleRequest entity, IdmRoleRequestDto dto) {
IdmRoleRequestDto requestDto = super.toDto(entity, dto);
// Set concepts to request DTO
if (requestDto != null) {
requestDto.setConceptRoles(conceptRoleRequestService.findAllByRoleRequest(requestDto.getId()));
}
if (requestDto != null && requestDto.getWfProcessId() != null) {
WorkflowProcessInstanceDto processDto = workflowProcessInstanceService.get(requestDto.getWfProcessId(), false);
// TODO: create trimmed variant in workflow process instance service
if (processDto != null) {
processDto.setProcessVariables(null);
}
requestDto.getEmbedded().put(IdmRoleRequestDto.WF_PROCESS_FIELD, processDto);
}
return requestDto;
}
Aggregations