use of eu.bcvsolutions.idm.core.model.event.RequestEvent in project CzechIdMng by bcvsolutions.
the class DefaultRequestManager method startRequestInternal.
@Override
@Transactional
public IdmRequestDto startRequestInternal(UUID requestId, boolean checkRight) {
LOG.debug("Start role request [{}]", requestId);
Assert.notNull(requestId, "Role request ID is required!");
// Load request ... check right for read
IdmRequestDto request = requestService.get(requestId);
Assert.notNull(request, "Role request DTO is required!");
Assert.isTrue(RequestState.CONCEPT == request.getState() || RequestState.DUPLICATED == request.getState() || RequestState.EXCEPTION == request.getState(), "Only role request with CONCEPT or EXCEPTION or DUPLICATED state can be started!");
// Request will be set on in progress state
request.setState(RequestState.IN_PROGRESS);
request.setResult(new OperationResultDto.Builder(OperationState.RUNNING).build());
IdmRequestDto savedRequest = requestService.save(request);
// Throw event
Map<String, Serializable> variables = new HashMap<>();
variables.put(RoleRequestApprovalProcessor.CHECK_RIGHT_PROPERTY, checkRight);
return entityEventManager.process(new RequestEvent(RequestEventType.EXECUTE, savedRequest, variables)).getContent();
}
Aggregations