class urn_perun_resource_attribute_def_def_defaultShell extends ResourceAttributesModuleAbstract implements ResourceAttributesModuleImplApi {

	@Override
	public Attribute fillAttribute(PerunSessionImpl perunSession, Resource resource, AttributeDefinition attribute) throws WrongAttributeAssignmentException {
		Attribute atr = new Attribute(attribute);
		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) {
			return atr;
		} else {
			List<String> shells = (List<String>) resourceAttr.getValue();

			if (!shells.isEmpty()) {
				atr.setValue(shells.get(0));
				return atr;
			} else {
				return atr;
			}
		}
	}

}