class RecordPermissionsRest {

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    @Path("{recordId}")
    @ApiOperation("Retrieves a specific record security policy by its ID.")
    @ActionId(Update.TYPE)
    @ResourceId(type = ValueType.PATH, value = "recordId")
    public Response retrieveRecordPolicy(@PathParam("recordId") String recordId) {
        try (RepositoryConnection conn = repo.getConnection()) {
            Optional<String> recordPolicyIdOpt = getRelatedResourceId(recordId, conn);
            String recordPolicyId = recordPolicyIdOpt.orElseThrow(() -> ErrorUtils.sendError("Policy for record "
                            + recordId + " does not exist in repository", Response.Status.BAD_REQUEST));

            Optional<XACMLPolicy> policy = policyManager.getPolicy(vf.createIRI(recordPolicyId));
            if (!policy.isPresent()) {
                throw ErrorUtils.sendError("Policy could not be found", Response.Status.BAD_REQUEST);
            }

            return Response.ok(recordPolicyToJson(policy.get())).build();
        } catch (IllegalStateException | MobiException ex) {
            throw ErrorUtils.sendError(ex, "Policy could not be retrieved", Response.Status.INTERNAL_SERVER_ERROR);
        }
    }

}