Search in sources :

Example 1 with AutomaticRoleRequestEvent

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();
}
Also used : Serializable(java.io.Serializable) HashMap(java.util.HashMap) IdmAutomaticRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmAutomaticRoleRequestDto) CriteriaBuilder(javax.persistence.criteria.CriteriaBuilder) AutomaticRoleRequestEvent(eu.bcvsolutions.idm.core.model.event.AutomaticRoleRequestEvent) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

IdmAutomaticRoleRequestDto (eu.bcvsolutions.idm.core.api.dto.IdmAutomaticRoleRequestDto)1 AutomaticRoleRequestEvent (eu.bcvsolutions.idm.core.model.event.AutomaticRoleRequestEvent)1 Serializable (java.io.Serializable)1 HashMap (java.util.HashMap)1 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)1 Transactional (org.springframework.transaction.annotation.Transactional)1