Search in sources :

Example 1 with RequestEvent

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();
}
Also used : Serializable(java.io.Serializable) LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) Builder(eu.bcvsolutions.idm.core.api.dto.OperationResultDto.Builder) RequestEvent(eu.bcvsolutions.idm.core.model.event.RequestEvent) IdmRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmRequestDto) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

IdmRequestDto (eu.bcvsolutions.idm.core.api.dto.IdmRequestDto)1 Builder (eu.bcvsolutions.idm.core.api.dto.OperationResultDto.Builder)1 RequestEvent (eu.bcvsolutions.idm.core.model.event.RequestEvent)1 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)1 Serializable (java.io.Serializable)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 Transactional (org.springframework.transaction.annotation.Transactional)1