<?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/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
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">
	<import resource="classpath:gov/va/med/cds/mediator/config/message-mediator-context.xml"/>
	<import resource="classpath:gov/va/med/cds/mediator/config/message-mediator-persistence-context.xml"/>
	
	<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>
		<property name="locations">
			<list>
				<value>file:${REP_ROOT}/mediator/resources/properties/mediator.properties</value>
			</list>
		</property>
	</bean>
	

	<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean" lazy-init="false">
		<property name="staticMethod" value="gov.va.med.cds.testharness.xml.XmlValidator.setTemplateCachePath" />
		<property name="arguments" value="${cds.test.templatecache}" />
	</bean>
	
	<bean id="xsltHelper" class="gov.va.med.cds.xml.transform.XsltHelper">
		<constructor-arg index="0" ref="xsltLocations"/>
		<constructor-arg index="1" ref="extensionFunctions"/>
	</bean>
	
	<util:list id="xsltLocations" value-type="java.lang.String">
		<value> file:./src/main/resources/xslts/vhim400/*.xsl</value>
		<value> file:./src/main/resources/xslts/vhim400/response/*.xsl</value>
		<value> file:./src/main/resources/xslts/vhim400/filter/*.xsl</value>
	</util:list>
	
	<util:list id="extensionFunctions" value-type="net.sf.saxon.lib.ExtensionFunctionDefinition">
		<bean class="gov.va.med.cds.mediator.xml.transform.saxonextensions.Hl7SupportMessageDataExtFunc"/>
		<bean class="gov.va.med.cds.mediator.xml.transform.saxonextensions.Hl7SupportCreateMessageDatetimeExtFunc"/>
		<bean class="gov.va.med.cds.mediator.xml.transform.saxonextensions.Hl7SupportMessageControlIdExtFunc"/>
		<bean class="gov.va.med.cds.mediator.xml.transform.saxonextensions.Hl7SupportRequestWhatCodeExtFunc"/>
		<bean class="gov.va.med.cds.mediator.xml.transform.saxonextensions.Hl7UtilityGetSendingFacilityExtFunc"/>
		<bean class="gov.va.med.cds.mediator.xml.transform.saxonextensions.AddCheckSumtoIcnExtFunc"/>
		<bean class="gov.va.med.cds.mediator.xml.transform.saxonextensions.WorkStateExceptionCountExtFunc"/>
		<bean class="gov.va.med.cds.mediator.xml.transform.saxonextensions.WorkStateFormattedExceptionDetailExtFunc"/>
		<bean class="gov.va.med.cds.mediator.xml.transform.saxonextensions.SurveyParseExtFunc"/>
	</util:list>
	
	
	<!--Start HL7Utility.createMessageControlId( )configuration settings -->
	<bean id="hl7Utility" class="gov.va.med.cds.hapi.HL7Utility">
		<property name="jdbcTemplateForMessageControlId" ref="jdbcTemplateForMessageControlId"/>
		<property name ="facilityIdMap" ref="facilityIdMap"/>
	</bean>
	<bean id="jdbcTemplateForMessageControlId" class="org.springframework.jdbc.core.JdbcTemplate">
		<property name="dataSource" ref="hdr2DataSourceForMessageControlIdGeneration"/>
	</bean>
	<bean id="hdr2DataSourceForMessageControlIdGeneration" class="org.apache.commons.dbcp2.BasicDataSource"
		destroy-method="close">
		<property name="driverClassName" value="oracle.jdbc.OracleDriver"/>
		<property name="url" value="${cds.jdbc.url}"/>
		<property name="username" value="${cds.jdbc.username}"/>
		<property name="password" value="${cds.jdbc.password}"/>
		<property name="defaultAutoCommit" value="true"/>
	</bean>
	<!--End HL7Utility.createMessageControlId( )configuration settings -->
	
	<bean id="hdrDataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
		<property name="driverClassName" value="oracle.jdbc.OracleDriver"/>
		<property name="url" value="${cds.jdbc.url}"/>
		<property name="username" value="${cds.jdbc.username}"/>
		<property name="password" value="${cds.jdbc.password}"/>
		<property name="defaultAutoCommit" value="false"/>
	</bean>
	
	<bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean" lazy-init="false">
		<property name="locateExistingServerIfPossible" value="true"/>
	</bean>
	
	<bean id="clinicalDataServiceFactory" class="gov.va.med.cds.mediator.work.cds.MockClinicalDataServiceFactory"
		lazy-init="true"/>
	
	<bean id="cdsServiceExt" factory-bean="clinicalDataServiceFactory" factory-method="create" lazy-init="true"/>
	
	<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean" lazy-init="false">
		<property name="staticMethod" value="gov.va.med.cds.testharness.xml.XmlValidator.setTemplateCachePath" />
		<property name="arguments" value="${cds.test.templatecache}" />
	</bean>
	
	<bean id="auditLogPersistenceManager" class="gov.va.med.cds.audit.persistence.hibernate.HibernateAuditLogPersistenceManager">
		<property name="appName" value="CDS3" />
		<property name="hibernateTemplate" ref="auditLogHibernateTemplate"/>
	</bean>
	
	<bean id="auditLogSessionFactory"
        class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
        <property name="dataSource" ref="hdr2DataSourceForMessageControlIdGeneration" />
        <property name="mappingResources">
            <list>
                <value>gov/va/med/cds/audit/persistence/hibernate/CdsAuditClobStore.hbm.xml</value>
                <value>gov/va/med/cds/audit/persistence/hibernate/ClientMapping.hbm.xml</value>
                <value>gov/va/med/cds/audit/persistence/hibernate/FilterId.hbm.xml</value>
                <value>gov/va/med/cds/audit/persistence/hibernate/LegacyReadAuditLog.hbm.xml</value>
                <value>gov/va/med/cds/audit/persistence/hibernate/VhimReadAuditLog.hbm.xml</value>
				<value>gov/va/med/cds/audit/persistence/hibernate/TemplateId.hbm.xml</value>
            </list>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
                <prop key="hibernate.show_sql">false</prop>
            </props>
        </property>
    </bean>
    <bean id="auditLogHibernateTemplate" class="org.springframework.orm.hibernate4.HibernateTemplate">
        <property name="sessionFactory" ref="auditLogSessionFactory" />
    </bean>
    <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>