<?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-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">


	<bean id="exceptionWorkflowFactory"
		class="gov.va.med.cds.mediator.work.MockExceptionWorkFlowFactory"
		lazy-init="true" />

	<bean id="registerHL7SupportWork"
		factory-bean="exceptionWorkflowFactory"
		factory-method="createRegisterHL7SupportWork" lazy-init="true" />

	<bean id="registerHL7DataWithWorkStateWork"
		factory-bean="exceptionWorkflowFactory"
		factory-method="createRegisterHL7DataWithWorkStateWork"
		lazy-init="true" />

	<bean id="workFlow"
		class="gov.va.med.cds.mediator.work.RequestResponseWorkFlow">
		<property name="wsnInputMessage" value="INPUT-MESSAGE" />
		<property name="wsnOutputMessage" value="OUTPUT-MESSAGE" />
		<property name="work">
			<list>

				<!-- Work responsible for creating and registering the HL7 Support instance in the Work State. -->
				<ref bean="registerHL7SupportWork" />

				<ref bean="registerHL7DataWithWorkStateWork" />

				<!-- Work responsible for determining whether the incoming request is for a read or a write. -->
				<bean
					class="gov.va.med.cds.mediator.work.StringComparisonConditionalForkingWorkFlow">
					<property name="comparisonType" value="ENDS_WITH" />
					<property name="compareWithString" value="SENDER" />
					<property name="wsnWorkStateToCompare"
						value="SENDING-APPLICATION" />
					<property name="trueFork">
						<list>
							<!--  Read work controller. -->

							<!-- Work responsible for converting the HL7-XML into FILTER XML and storing it in the Work State. -->
							<ref bean="hl7XmlToFilterXmlWork" />

							<!-- Read work controller. -->
							<ref bean="clinicalDataReadMessageWork" />

							<!-- Transform Read response back to ER7 encoded HL7 for legacy clients. -->
							<ref bean="vhimXmlReadResponseToHl7Er7Work" />

						</list>
					</property>
					<property name="falseFork">
						<list>
							<!-- Write work controller. -->

							<!-- Work responsible for converting the HL7-XML into VHIM and storing it in the Work State. -->
							<ref bean="hL7XmlToVhimCreateXmlWork" />

							<!-- Call CDS to create the clinical data. -->
							<ref bean="clinicalDataCreateMessageWork" />

							<!-- Transform write ack response back to an ER7 encoded Ack for legacy clients. -->
							<ref bean="vhimXmlWriteAckToEr7Work" />

						</list>
					</property>
				</bean>
			</list>
		</property>
	</bean>

	<bean id="hL7XmlToVhimCreateXmlWork"
		factory-bean="exceptionWorkflowFactory"
		factory-method="createHL7XmlToVhimCreateXmlWork" lazy-init="true" />

	<bean id="hL7XmlToFilterXmlWork"
		factory-bean="exceptionWorkflowFactory"
		factory-method="createHL7XmlToFilterXmlWork" lazy-init="true" />

	<bean id="clinicalDataCreateMessageWork"
		factory-bean="exceptionWorkflowFactory"
		factory-method="createClinicalDataCreateMessageWork" lazy-init="true" />

	<bean id="clinicalDataReadMessageWork"
		factory-bean="exceptionWorkflowFactory"
		factory-method="createClinicalDataReadMessageWork" lazy-init="true" />

	<bean id="vhimXmlReadResponseToHl7Er7Work"
		factory-bean="exceptionWorkflowFactory"
		factory-method="createVhimXmlReadResponseToHl7Er7Work"
		lazy-init="true" />

	<bean id="vhimXmlWriteAckToEr7Work"
		class="gov.va.med.cds.mediator.work.ApplicationAcknowledgementWork">
		<property name="wsnHl7Support" value="HL7-SUPPORT" />
		<property name="clientProxiesMap" ref="clientProxiesMap" />
	</bean>

	<bean id="messageMediator"
		class="gov.va.med.cds.mediator.MessageMediator">
		<property name="messageProcessor" ref="workFlow" />
	</bean>

	<util:map id="sendingApplicationToTemplateInfoMap">
		<entry key="HDRPRES">
			<bean
				class="gov.va.med.cds.mediator.work.TemplateInformation">
				<property name="stylesheet" value="HL7ToPharmacy.xsl" />
				<property name="templateName"
					value="PharmacyCreateOrUpdate40060" />
			</bean>
		</entry>
		<entry key="HDRPREF">
			<bean
				class="gov.va.med.cds.mediator.work.TemplateInformation">
				<property name="stylesheet" value="HL7ToPharmacy.xsl" />
				<property name="templateName"
					value="PharmacyCreateOrUpdate40060" />
			</bean>
		</entry>
		<entry key="HDRPPAR">
			<bean
				class="gov.va.med.cds.mediator.work.TemplateInformation">
				<property name="stylesheet" value="HL7ToPharmacy.xsl" />
				<property name="templateName"
					value="PharmacyCreateOrUpdate40060" />
			</bean>
		</entry>
		<entry key="HDRVTLS">
			<bean
				class="gov.va.med.cds.mediator.work.TemplateInformation">
				<property name="stylesheet" value="HL7ToVitalSigns.xsl" />
				<property name="templateName"
					value="VitalsignsCreateOrUpdate40060" />
			</bean>
		</entry>
		<entry key="HDRALGY">
			<bean
				class="gov.va.med.cds.mediator.work.TemplateInformation">
				<property name="stylesheet"
					value="HL7ToAllergyIntoleranceCondition.xsl" />
				<property name="templateName"
					value="IntoleranceConditionCreateOrUpdate40060" />
			</bean>
		</entry>
		<entry key="HDRADAS">
			<bean
				class="gov.va.med.cds.mediator.work.TemplateInformation">
				<property name="stylesheet"
					value="HL7ToAllergyAssement.xsl" />
				<property name="templateName"
					value="AllergyAssessmentCreateOrUpdate40060" />
			</bean>
		</entry>
		<entry key="HDRVTLS-HTH">
			<bean
				class="gov.va.med.cds.mediator.work.TemplateInformation">
				<property name="stylesheet" value="HL7ToHTH.xsl" />
				<property name="templateName"
					value="VitalsignsCreateOrUpdate40060" />
			</bean>
		</entry>
		<entry key="LAB">
			<bean
				class="gov.va.med.cds.mediator.work.TemplateInformation">
				<property name="stylesheet" value="HL7toLab.xsl" />
				<property name="templateName"
					value="LabCreateOrUpdate40060" />
			</bean>
		</entry>
	</util:map>


	<util:map id="whatCodeToFilterInformationMap">
		<entry key="CHDR_ALGY">
			<bean
				class="gov.va.med.cds.mediator.work.FilterInformation">
				<property name="filterId"
					value="CHDR_ALLERGY_SINGLE_PATIENT_FILTER" />
				<property name="templateId"
					value="IntoleranceConditionRead40010" />
				<property name="hl7ToVhimFilterTransform"
					value="ChdrAllergySinglePatientFilter.xsl" />
				<property name="responseFormatter"
					ref="chdrAllergyBatchResponseFormatter" />
			</bean>
		</entry>
		<entry key="CHDR_RXOP">
			<bean
				class="gov.va.med.cds.mediator.work.FilterInformation">
				<property name="filterId"
					value="CHDR_RX_SINGLE_PATIENT_FILTER" />
				<property name="templateId" value="PharmacyRead40010" />
				<property name="hl7ToVhimFilterTransform"
					value="ChdrRxSinglePatientFilter.xsl" />
				<property name="responseFormatter"
					ref="chdrPharmacyBatchResponseFormatter" />
			</bean>
		</entry>
	</util:map>

	<bean id="chdrAllergyBatchResponseFormatter"
		class="gov.va.med.cds.mediator.formatter.ChdrBatchResponseFormatter">
		<property name="stylesheet"
			value="VHIMIntoleranceConditionToHL7.xsl" />
		<property name="xsltHelper" ref="xsltHelper" />
	</bean>

	<bean id="chdrPharmacyBatchResponseFormatter"
		class="gov.va.med.cds.mediator.formatter.ChdrBatchResponseFormatter">
		<property name="stylesheet" value="VHIMPharmacyToHL7.xsl" />
		<property name="xsltHelper" ref="xsltHelper" />
	</bean>

	<util:map id="clientProxiesMap">
		<entry key="HDRVTLS-HTH" value-ref="dnsSocketProxy" />
	</util:map>

	<bean id="dnsSocketProxy"
		class="gov.va.med.cds.client.proxy.MllpDnsSocketBasedClientProxy">
	</bean>

	<bean id="springContextAccessor"
		class="gov.va.med.cds.mediator.config.SpringApplicationContextAccessorFactory"
		factory-method="getInstance" lazy-init="false" />

	<util:map id="facilityIdMap" map-class="java.util.HashMap">
		<entry key="521" value="BIRMINGHAMURL        " />
		<entry key="619" value="CENTRAL-ALABAMAURL        " />
		<entry key="679" value="TUSCALOOSAURL        " />
		<entry key="463" value="ANCHORAGEURL        " />
		<entry key="644" value="PHOENIXURL        " />
		<entry key="649" value="PRESCOTTURL        " />
		<entry key="678" value="TUCSONURL        " />
		<entry key="564" value="FAYETTVL-ARURL        " />
		<entry key="598" value="LITTLE-ROCKURL        " />
		<entry key="570" value="FRESNOURL        " />
		<entry key="605" value="LOMA-LINDAURL        " />
		<entry key="600" value="LONG-BEACHURL        " />
		<entry key="612" value="MARTINEZURL        " />
		<entry key="640" value="PALO-ALTOURL        " />
		<entry key="664" value="SAN-DIEGOURL        " />
		<entry key="662" value="SANFRANCISCOURL        " />
		<entry key="691" value="WEST-LAURL        " />
		<entry key="554" value="DENVERURL        " />
		<entry key="575" value="GRAND-JUNCTURL        " />
		<entry key="689" value="WEST-HAVENURL        " />
		<entry key="460" value="WILMINGTONURL        " />
		<entry key="516" value="BAY-PINESURL        " />
		<entry key="546" value="MIAMIURL        " />
		<entry key="573" value="NORTH-FLORIDAURL        " />
		<entry key="673" value="TAMPAURL        " />
		<entry key="548" value="WEST-PALMURL        " />
		<entry key="508" value="ATLANTAURL        " />
		<entry key="509" value="AUGUSTAURL        " />
		<entry key="557" value="DUBLINURL        " />
		<entry key="459" value="HONOLULUURL        " />
		<entry key="531" value="BOISEURL        " />
		<entry key="537" value="CHICAGO-WESTURL        " />
		<entry key="550" value="DANVILLEURL        " />
		<entry key="578" value="HINESURL        " />
		<entry key="556" value="N-CHICAGOURL        " />
		<entry key="610" value="NORTHERN-INDIANAURL        " />
		<entry key="583" value="INDIANAPOLISURL        " />
		<entry key="596" value="LEXINGTONURL        " />
		<entry key="603" value="LOUISVILLEURL        " />
		<entry key="502" value="ALEXANDRIAURL        " />
		<entry key="629" value="NEW-ORLEANSURL        " />
		<entry key="667" value="SHREVEPORTURL        " />
		<entry key="402" value="TOGUSURL        " />
		<entry key="512" value="BALTIMOREURL        " />
		<entry key="518" value="BEDFORD.VA.GOV" />
		<entry key="523" value="BOSTONURL        " />
		<entry key="631" value="NORTHAMPTONURL        " />
		<entry key="506" value="ANN-ARBORURL        " />
		<entry key="515" value="BATTLE-CREEKURL        " />
		<entry key="553" value="DETROITURL        " />
		<entry key="585" value="IRON-MTNURL        " />
		<entry key="655" value="SAGINAWURL        " />
		<entry key="618" value="MINNEAPOLISURL        " />
		<entry key="656" value="ST-CLOUDURL        " />
		<entry key="520" value="BILOXIURL        " />
		<entry key="586" value="JACKSONURL        " />
		<entry key="589" value="KANSAS-CITYURL        " />
		<entry key="657" value="ST-LOUISURL        " />
		<entry key="436" value="MONTANAURL        " />
		<entry key="636" value="CENTRAL-PLAINSURL        " />
		<entry key="593" value="LAS-VEGASURL        " />
		<entry key="654" value="RENOURL        " />
		<entry key="608" value="MANCHESTERURL        " />
		<entry key="561" value="EAST-ORANGEURL        " />
		<entry key="501" value="ALBUQUERQUEURL        " />
		<entry key="526" value="BRONXURL        " />
		<entry key="620" value="MONTROSEURL        " />
		<entry key="632" value="NORTHPORTURL        " />
		<entry key="630" value="NY-HARBORURL        " />
		<entry key="528" value="V02URL        " />
		<entry key="637" value="ASHEVILLEURL        " />
		<entry key="558" value="DURHAMURL        " />
		<entry key="565" value="FAYETTVL-NCURL        " />
		<entry key="659" value="SALISBURYURL        " />
		<entry key="437" value="FARGOURL        " />
		<entry key="538" value="CHILLICOTHEURL        " />
		<entry key="539" value="CINCINNATIURL        " />
		<entry key="541" value="CLEVELANDURL        " />
		<entry key="757" value="COLUMBUSURL        " />
		<entry key="552" value="DAYTONURL        " />
		<entry key="623" value="MUSKOGEEURL        " />
		<entry key="635" value="OKLAHOMAURL        " />
		<entry key="648" value="PORTLANDURL        " />
		<entry key="653" value="ROSEBURGURL        " />
		<entry key="692" value="WHITE-CITYURL        " />
		<entry key="503" value="ALTOONAURL        " />
		<entry key="529" value="BUTLERURL        " />
		<entry key="542" value="COATESVILLEURL        " />
		<entry key="562" value="ERIEURL        " />
		<entry key="595" value="LEBANONURL        " />
		<entry key="642" value="PHILADELPHIAURL        " />
		<entry key="646" value="PITTSBURGHURL        " />
		<entry key="693" value="WILKES-BARREURL        " />
		<entry key="650" value="PROVIDENCEURL        " />
		<entry key="534" value="CHARLESTONURL        " />
		<entry key="544" value="COLUMBIA-SCURL        " />
		<entry key="568" value="BLACK-HILLSURL        " />
		<entry key="438" value="SIOUX-FALLSURL        " />
		<entry key="614" value="MEMPHISURL        " />
		<entry key="621" value="MTN-HOMEURL        " />
		<entry key="626" value="TENNESSEEVALLEYURL        " />
		<entry key="504" value="AMARILLOURL        " />
		<entry key="519" value="BIG-SPRINGURL        " />
		<entry key="674" value="CENTRAL-TEXASURL        " />
		<entry key="549" value="DALLASURL        " />
		<entry key="756" value="EL-PASOURL        " />
		<entry key="580" value="HOUSTONURL        " />
		<entry key="671" value="SAN-ANTONIOURL        " />
		<entry key="660" value="SALT-LAKEURL        " />
		<entry key="405" value="WHITE-RIVERURL        " />
		<entry key="590" value="HAMPTONURL        " />
		<entry key="652" value="RICHMONDURL        " />
		<entry key="658" value="SALEMURL        " />
		<entry key="663" value="PUGET-SOUNDURL        " />
		<entry key="668" value="SPOKANEURL        " />
		<entry key="687" value="WALLA-WALLAURL        " />
		<entry key="517" value="BECKLEYURL        " />
		<entry key="540" value="CLARKSBURGURL        " />
		<entry key="581" value="HUNTINGTONURL        " />
		<entry key="613" value="MARTINSBURGURL        " />
		<entry key="607" value="MADISONURL        " />
		<entry key="695" value="MILWAUKEEURL        " />
		<entry key="676" value="TOMAHURL        " />
		<entry key="442" value="DNS ENNEURL        " />
		<entry key="666" value="SHERIDANURL        " />
		<entry key="688" value="WASHINGTONURL        " />
		<entry key="358" value="MANILAURL        " />
		<entry key="672" value="SAN-JUANURL        " />
		<entry key="675" value="ORLANDOURL        " />
		<entry key="0" value="DNS .VITERION.CCURL        " />
	</util:map>

</beans>
