use of eu.bcvsolutions.idm.core.api.service.RequestManager in project CzechIdMng by bcvsolutions.
the class DefaultRequestManager method startRequest.
@Override
@Transactional
public IdmRequestDto startRequest(UUID requestId, boolean checkRight) {
IdmRequestDto request = requestService.get(requestId);
Assert.notNull(request, "Request is required!");
try {
RequestManager service = this.getRequestManager();
if (!(service instanceof DefaultRequestManager)) {
throw new CoreException("We expects instace of DefaultRequestManager!");
}
return ((DefaultRequestManager) service).startRequestNewTransactional(requestId, checkRight);
} catch (Exception ex) {
LOG.error(ex.getLocalizedMessage(), ex);
request = requestService.get(requestId);
Throwable exceptionToLog = ExceptionUtils.resolveException(ex);
if (exceptionToLog instanceof ResultCodeException) {
//
request.setResult(new //
OperationResultDto.Builder(//
OperationState.EXCEPTION).setException(//
(ResultCodeException) exceptionToLog).build());
} else {
//
request.setResult(new //
OperationResultDto.Builder(//
OperationState.EXCEPTION).setCause(//
exceptionToLog).build());
}
request.setState(RequestState.EXCEPTION);
return requestService.save(request);
}
}
Aggregations