@Override public Role findRoleById(String id) { if (!StringUtils.hasText(id)) { return null; } Role r = roleDao.findOne(id); if (r != null) { r.getPermissionSet().size(); r.getMenuSet().size(); } return r; }
@Override public List<Permission> findPermissionsNotInRole(Role role) { if (role == null) { return new ArrayList<Permission>(); } Role r = findRoleById(role.getId()); if (r == null || r.getPermissionSet().isEmpty()) { return new ArrayList<Permission>(); } List<String> ids = new ArrayList<String>(); for (Permission p : r.getPermissionSet()) { ids.add(p.getId()); } return permissionDao.findByIdNotIn(ids); }
@Override public List<Menu> findMenuNotInRole(Role role) { if (role == null) { return new ArrayList<Menu>(); } Role r = findRoleById(role.getId()); if (r == null || r.getMenuSet().isEmpty()) { return new ArrayList<Menu>(); } List<String> ids = new ArrayList<String>(); for (Menu m : r.getMenuSet()) { ids.add(m.getId()); } return menuDao.findByIdNotIn(ids); }