Esempio n. 1
0
 public List<Group> getGroupsByAttribute(PerunSession sess, Attribute attribute)
     throws InternalErrorException {
   try {
     return jdbc.query(
         "select "
             + groupMappingSelectQuery
             + " from groups "
             + "join group_attr_values on groups.id=group_attr_values.group_id where group_attr_values.attr_id=? and "
             + "group_attr_values.attr_value=?",
         GROUP_MAPPER,
         attribute.getId(),
         BeansUtils.attributeValueToString(attribute));
   } catch (EmptyResultDataAccessException e) {
     return new ArrayList<Group>();
   } catch (RuntimeException e) {
     throw new InternalErrorException(e);
   }
 }
Esempio n. 2
0
 public List<Pair<Group, Resource>> getGroupResourcePairsByAttribute(
     PerunSession sess, Attribute attribute) throws InternalErrorException {
   try {
     return jdbc.query(
         "select "
             + groupMappingSelectQuery
             + ", "
             + ResourcesManagerImpl.resourceMappingSelectQuery
             + " from group_resource_attr_values "
             + "join groups on groups.id=group_resource_attr_values.group_id "
             + "join resources on resources.id=group_resource_attr_values.resource_id "
             + "where group_resource_attr_values.attr_id=? and group_resource_attr_values.attr_value=?",
         GROUP_RESOURCE_MAPPER,
         attribute.getId(),
         BeansUtils.attributeValueToString(attribute));
   } catch (EmptyResultDataAccessException e) {
     return new ArrayList<Pair<Group, Resource>>();
   } catch (RuntimeException e) {
     throw new InternalErrorException(e);
   }
 }