<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC 
	"-//SPRING//DTD BEAN//EN" 
	"http://www.springframework.org/dtd/spring-beans.dtd">

<beans>

	<bean id="myViewPropertyConfigurer"
		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name="locations">
			<list>
				<value>classpath:/env.properties</value>
			</list>
		</property>
	</bean>
	
	<!--
		parentRedirectView: default settings for redirect views
	-->
	<bean id="parentRedirectView" class="org.springframework.web.servlet.view.RedirectView" 
		abstract="true">
		<property name="contextRelative" value="true"/>
	</bean>
	
	<!-- Normal views below -->
	
	<bean id="add-recipe-to-meal_" parent="defaultXsltViewTemplate">
		<property name="stylesheetLocation" value="/WEB-INF/xsl/add-recipe-to-meal.xsl"/>
		<property name="root" value="findRecipe"/>
	</bean>
	
	<bean id="added-recipe-ingredient_" parent="defaultXsltViewTemplate">
		<property name="stylesheetLocation" value="/WEB-INF/xsl/added-recipe-ingredient.xsl"/>
		<property name="root" value="editIngredient"/>
	</bean>
	
	<bean id="admin-home-redirect" parent="parentRedirectView">
		<property name="url" value="/admin.do"/>
	</bean>

	<bean id="alter-recipe-size" parent="defaultXsltViewTemplate">
		<property name="stylesheetLocation" value="/WEB-INF/xsl/choose-size-to-alter-recipe.xsl"/>
	</bean>
	
	<bean id="cancelled-add-recipe-ingredient" parent="defaultXsltViewTemplate">
		<property name="stylesheetLocation" value="/WEB-INF/xsl/close-popup.xsl"/>
		<property name="root" value="editIngredient"/>
	</bean>
	
	<bean id="cancelled-add-recipe-as-ingredient" parent="defaultXsltViewTemplate">
		<property name="stylesheetLocation" value="/WEB-INF/xsl/close-popup.xsl"/>
		<property name="root" value="findRecipe"/>
	</bean>
	
	<bean id="cancelled-add-recipe-to-meal" parent="defaultXsltViewTemplate">
		<property name="stylesheetLocation" value="/WEB-INF/xsl/close-popup.xsl"/>
		<property name="root" value="findRecipe"/>
	</bean>
	
	<bean id="choose-meal-system" parent="defaultXsltViewTemplate">
		<property name="stylesheetLocation" value="/WEB-INF/xsl/choose-system-to-display-shoplist.xsl"/>
	</bean>

	<bean id="convert-recipe-system" parent="defaultXsltViewTemplate">
		<property name="stylesheetLocation" value="/WEB-INF/xsl/choose-system-to-convert-recipe.xsl"/>
	</bean>

	<bean id="delete-meal-confirm" parent="defaultXsltViewTemplate">
		<property name="stylesheetLocation" value="/WEB-INF/xsl/confirm-delete-meal.xsl"/>
	</bean>
	
	<bean id="delete-recipe-confirm" parent="defaultXsltViewTemplate">
		<property name="stylesheetLocation" value="/WEB-INF/xsl/confirm-delete-recipe.xsl"/>
	</bean>
	
	<bean id="delete-user-confirm" parent="defaultXsltViewTemplate">
		<property name="stylesheetLocation" value="/WEB-INF/xsl/confirm-delete-user.xsl"/>
	</bean>
	
	<!-- So named so default view does not find and we can define the 'root' property here -->
	<bean id="edit-ingredient_" parent="defaultXsltViewTemplate">
		<property name="stylesheetLocation" value="/WEB-INF/xsl/edit-ingredient.xsl"/>
		<property name="root" value="editIngredient"/>
	</bean>
	
	<bean id="logon-redirect" parent="parentRedirectView">
		<property name="url" value="/logon.do"/>
	</bean>
	
	<bean id="home-redirect" parent="parentRedirectView">
		<property name="url" value="/home.do"/>
	</bean>
	
	<bean id="meals" parent="defaultXsltViewTemplate">
		<property name="stylesheetLocation" value="/WEB-INF/xsl/meals-home.xsl"/>
	</bean>
	<bean id="meals-redirect" parent="parentRedirectView">
		<property name="url" value="/meals.do"/>
	</bean>
	
	<bean id="recipe-index-redirect" parent="parentRedirectView">
		<property name="url" value="/index.do"/>
	</bean>
	
	<bean id="search-recipes-redirect" parent="parentRedirectView">
		<property name="url" value="/search.do"/>
	</bean>

	<bean id="settings-redirect" parent="parentRedirectView">
		<property name="url" value="/settings.do"/>
	</bean>

	<bean id="user-index-redirect" parent="parentRedirectView">
		<property name="url" value="/users.do"/>
	</bean>
	
	<bean id="validate-ingredient_" parent="defaultXsltViewTemplate">
		<property name="stylesheetLocation" value="/WEB-INF/xsl/validate-ingredient.xsl"/>
		<property name="root" value="editIngredient"/>
	</bean>
	
	<bean id="view-meal-redirect" parent="parentRedirectView">
		<property name="url" value="/meal.do"/>
	</bean>
	
	<bean id="view-recipe-redirect" parent="parentRedirectView">
		<property name="url" value="/recipe.do"/>
	</bean>
	
	<bean id="view-user-redirect" parent="parentRedirectView">
		<property name="url" value="/user.do"/>
	</bean>

	<bean id="recipe-comments-redirect" parent="parentRedirectView">
		<property name="url" value="/recipeComments.do"/>
	</bean>

	<!-- 
		xml-service-response: return XML content
	-->
	<bean id="xml-service-response" parent="defaultXsltViewTemplate" 
		class="magoffin.matt.xweb.util.XwebServiceView">
		<property name="contentType" value="text/xml; charset=UTF-8"/>
		<property name="cache" value="${xslt.cache}"/>	
		<property name="stylesheetLocation" value="/WEB-INF/xsl/xml-service-response.xsl"/>
	</bean>
	
	<!-- 
		messages: return JSON locale message resources
	-->
	<bean id="messages" parent="jsonXsltViewTemplate"
		class="magoffin.matt.xweb.util.XwebServiceView">
		<property name="stylesheetLocation" value="classpath:/magoffin/matt/xweb/support/locale-messages.xsl"/>
		<property name="includeXwebMessages" value="true"/>
	</bean>
	
	<!--
		json: return JSON encoded data
	-->
	<bean id="json" class="magoffin.matt.xweb.util.JSONView">
		<property name="contentType" value="text/javascript; charset=UTF-8"/>
		<property name="indentAmount" value="2"/>
		<property name="javaBeanIgnoreProperties">
			<set>
				<value>class</value>
				<value>primaryInterface</value>
			</set>
		</property>
	</bean>
	
</beans>
