public List<User> getGroupUsers(PerunSession sess, Group group) throws InternalErrorException { try { return jdbc.query( "select " + UsersManagerImpl.userMappingSelectQuery + " from groups_members join members on members.id=member_id join " + "users on members.user_id=users.id where group_id=? order by " + Compatibility.orderByBinary("users.last_name") + ", " + Compatibility.orderByBinary("users.first_name"), UsersManagerImpl.USER_MAPPER, group.getId()); } catch (RuntimeException ex) { throw new InternalErrorException(ex); } }
public List<Group> getGroups(PerunSession sess, Vo vo) throws InternalErrorException { try { return jdbc.query( "select " + groupMappingSelectQuery + " from groups where vo_id=? order by " + Compatibility.orderByBinary("groups.name" + Compatibility.castToVarchar()), GROUP_MAPPER, vo.getId()); } catch (RuntimeException ex) { throw new InternalErrorException(ex); } }
public List<Group> getSubGroups(PerunSession sess, Group parentGroup) throws InternalErrorException { try { return jdbc.query( "select " + groupMappingSelectQuery + " from groups where groups.parent_group_id=? " + "order by " + Compatibility.orderByBinary("groups.name" + Compatibility.castToVarchar()), GROUP_MAPPER, parentGroup.getId()); } catch (EmptyResultDataAccessException e) { return new ArrayList<Group>(); } catch (RuntimeException ex) { throw new InternalErrorException(ex); } }