public List<RoleMap> getRoleMapGroups() throws DataAccessException {
LinkedHashMap<Long, RoleMap> roleMaps = new LinkedHashMap<Long, RoleMap>();
QueryResultIterable<GroupAuthorityEntity> list = GroupAuthorityService.getAll();
for (GroupAuthorityEntity groupAuthorityEntity : list) {
Long groupId = groupAuthorityEntity.getGroupId();
RoleMap roleMap = new RoleMap();
if (roleMaps.containsKey(groupId)) {
roleMap = roleMaps.get(groupId);
} else {
roleMap.setGroupId(groupId);
roleMap.setGroupName(groupAuthorityEntity.getGroupName());
}
roleMap.addRole(groupAuthorityEntity.getAuthority());
roleMaps.put(groupId, roleMap);
}
return new ArrayList<RoleMap>(roleMaps.values());
}