class urn_perun_group_attribute_def_def_groupStructureResources extends GroupAttributesModuleAbstract implements GroupAttributesModuleImplApi {

	@Override
	public void checkAttributeSyntax(PerunSessionImpl sess, Group group, Attribute attribute) throws WrongAttributeValueException {
		//Null value is ok, means no settings for group
		if(attribute.getValue() == null) return;

		LinkedHashMap<String, String> attrValues = attribute.valueAsMap();

		boolean hasInvalidResourceName = attrValues.keySet().stream()
				.anyMatch(this::invalidResourceName);

		if (hasInvalidResourceName) {
			throw new WrongAttributeValueException(attribute, group, "Some of the specified resource ids has an invalid format.");
		}
		for (String rawGroupLogins : attrValues.values()) {
			// null or empty value means the whole group tree
			if (rawGroupLogins == null || rawGroupLogins.isEmpty()) {
				continue;
			}
			Matcher m = invalidEscapePattern.matcher(rawGroupLogins);
			if (m.find()) {
				throw new WrongAttributeValueException(attribute, group, "Group logins format contains invalid escape sequence.");
			}
			if (!rawGroupLogins.endsWith(",")) {
				throw new WrongAttributeValueException(attribute, group, "Each group login has to end with a comma ','.");
			}
		}
	}

}