class urn_perun_group_attribute_def_def_groupStructureResources extends GroupAttributesModuleAbstract implements GroupAttributesModuleImplApi {

	@Override
	public void checkAttributeSemantics(PerunSessionImpl sess, Group group, Attribute attribute) throws WrongReferenceAttributeValueException, WrongAttributeAssignmentException {
		//Null value is ok, means no settings for group
		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);
			}
		}
	}

}