class urn_perun_resource_attribute_def_def_defaultShell 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 value is null.");
		}

		Attribute resourceAttr;
		try {
			resourceAttr = perunSession.getPerunBl().getAttributesManagerBl().getAttribute(perunSession, resource, A_R_shells);
		} catch (AttributeNotExistsException ex) {
			throw new InternalErrorException("Attribute with list of shells from resource " + resource.getId() + " could not obtained.", ex);
		}

		if (resourceAttr.getValue() == null) {
			throw new WrongReferenceAttributeValueException(resourceAttr, null, resource, null, "Attribute with list of shells from resource has null value.");
		}
		List<String> shells = resourceAttr.valueAsList();

		if (!shells.contains(attribute.valueAsString())) {
			throw new WrongReferenceAttributeValueException(attribute, resourceAttr, resource, null, resource, null, "Shell " + attribute.getValue() + " is not at specified resource (" + resource + ")");
		}
	}

}