class urn_perun_group_attribute_def_def_flatGroupStructureEnabled extends GroupAttributesModuleAbstract implements GroupAttributesModuleImplApi {

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

		AttributesManagerBl attributeManager = perunSession.getPerunBl().getAttributesManagerBl();
		try {
			Attribute foundAttribute = attributeManager.getAttribute(perunSession, group, MANDATORY_ATTRIBUTE_NAME);
			if(foundAttribute == null || foundAttribute.getValue() == null) {
				throw new WrongReferenceAttributeValueException(attribute, foundAttribute, group, null, group, null, "Attribute " + MANDATORY_ATTRIBUTE_NAME + " must be defined first.");
			}
		} catch (AttributeNotExistsException exc) {
			throw new ConsistencyErrorException("Attribute " + MANDATORY_ATTRIBUTE_NAME + " is supposed to exist", exc);
		}
	}

}