<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
	                   http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
	<!-- Hibernate query name = domainEntryPoint.associationName.[identifiers].[date]. -->
	
	<util:map id="vistaTemplateQueryStrategyMap">
		<entry key="RequestsAndExamsRead1-ExamRequest2507" value-ref="multiQueryExamRequestQueryStrategy"/>
		<entry key="RequestsAndExamsRead1-Exam2507" value-ref="multiQueryExamQueryStrategy"/>
		<entry key="RequestsAndExamsRead2-ExamRequest2507" value-ref="multiQueryExamRequestQueryStrategy"/>
		<entry key="RequestsAndExamsRead2-Exam2507" value-ref="multiQueryExamQueryStrategy"/>		
		<entry key="AppointmentsRead1-Appointment" value-ref="multiQueryAppointmentQueryStrategy"/>
		<entry key="GenericObservationRead1-GenericObservation" value-ref="multiQueryGenericObservationQueryStrategy"/>
	</util:map>
	
	<bean id="legacyQueryNameBuilder" class="gov.va.med.cds.persistence.hibernate.LegacyQueryNameBuilder"/>
	<bean id="legacyFilterParameterExtractor" class="gov.va.med.cds.persistence.hibernate.LegacyFilterParameterExtractor"/>
	<bean id="defaultQueryParameterBinder" class="gov.va.med.cds.persistence.hibernate.DefaultQueryParameterBinder"/>
	
	<util:map id="vistaParameterTransformerMap">
		<entry key="pids"><bean class="gov.va.med.cds.persistence.hibernate.VistaPersonIdentifierQueryParameterTransformer"/></entry>
		<entry key="recordIdentifiers"><bean class="gov.va.med.cds.persistence.hibernate.VistaRecordIdentifierQueryParameterTransformer"/></entry>
		<entry key="startDate"><bean class="gov.va.med.cds.persistence.hibernate.PointInTimeQueryParameterTransformer"/></entry>
		<entry key="endDate"><bean class="gov.va.med.cds.persistence.hibernate.PointInTimeQueryParameterTransformer"/></entry>
	</util:map>

	<bean id="multiQueryExamRequestQueryStrategy" class="gov.va.med.cds.integration.VistaStoredProcedureQueryTimeoutBasedQueryStrategy">
		<property name="templateTimeoutMap" ref="templateTimeoutMap"/>
		<property name="modelAssembler" ref="requestModelAssembler"/>
		<property name="queryPlanMap">
			<map>
				<entry key="examRequests">
					<bean class="gov.va.med.cds.persistence.QueryAssociationMetaData">
						<property name="filterModelName" value="examRequest"/>
						<property name="associationParent" value="examRequests"/>
						<property name="associationName" value="examRequests"/>
						<property name="key" value="recordIdentifier"/>
					</bean>
				</entry>
			</map>
		</property>
		<property name="vistaResponseStrategy" ref="vrmVistaResponseStrategy"/>
		<property name="queryMap" ref="vistaStoredProcedureQueryMap"/>
		<property name="applicationName" ref="pathwaysAppName"/>
		<property name="parameterTransformerMap" ref="vistaParameterTransformerMap"/>
		<property name="pooledConnectionUnwrapper" ref="pooledConnectionUnwrapper"/>
	</bean>

	<!-- <bean id="multiQueryExamQueryStrategy" class="gov.va.med.cds.persistence.DefaultAssociationBasedQueryStrategy"> <property name="modelAssembler" ref="examModelAssembler" /> <property name="queryPlanMap"> <map> <entry key="exams"> <bean class="gov.va.med.cds.persistence.QueryAssociationMetaData"> 
		<property name="filterModelName" value="exam" /> <property name="associationName" value="exams" /> <property name="associationParent" value="exams" /> <property name="key" value="id" /> </bean> </entry> </map> </property> </bean> -->
	<bean id="multiQueryExamQueryStrategy" class="gov.va.med.cds.integration.VistaStoredProcedureQueryTimeoutBasedQueryStrategy">
		<property name="templateTimeoutMap" ref="templateTimeoutMap"/>
		<property name="modelAssembler" ref="examModelAssembler"/>
		<property name="queryPlanMap">
			<map>
				<entry key="exams"> <!-- DomainEntryPoint -->
					<bean class="gov.va.med.cds.persistence.QueryAssociationMetaData">
						<property name="filterModelName" value="exam"/>
						<property name="associationParent" value="exams"/>
						<property name="associationName" value="exams"/>
						<property name="key" value="id"/>
					</bean>
				</entry>
			</map>
		</property>
		<property name="vistaResponseStrategy" ref="vrmVistaResponseStrategy"/>
		<property name="queryMap" ref="vistaStoredProcedureQueryMap"/>
		<property name="applicationName" ref="pathwaysAppName"/>
		<property name="parameterTransformerMap" ref="vistaParameterTransformerMap"/>
		<property name="pooledConnectionUnwrapper" ref="pooledConnectionUnwrapper"/>
	</bean>

	<bean id="multiQueryAppointmentQueryStrategy" class="gov.va.med.cds.integration.VistaStoredProcedureQueryTimeoutBasedQueryStrategy">
		<property name="templateTimeoutMap" ref="templateTimeoutMap"/>
		<property name="modelAssembler" ref="appointmentsModelAssembler"/>
		<property name="queryPlanMap">
			<map>
				<entry key="appointments"><!-- DomainEntryPoint -->
					<bean class="gov.va.med.cds.persistence.QueryAssociationMetaData">
						<property name="filterModelName" value="appointment"/>
						<property name="associationParent" value="appointments"/>
						<property name="associationName" value="appointments"/>
						<property name="key" value="recordIdentifier"/>
					</bean>
				</entry>
			</map>
		</property>
		<property name="vistaResponseStrategy" ref="vrmVistaResponseStrategy"/>
		<property name="queryMap" ref="vistaStoredProcedureQueryMap"/>
		<property name="applicationName" ref="pathwaysAppName"/>
		<property name="parameterTransformerMap" ref="vistaParameterTransformerMap"/>
		<property name="pooledConnectionUnwrapper" ref="pooledConnectionUnwrapper"/>
	</bean>
	

	<bean id="multiQueryGenericObservationQueryStrategy" class="gov.va.med.cds.integration.VistaGenericStoredProcedureQueryTimeoutBasedQueryStrategy">
		<property name="templateTimeoutMap" ref="templateTimeoutMap"/>
		<property name="modelAssembler" ref="genericObservationModelAssembler"/>
		<property name="queryPlanMap">
			<map>
				<entry key="genericObservations"><!-- DomainEntryPoint -->
					<bean class="gov.va.med.cds.persistence.QueryAssociationMetaData">
						<property name="filterModelName" value="genericObservation"/>
						<property name="associationParent" value="genericObservations"/>
						<property name="associationName" value="genericObservations"/>
						<property name="key" value="recordIdentifier"/>
					</bean>
				</entry>
			</map>
		</property>
		<property name="vistaGenericResponseStrategy" ref="vistaGenericResponseStrategy"/>
		<property name="queryMap" ref="vistaStoredProcedureQueryMap"/>
		<property name="applicationName" ref="cdsAppName"/>
		<property name="parameterTransformerMap" ref="vistaParameterTransformerMap"/>
		<property name="pooledConnectionUnwrapper" ref="pooledConnectionUnwrapper"/>
		<property name="username" value="${cache.gsp.username}"/>
		<property name="password" value="${cache.gsp.password}"/>
		<property name="rpcName" value="RPC|Run|VPR GET PATIENT DATA JSON"/>
	</bean>



	<bean id="vistaGenericResponseStrategy" class="gov.va.med.cds.response.strategy.VistaGenericStoredProcedureSingleResponseStrategy">
<!-- 		<property name="refXmlMap"> -->
<!-- 			<map> -->
<!-- 				<entry key="GenericObservation-GenericObservationRead1" value-ref="genericObservationRefXml"/> -->
<!-- 			</map> -->
<!-- 		</property> -->
	</bean>



	<bean id="appointmentRefXml" class="org.springframework.core.io.ClassPathResource">
		<constructor-arg index="0" type="java.lang.String" value="resources/rpcmappings/vrm/AppointmentsRead1.xml"/>
	</bean>

	<bean id="examRequestRefXml" class="org.springframework.core.io.ClassPathResource">
		<constructor-arg index="0" type="java.lang.String" value="resources/rpcmappings/vrm/ExamRequestRead1.xml"/>
	</bean>

	<bean id="exam1RefXml" class="org.springframework.core.io.ClassPathResource">
		<constructor-arg index="0" type="java.lang.String" value="resources/rpcmappings/vrm/ExamRead1.xml"/>
	</bean>

	<bean id="exam2RefXml" class="org.springframework.core.io.ClassPathResource">
		<constructor-arg index="0" type="java.lang.String" value="resources/rpcmappings/vrm/ExamRead2.xml"/>
	</bean>

	<bean id="genericObservationRefXml" class="org.springframework.core.io.ClassPathResource">
		<constructor-arg index="0" type="java.lang.String" value="resources/rpcmappings/generic/GenericObservationRead1.xml"/>
	</bean>
	
	<util:map id="vistaStoredProcedureQueryMap">
		<!-- Appointments -->
		<entry key="AppointmentsRead1.Appointment.appointments" value="call VISTA.HDSREPDevPause_setPause(?);"/>
		<entry key="AppointmentsRead1.Appointment.appointments.date" value="call VISTA.HDSREPDevPause_setPause(?);"/>
		<entry key="AppointmentsRead1.Appointment.appointments.date.appointmentStatus" value="call VISTA.HDSREPDevPause_setPause(?);"/>
		<entry key="AppointmentsRead1.Appointment.appointments.appointmentStatus" value="call VISTA.HDSREPDevPause_setPause(?);"/>

		<!-- Exam Requests -->
		<entry key="RequestsAndExamsRead1.ExamRequest2507.examRequests" value="call VISTA.HDSREPDevPause_setPause(?);"/>
		<entry key="RequestsAndExamsRead1.ExamRequest2507.examRequests.requestStatus" value="call VISTA.HDSREPDevPause_setPause(?);"/>
		<entry key="RequestsAndExamsRead1.ExamRequest2507.examRequests.date" value="call VISTA.HDSREPDevPause_setPause(?);"/>
		<entry key="RequestsAndExamsRead1.ExamRequest2507.examRequests.date.requestStatus" value="call VISTA.HDSREPDevPause_setPause(?);"/>

		<entry key="RequestsAndExamsRead2.ExamRequest2507.examRequests" value="call VISTA.HDSREPDevPause_setPause(?);"/>
		<entry key="RequestsAndExamsRead2.ExamRequest2507.examRequests.requestStatus" value="call VISTA.HDSREPDevPause_setPause(?);"/>
		<entry key="RequestsAndExamsRead2.ExamRequest2507.examRequests.date" value="call VISTA.HDSREPDevPause_setPause(?);"/>
		<entry key="RequestsAndExamsRead2.ExamRequest2507.examRequests.date.requestStatus" value="call VISTA.HDSREPDevPause_setPause(?);"/>

		<!-- Exams -->
		<entry key="RequestsAndExamsRead1.Exam2507.exams" value="call VISTA.HDSREPDevPause_setPause(?);"/>
		<entry key="RequestsAndExamsRead1.Exam2507.exams.status" value="call VISTA.HDSREPDevPause_setPause(?);"/>
		<entry key="RequestsAndExamsRead1.Exam2507.exams.date" value="call VISTA.HDSREPDevPause_setPause(?);"/>
		<entry key="RequestsAndExamsRead1.Exam2507.exams.date.status" value="call VISTA.HDSREPDevPause_setPause(?);"/>
		
		<entry key="RequestsAndExamsRead2.Exam2507.exams" value="call VISTA.HDSREPDevPause_setPause(?);"/>
		<entry key="RequestsAndExamsRead2.Exam2507.exams.status" value="call VISTA.HDSREPDevPause_setPause(?);"/>
		<entry key="RequestsAndExamsRead2.Exam2507.exams.date" value="call VISTA.HDSREPDevPause_setPause(?);"/>
		<entry key="RequestsAndExamsRead2.Exam2507.exams.date.status" value="call VISTA.HDSREPDevPause_setPause(?);"/>
		
		<entry key="GenericObservationRead1.GSP" value="call VISTA.HDSREPDevPause_setPause(?);"/>
	</util:map>


	<util:list id="defaultVistaRules">
		<bean class="gov.va.med.cds.rules.DomainEntryPointRule">
			<property name="entryPoint" value="AllergyAssessment"/>
		</bean>
		<bean class="gov.va.med.cds.rules.DomainEntryPointRule">
			<property name="entryPoint" value="IntoleranceCondition"/>
		</bean>
		<bean class="gov.va.med.cds.rules.DomainEntryPointRule">
			<property name="entryPoint" value="ClinicalDocumentEvent"/>
		</bean>
		<bean class="gov.va.med.cds.rules.DomainEntryPointRule">
			<property name="entryPoint" value="VitalSignObservationEvent"/>
		</bean>
		<!-- 
		<bean class="gov.va.med.cds.rules.DomainEntryPointRule">
			<property name="entryPoint" value="LabTestPromise"/>
		</bean>
		 -->
		<bean class="gov.va.med.cds.rules.DomainEntryPointRule">
			<property name="entryPoint" value="NonVaMedicationEvent"/>
		</bean>
		<bean class="gov.va.med.cds.rules.DomainEntryPointRule">
			<property name="entryPoint" value="SkinTestProcedure"/>
		</bean>
		<bean class="gov.va.med.cds.rules.DomainEntryPointRule">
			<property name="entryPoint" value="ImmunizationEvent"/>
		</bean>
		<bean class="gov.va.med.cds.rules.DomainEntryPointRule">
			<property name="entryPoint" value="HealthConcern"/>
		</bean>
		<bean class="gov.va.med.cds.rules.DomainEntryPointRule">
			<property name="entryPoint" value="ExamRequest2507"/>
		</bean>
		<bean class="gov.va.med.cds.rules.DomainEntryPointRule">
			<property name="entryPoint" value="Exam2507"/>
		</bean>
		<bean class="gov.va.med.cds.rules.DomainEntryPointRule">
			<property name="entryPoint" value="Appointment"/>
		</bean>
		<bean class="gov.va.med.cds.rules.DomainEntryPointRule">
			<property name="entryPoint" value="OutpatientMedicationPromise"/>
		</bean>
		<bean class="gov.va.med.cds.rules.DomainEntryPointRule">
			<property name="entryPoint" value="GenericObservation"/>
		</bean>
	</util:list>

	<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean" lazy-init="false">
		<property name="staticMethod" value="gov.va.med.cds.persistence.hibernate.common.VistaTimeZoneOffset.setFacilityIdTimeZoneMap"/>
		<property name="arguments">
			<list>
				<ref bean="facilityIdTimeZoneMap"/>
			</list>
		</property>
	</bean>

	<util:map id="facilityIdTimeZoneMap" map-class="java.util.HashMap">
		<entry key="521" value="US/Central"/>
		<entry key="619" value="US/Central"/>
		<entry key="679" value="US/Central"/>
		<entry key="463" value="AST"/>
		<entry key="644" value="America/Phoenix"/>
		<entry key="649" value="America/Phoenix"/>
		<entry key="678" value="America/Phoenix"/>
		<entry key="564" value="US/Eastern"/>
		<entry key="598" value="US/Central"/>
		<entry key="570" value="US/Pacific"/>
		<entry key="605" value="US/Pacific"/>
		<entry key="600" value="US/Pacific"/>
		<entry key="612" value="US/Pacific"/>
		<entry key="640" value="US/Pacific"/>
		<entry key="664" value="US/Pacific"/>
		<entry key="662" value="US/Pacific"/>
		<entry key="691" value="US/Pacific"/>
		<entry key="554" value="US/Mountain"/>
		<entry key="575" value="US/Mountain"/>
		<entry key="689" value="US/Eastern"/>
		<entry key="460" value="US/Eastern"/>
		<entry key="516" value="US/Eastern"/>
		<entry key="546" value="US/Eastern"/>
		<entry key="573" value="US/Eastern"/>
		<entry key="673" value="US/Eastern"/>
		<entry key="548" value="US/Eastern"/>
		<entry key="508" value="US/Eastern"/>
		<entry key="509" value="US/Eastern"/>
		<entry key="557" value="US/Eastern"/>
		<entry key="459" value="US/Aleutian"/>
		<entry key="531" value="US/Mountain"/>
		<entry key="537" value="US/Central"/>
		<entry key="550" value="US/Central"/>
		<entry key="578" value="US/Central"/>
		<entry key="556" value="US/Central"/>
		<entry key="610" value="US/Eastern"/>
		<entry key="583" value="US/Eastern"/>
		<entry key="596" value="US/Eastern"/>
		<entry key="603" value="US/Eastern"/>
		<entry key="502" value="US/Central"/>
		<entry key="629" value="US/Central"/>
		<entry key="667" value="US/Central"/>
		<entry key="402" value="US/Eastern"/>
		<entry key="512" value="US/Eastern"/>
		<entry key="518" value="US/Eastern"/>
		<entry key="523" value="US/Eastern"/>
		<entry key="631" value="US/Eastern"/>
		<entry key="506" value="US/Eastern"/>
		<entry key="515" value="US/Eastern"/>
		<entry key="553" value="US/Eastern"/>
		<entry key="585" value="US/Central"/>
		<entry key="655" value="US/Eastern"/>
		<entry key="618" value="US/Central"/>
		<entry key="656" value="US/Central"/>
		<entry key="520" value="US/Central"/>
		<entry key="586" value="US/Central"/>
		<entry key="589" value="US/Central"/>
		<entry key="657" value="US/Central"/>
		<entry key="436" value="US/Mountain"/>
		<entry key="636" value="US/Mountain"/>
		<entry key="593" value="US/Pacific"/>
		<entry key="654" value="US/Pacific"/>
		<entry key="608" value="US/Eastern"/>
		<entry key="561" value="US/Eastern"/>
		<entry key="501" value="US/Mountain"/>
		<entry key="526" value="US/Eastern"/>
		<entry key="620" value="US/Eastern"/>
		<entry key="632" value="US/Eastern"/>
		<entry key="630" value="US/Eastern"/>
		<entry key="528" value="US/Eastern"/>
		<entry key="637" value="US/Eastern"/>
		<entry key="558" value="US/Eastern"/>
		<entry key="565" value="US/Eastern"/>
		<entry key="659" value="US/Eastern"/>
		<entry key="437" value="US/Central"/>
		<entry key="538" value="US/Eastern"/>
		<entry key="539" value="US/Eastern"/>
		<entry key="541" value="US/Eastern"/>
		<entry key="757" value="US/Eastern"/>
		<entry key="552" value="US/Eastern"/>
		<entry key="623" value="US/Central"/>
		<entry key="635" value="US/Central"/>
		<entry key="648" value="US/Pacific"/>
		<entry key="653" value="US/Pacific"/>
		<entry key="692" value="US/Pacific"/>
		<entry key="503" value="US/Eastern"/>
		<entry key="529" value="US/Eastern"/>
		<entry key="542" value="US/Eastern"/>
		<entry key="562" value="US/Eastern"/>
		<entry key="595" value="US/Eastern"/>
		<entry key="642" value="US/Eastern"/>
		<entry key="646" value="US/Eastern"/>
		<entry key="693" value="US/Eastern"/>
		<entry key="650" value="US/Eastern"/>
		<entry key="534" value="US/Eastern"/>
		<entry key="544" value="US/Eastern"/>
		<entry key="568" value="US/Mountain"/>
		<entry key="438" value="US/Central"/>
		<entry key="614" value="US/Central"/>
		<entry key="621" value="US/Eastern"/>
		<entry key="626" value="US/Central"/>
		<entry key="504" value="US/Central"/>
		<entry key="519" value="US/Central"/>
		<entry key="674" value="US/Central"/>
		<entry key="549" value="US/Central"/>
		<entry key="756" value="US/Central"/>
		<entry key="580" value="US/Central"/>
		<entry key="671" value="US/Central"/>
		<entry key="660" value="US/Mountain"/>
		<entry key="405" value="US/Eastern"/>
		<entry key="590" value="US/Eastern"/>
		<entry key="652" value="US/Eastern"/>
		<entry key="658" value="US/Eastern"/>
		<entry key="663" value="US/Pacific"/>
		<entry key="668" value="US/Pacific"/>
		<entry key="687" value="US/Pacific"/>
		<entry key="517" value="US/Eastern"/>
		<entry key="540" value="US/Eastern"/>
		<entry key="581" value="US/Eastern"/>
		<entry key="613" value="US/Eastern"/>
		<entry key="607" value="US/Central"/>
		<entry key="695" value="US/Central"/>
		<entry key="676" value="US/Central"/>
		<entry key="442" value="US/Mountain"/>
		<entry key="666" value="US/Mountain"/>
		<entry key="688" value="US/Eastern"/>
		<entry key="358" value="Asia/Manila"/>
		<entry key="672" value="America/Puerto_Rico"/>
		<entry key="675" value="US/Eastern"/>
		<entry key="992" value="US/Mountain"/>
		<entry key="993" value="US/Mountain"/>
		<entry key="0" value="DNS .VITERION.CCURL        "/>
	</util:map>
</beans>
