<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns

="http://www.springframework.org/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schem...-beans-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schem...ng-aop-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
<bean parent="stepScope"/>
<bean parent="jobConfigurationRegistryBeanPostProcessor"/>
<bean class="org.springframework.beans.factory.config.Pr opertyPlaceholderConfigurer">
<property name="ignoreUnresolvablePlaceholders" value="false" />
</bean>
<bean id="ValorisationSupportJob" parent="simpleJob">
<property name="steps">
<list>
<bean id="Extraction" parent="simpleStep">
<property name="commitInterval" value="20000" />
<property name="saveRestartData" value="false" />
<property name="allowStartIfComplete" value="false"/>
<property name="tasklet">
<bean class="org.springframework.batch.execution.tasklet .RestartableItemProviderTasklet">
<property name="itemProvider" ref="DBItemProvider" />
<property name="itemProcessor" ref="compositeItemProcessor"/>
</bean>
</property>
</bean>
<bean id="ValoriserSupport" parent="simpleStep">
<property name="saveRestartData" value="true" />
<property name="commitInterval" value="10000" />
<property name="allowStartIfComplete" value="false"/>
<property name="tasklet">
<bean class="org.springframework.batch.execution.tasklet .RestartableItemProviderTasklet">
<property name="itemProvider" ref="idContratProvider"/>
<property name="itemProcessor" ref="DBItemProcessor"/>
</bean>
</property>
</bean>
</list>
</property>
</bean>
<!-- INFRASTRUCTURE SETUP -->
<!-- provider -->
<bean id="DBItemProvider" class="com.natixis.sphinx.batch.provider.DBItemPro vider">
<property name="dataSource" ref="dataSource" />
<property name="sql">
<value>
SELECT C2.CESEQO "CONTRAT", S2.CESEQO "SUPPORT", SUM(M2.AMOUNT) "AMOUNT",S2.COTAUX,T2.VALCOT,S2.NBPART
FROM SPHMCONTRAT C2,
SPHMMVT M2,
SANDSUPPORT S2,
SPHMTYPESUPPORT T2,
SPHMPERIODICITEMVT P2,
SPHMETATCONTRAT E2
WHERE C2.CESEQO = M2.COCONT
AND C2.CESEQO = S2.COCONT
AND C2.COETCO = E2.CESEQO
AND M2.COPERI = P2.CESEQO
AND T2.CESEQO = S2.COSUPP
AND M2.DATEFF <= TO_DATE( ${batch.dateEffet},'DD/MM/YYYY')
AND P2.LINUT1 = 'Mensuel'
AND E2.LINUT1 IN ('Actif','Actif Période gratuite')
GROUP BY C2.CESEQO, S2.CESEQO, S2.COTAUX, S2.NBPART, T2.VALCOT
ORDER BY C2.CESEQO, S2.CESEQO
</value>
</property>
<property name="mapper">
<bean class="com.natixis.sphinx.batch.modele.mapping.Ver sementRowMapper" />
</property>
</bean>
<bean id="idContratProvider" class="org.springframework.batch.item.provider.Inp utSourceItemProvider">
<property name="inputSource" ref="fileInputSource"/>
</bean>
<!-- processor -->
<bean id="compositeItemProcessor" class="org.springframework.batch.item.processor.Co mpositeItemProcessor">
<property name="itemProcessors">
<list>
<bean id="fileSupportItemProcessor" class="org.springframework.batch.item.processor.It emWriterItemProcessor">
<property name="itemWriter" ref="fileVersementItemWriter"/>
</bean>
<bean id="fileContratItemProcessor" class="org.springframework.batch.item.processor.It emWriterItemProcessor">
<property name="itemWriter" ref="fileContratItemWriter"/>
</bean>
</list>
</property>
</bean>
<bean id="DBItemProcessor" class="org.springframework.batch.item.processor.It emWriterItemProcessor">
<property name="itemWriter" ref="sqlSupportDao"/>
</bean>
<!-- Dao contenant la requete d'update -->
<bean id="sqlSupportDao" class="com.natixis.sphinx.batch.modele.dao.SqlSupp ortDao">
<property name="jdbcTemplate" ref="jdbcTemplate"/>
</bean>
<!-- file input source -->
<bean id="fileInputSource" class="org.springframework.batch.io.file.support.D efaultFlatFileInputSource">
<property name="fieldSetMapper">
<bean class="com.natixis.sphinx.batch.modele.mapping.Con tratFieldSetMapper"/>
</property>
<property name="resource" ref="resourceSortie2"/>
<property name="tokenizer" ref="delimitedFileDescriptor"/>
</bean>
<!-- tokenizer -->
<bean id="delimitedFileDescriptor" class="org.springframework.batch.io.file.support.t ransform.DelimitedLineTokenizer">
<property name="names" value="num, contrat"/>
<property name="delimiter" value=";" />
</bean>
<!-- writer -->
<bean id="fileVersementItemWriter" class="com.natixis.sphinx.batch.modele.dao.Verseme ntFileWriter">
<property name="resource" ref="resourceSortie1" />
<property name="shouldDeleteIfExists" value="true"/>
<property name="delimiter" value=";"/>
</bean>
<bean id="fileContratItemWriter" class="com.natixis.sphinx.batch.modele.dao.Contrat FileWriter">
<property name="resource" ref="resourceSortie2" />
<property name="shouldDeleteIfExists" value="true"/>
<property name="delimiter" value=";"/>
</bean>
<!-- context -->
<bean id="mapContext" class="com.natixis.sphinx.batch.domain.Context">
<property name="map">
<map>
<entry key="resourceSortie1" value-ref="resourceSortie1"/>
<entry key="resourceSortie2" value-ref="resourceSortie2"/>
<entry key="dataSource" value-ref="dataSource"/>
</map>
</property>
</bean>
<bean id="resourceSortie1" class="java.lang.String">
<constructor-arg value="file:data/output/${batch.scheduleDate}.Versement.txt"/>
</bean>
<bean id="resourceSortie2" class="java.lang.String">
<constructor-arg value="file:data/input/${batch.scheduleDate}.Contrat.txt"/>
</bean>
<!-- register the step scope with the application context -->
<bean class="org.springframework.batch.execution.scope.S tepScope" />
</beans>