use of org.hibernate.envers.exception.RevisionDoesNotExistException in project CzechIdMng by bcvsolutions.
the class IdmRoleController method findRevision.
@ResponseBody
@RequestMapping(value = "{backendId}/revisions/{revId}", method = RequestMethod.GET)
@PreAuthorize("hasAuthority('" + CoreGroupPermission.ROLE_READ + "')")
@ApiOperation(value = "Role audit - read revision detail", nickname = "getRoleRevision", tags = { IdmIdentityController.TAG }, authorizations = { @Authorization(value = SwaggerConfig.AUTHENTICATION_BASIC, scopes = { @AuthorizationScope(scope = CoreGroupPermission.ROLE_READ, description = "") }), @Authorization(value = SwaggerConfig.AUTHENTICATION_CIDMST, scopes = { @AuthorizationScope(scope = CoreGroupPermission.ROLE_READ, description = "") }) })
public ResponseEntity<?> findRevision(@ApiParam(value = "Role's uuid identifier or code.", required = true) @PathVariable("backendId") String backendId, @ApiParam(value = "Revision identifier.", required = true) @PathVariable("revId") Long revId) {
IdmRoleDto originalDto = getDto(backendId);
if (originalDto == null) {
throw new ResultCodeException(CoreResultCode.NOT_FOUND, ImmutableMap.of("role", backendId));
}
//
IdmRole revisionRole;
try {
revisionRole = this.auditService.findRevision(IdmRole.class, originalDto.getId(), revId);
// checkAccess(revisionRole, IdmBasePermission.READ);
} catch (RevisionDoesNotExistException ex) {
throw new ResultCodeException(CoreResultCode.NOT_FOUND, ImmutableMap.of("revision", backendId), ex);
}
// TODO: dto
return new ResponseEntity<>(revisionRole, HttpStatus.OK);
}
Aggregations