class urn_perun_user_facility_attribute_def_def_accountExpirationTime extends UserFacilityAttributesModuleAbstract implements UserFacilityAttributesModuleImplApi {

	@Override
	public void checkAttributeSemantics(PerunSessionImpl perunSession, User user, Facility facility, Attribute attribute) throws WrongReferenceAttributeValueException, WrongAttributeAssignmentException {
		Integer accExpTime = attribute.valueAsInteger();

		if (accExpTime == null) {
			throw new WrongReferenceAttributeValueException(attribute, null, user, facility, "account expiration time shouldn't be null");
		}
		Integer facilityAccExpTime;
		Attribute facilityAccExpAttribute;
		try {
			facilityAccExpAttribute = perunSession.getPerunBl().getAttributesManagerBl().getAttribute(perunSession, facility, A_F_D_accountExpirationTime);
			facilityAccExpTime = facilityAccExpAttribute.valueAsInteger();
		} catch (AttributeNotExistsException ex) {
			throw new InternalErrorException(ex);
		}
		if(accExpTime > facilityAccExpTime) {
			throw new WrongReferenceAttributeValueException(attribute, facilityAccExpAttribute, user, facility, facility, null, "this user_facility attribute cannot has higher value than same facility attribute");
		}
	}

}