robe-admin/src/main/java/io/robe/admin/resources/RoleResource.java
@RobeService(group = "Permission", description = "Returns all services and menus collection with the matches given Role id.")
    @GET
    @Path("{id}/permissions")
    @UnitOfWork(readOnly = true, cacheMode = GET, flushMode = FlushMode.MANUAL)
    public Map<String, Object> getRolePermissions(@RobeAuth Credentials credentials, @PathParam("id") String id) {

        List<Permission> permissions = new ArrayList<>();

        List<Service> services = new ArrayList<>();
        List<Menu> menus = new ArrayList<>();

        Role role = roleDao.findById(id);

        getAllRolePermissions(role, permissions);

        for (Permission permission : permissions) {
            if (permission.getType().equals(PermissionEntry.Type.SERVICE)) {
                Service service = serviceDao.findById(permission.getRestrictedItemOid());
                if (service != null) {
                    if (services.indexOf(service) == -1) {
                        services.add(service);
                    }
                }

            } else if (permission.getType().equals(PermissionEntry.Type.MENU)) {

                Menu menu = menuDao.findById(permission.getRestrictedItemOid());
                if (menu != null) {
                    if (menus.indexOf(menu) == -1) {
                        menus.add(menu);
                    }
                }
            }
        }


        Map<String, Object> response = new HashMap<>();
        response.put("menu", menus);
        response.put("service", services);

        return response;
    }
@RobeService(group = "Permission", description = "Returns all services and menus collection with the matches given Role id.")
    @GET
    @Path("{id}/permissions")
    @UnitOfWork(readOnly = true, cacheMode = GET, flushMode = FlushMode.MANUAL)
    public Map<String, Object> getRolePermissions(@RobeAuth Credentials credentials, @PathParam("id") String id) {

        List<Permission> permissions = new ArrayList<>();

        List<Service> services = new ArrayList<>();
        List<Menu> menus = new ArrayList<>();

        Role role = roleDao.findById(id);

        getAllRolePermissions(role, permissions);

        for (Permission permission : permissions) {
            if (permission.getType().equals(PermissionEntry.Type.SERVICE)) {
                Service service = serviceDao.findById(permission.getRestrictedItemOid());
                if (service != null) {
                    if (services.indexOf(service) == -1) {
                        services.add(service);
                    }
                }

            } else if (permission.getType().equals(PermissionEntry.Type.MENU)) {

                Menu menu = menuDao.findById(permission.getRestrictedItemOid());
                if (menu != null) {
                    if (menus.indexOf(menu) == -1) {
                        menus.add(menu);
                    }
                }
            }
        }


        Map<String, Object> response = new HashMap<>();
        response.put("menu", menus);
        response.put("service", services);

        return response;
    }
Returns all services and menus collection with the matches given Role id.

@param credentials Injected by {@link RobeAuth} annotation for authentication.
@param id          This is Role oid
@return JSONObject (MENU and SERVICE)