class UserRest {

    @GET
    @RolesAllowed("user")
    @Produces(MediaType.APPLICATION_JSON)
    @ApiOperation("Get all Mobi Users")
    public Response getUsers() {
        try {
            Set<User> users = engineManager.getUsers();
            JSONArray result = JSONArray.fromObject(users.stream()
                    .map(user -> {
                        user.clearPassword();
                        return user.getModel().filter(user.getResource(), null, null);
                    })
                    .map(userModel -> modelToJsonld(userModel, transformer))
                    .map(RestUtils::getObjectFromJsonld)
                    .collect(Collectors.toList()));
            return Response.ok(result).build();
        } catch (IllegalArgumentException ex) {
            throw ErrorUtils.sendError(ex.getMessage(), Response.Status.BAD_REQUEST);
        } catch (IllegalStateException | MobiException ex) {
            throw ErrorUtils.sendError(ex, ex.getMessage(), Response.Status.INTERNAL_SERVER_ERROR);
        }
    }

}