VARIABLE TO VARIABLE
-
Batch Job Xml Sample
<?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:batch-int="http://www.springframework.org/schema/batch-integration"
xsi:schemaLocation="http://www.bankwareglobal.com/schema/batchex http://www.bankwareglobal.com/schema/batchex/spring-batch-ex.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/batch-integration http://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd">
<import resource="classpath:JobConfig.xml"/>
<job-component xmlns="http://www.bankwareglobal.com/schema/batchex" id="jobcomp" with-dependon="true">
<base-package name="bxm.dft.smp.batch.bean">
<include name="MSmpVariableToVariable*Btch"/>
</base-package>
</job-component>
<!--
* Batch job : VARIABLE TO VARIABLE sample
* Batch step
- JSmpVariableToVariable100 : VARIABLE TO VARIABLE sample initialization process
- JSmpVariableToVariable200 : Read a string from a file and process it by writing as a string
-->
<job id="JSmpVariableToVariable" xmlns="http://www.bankwareglobal.com/schema/batchex">
<step id="JSmpVariableToVariable100" next="JSmpVariableToVariable200" parent="parentStep">
<tasklet ref="MSmpVariableToVariableInitBtch"/>
</step>
<step id="JSmpVariableToVariable200" parent="parentStep">
<tasklet>
<chunk reader="RJSmpVariableToVariable200" processor="MSmpVariableToVariableBtch" writer="WJSmpVariableToVariable200"/>
</tasklet>
</step>
</job>
<!--
* Bean configuration for reading sample employee information line by line as a string
-->
<bean id="RJSmpVariableToVariable200" parent="RVariable" scope="step">
<property name="name" value="RBSmpVariableToVariable200" />
<property name="resource" value="file:///data1/prod/bxm400/dat/rvariable_file_#{jobParameters['oDate']}.txt" />
<property name="encoding" value="UTF-8" />
</bean>
<!--
* Bean configuration for writing sample employee information line by line as a string
-->
<bean id="WJSmpVariableToVariable200" parent="WVariable" scope="step">
<property name="name" value="WBSmpVariableToVariable200" />
<property name="resource" value="file:///data1/prod/bxm400/dat/wvariable_file_#{jobParameters['oDate']}.txt" />
<property name="encoding" value="UTF-8" />
</bean>
</beans>
-
Batch Source Code Sample
@BxmBean("MSmpFixedToDelimitedBtch")
@Scope("step")
@BxmCategory(logicalName = "FILE(FIXED) TO FILE(DELIMITED) sample")
public class MSmpFixedToDelimitedBtch
implements ItemProcessor<MSmpFixedToDelimitedBtch01Dto, MSmpFixedToDelimitedBtch01Dto> {
final Logger logger = LoggerFactory.getLogger(this.getClass());
/**
* process
* - Performs processing of target data per record according to business requirements.
*/
@Override
@BxmCategory(logicalName = "process : sample employee information processing")
public MSmpFixedToDelimitedBtch01Dto process(MSmpFixedToDelimitedBtch01Dto in) throws Exception {
MSmpFixedToDelimitedBtch01Dto out = null;
/**
* Check data read from file
*/
if (in.getFeduEmpNo() == 0 || in.getFeduDeptNo() == 0) {
logger.warn("Employee number[{}], department number[{}] are not valid. Skip processing.",
new Object[] { in.getFeduEmpNo(), in.getFeduDeptNo() });
return null;
}
/**
* Execute individual business logic
* ...
* ...
*/
out = in;
return out;
}
}