urn_perun_group_attribute_def_def_groupStructureResources extends GroupAttributesModuleAbstract implements GroupAttributesModuleImplApi { @Override public void checkAttributeSemantics(PerunSessionImpl sess, Group group, Attribute attribute) throws WrongReferenceAttributeValueException, WrongAttributeAssignmentException { if(attribute.getValue() == null) return; LinkedHashMap<String, String> attrValues = attribute.valueAsMap(); Vo vo; try { vo = sess.getPerunBl().getVosManagerBl().getVoById(sess, group.getVoId()); } catch (VoNotExistsException e) { throw new InternalErrorException("Failed to find group's vo.", e); } List<Resource> voResources = sess.getPerunBl().getResourcesManagerBl().getResources(sess, vo); Set<Integer> voResourceIds = voResources.stream() .map(Resource::getId) .collect(Collectors.toSet()); for (String rawId : attrValues.keySet()) { int id = Integer.parseInt(rawId); if (!voResourceIds.contains(id)) { throw new WrongReferenceAttributeValueException(attribute, "There is no resource with id '" + id + "' assigned to the groups vo: " + vo); } } }  @Override void checkAttributeSyntax(PerunSessionImpl sess, Group group, Attribute attribute); @Override void checkAttributeSemantics(PerunSessionImpl sess, Group group, Attribute attribute); @Override AttributeDefinition getAttributeDefinition();  }
@Test public void testNullValueIsValidInSemantics() throws Exception { System.out.println(CLASS_NAME + "testNullValueIsValidInSemantics"); attribute.setValue(null); classInstance.checkAttributeSemantics(sess, group, attribute); }