use of eu.bcvsolutions.idm.core.model.event.AutomaticRoleRequestEvent in project CzechIdMng by bcvsolutions.
the class DefaultIdmAutomaticRoleRequestService method startRequestInternal.
@Override
@Transactional
public IdmAutomaticRoleRequestDto 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
IdmAutomaticRoleRequestDto request = 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());
IdmAutomaticRoleRequestDto savedRequest = this.save(request);
// Throw event
Map<String, Serializable> variables = new HashMap<>();
variables.put(RoleRequestApprovalProcessor.CHECK_RIGHT_PROPERTY, checkRight);
return entityEventManager.process(new AutomaticRoleRequestEvent(AutomaticRoleRequestEventType.EXECUTE, savedRequest, variables)).getContent();
}
Aggregations