class urn_perun_user_facility_attribute_def_def_homeMountPoint extends UserFacilityAttributesModuleAbstract implements UserFacilityAttributesModuleImplApi {

	@Override
	public Attribute fillAttribute(PerunSessionImpl session, User user, Facility facility, AttributeDefinition attribute) throws WrongAttributeAssignmentException {
		Attribute returnAttribute = new Attribute(attribute);
		List<Resource> usersResources;
		usersResources = session.getPerunBl().getUsersManagerBl().getAllowedResources(session, facility, user);
		for (Resource res : usersResources) {
			Attribute resAttribute;
			try {
				resAttribute = session.getPerunBl().getAttributesManagerBl().getAttribute(session, res, AttributesManager.NS_RESOURCE_ATTR_DEF + ":defaultHomeMountPoint");
			} catch (AttributeNotExistsException ex) {
				throw new InternalErrorException("no homemountpoints found on underlying user's  resources", ex);
			}
			if (resAttribute.getValue() != null) {
				returnAttribute.setValue(resAttribute.getValue());
				return returnAttribute;
			}
		}
		return returnAttribute;
	}

}