class urn_perun_user_attribute_def_def_vsupPreferredMail extends UserAttributesModuleAbstract implements UserAttributesModuleImplApi {

	@Override
	public void checkAttributeSyntax(PerunSessionImpl sess, User user, Attribute attribute) throws WrongAttributeValueException {

		// we must allow null, since when setting required attributes all at once, value might not be filled yet
		// if vsupMail or vsupMailAlias is empty, but it's checked by method impl.

		if (attribute.getValue() == null) return; // throw new WrongAttributeValueException(attribute, user, "Preferred mail can't be null.");

		// standard email pattern !!
		Matcher emailMatcher = emailPattern.matcher((String)attribute.getValue());
		if(!emailMatcher.find()) throw new WrongAttributeValueException(attribute, user, "School Preferred Mail is not in a correct form.");

		// We check uniqueness on all related attributes change, so we don't need to do it here.

	}

}