class urn_perun_resource_attribute_def_def_homeMountPoints extends ResourceAttributesModuleAbstract implements ResourceAttributesModuleImplApi {

	@Override
	public void checkAttributeSemantics(PerunSessionImpl perunSession, Resource resource, Attribute attribute) throws WrongReferenceAttributeValueException, WrongAttributeAssignmentException {
		if (attribute.getValue() == null) {
			throw new WrongReferenceAttributeValueException(attribute, null, resource, null, "Attribute cannot be null!");
		}
		Facility facility = perunSession.getPerunBl().getResourcesManagerBl().getFacility(perunSession, resource);

		Attribute facilityAttr;
		try {
			facilityAttr = perunSession.getPerunBl().getAttributesManagerBl().getAttribute(perunSession, facility, A_F_homeMountPoints);
		} catch (AttributeNotExistsException ex) {
			throw new InternalErrorException(ex);
		}

		if(facilityAttr.getValue() == null) throw new WrongReferenceAttributeValueException(attribute, facilityAttr, resource, null, facility, null, "Reference attribute has null value.");

		if (!(facilityAttr.valueAsList()).containsAll(attribute.valueAsList())) {
			throw new WrongReferenceAttributeValueException(attribute, facilityAttr, resource, null, facility, null, "Facility does not contain all of the attribute homeMountPoints!");
		}
	}

}