MultiType Read, Write

  • 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="MSmpMultiType*Btch"/>
        </base-package>
    </job-component>

    <!--
        * Batch job : Sample of RMultiType(FIXED) TO WMultiType(DELIMITED)
        * Batch step
            - JSmpMultiType100 : Sample of RMultiType(FIXED) TO WMultiType(DELIMITED)
     -->
    <job id="JSmpMultiType" xmlns="http://www.bankwareglobal.com/schema/batchex">
        <step id="JSmpMultiType100" parent="parentStep">
            <tasklet>
                <chunk reader="RJSmpMultiType100" processor="MSmpMultiTypeBtch" writer="WJSmpMultiType100"/>
            </tasklet>
        </step>
    </job>

 <!--
  * Bean configuration for reading a MultiType Fixed File
  -->
    <bean id="RJSmpMultiType100" parent="RMultiTypeFix" scope="step">
        <property name="resource" value="file:///data1/prod/bxm400/dat/input.txt" />
        <property name="encoding" value="UTF-8" />
        <property name="headerLine" value="1"/>
        <property name="footerLine" value="1"/>
        <property name="headerTargetType" value="bxm.dft.smp.batch.bean.dto.MSmpMultiTypeBtch02Dto"/>
  <property name="bodyTargetType" value="bxm.dft.smp.batch.bean.dto.MSmpMultiTypeBtch03Dto"/>
  <property name="footerTargetType" value="bxm.dft.smp.batch.bean.dto.MSmpMultiTypeBtch04Dto"/>
 </bean>

 <!--
  * Bean configuration for writing to a MultiType Delimited File
  -->
 <bean id="WJSmpMultiType100" parent="WMultiTypeDelimit" scope="step">
        <property name="resource" value="file:///data1/prod/bxm400/dat/output.txt" />
        <property name="encoding" value="UTF-8" />
        <property name="delimiter" value=";"/>
        <property name="targetType" value="bxm.dft.smp.batch.bean.dto.MSmpMultiTypeBtch01Dto" />
 </bean>
</beans>

*Batch source code Sample

@BxmBean("MSmpMultiTypeBtch")
@Scope("step")
@BxmCategory(logicalName = "RMultiTypeFix to WMultiTypeDelimit sample")
public class MSmpMultiTypeBtch implements ItemProcessor<IOmmObject, MSmpMultiTypeBtch01Dto> {
 final Logger logger = LoggerFactory.getLogger(this.getClass());
 /**
  * process
  * - Performs processing of target data per record according to business requirements.
  */
 @Override
 @BxmCategory(logicalName = "process : MultiType processing")
 public MSmpMultiTypeBtch01Dto process(IOmmObject in) throws Exception {
  MSmpMultiTypeBtch01Dto out = new MSmpMultiTypeBtch01Dto();
  MSmpMultiTypeBtch02Dto header = null;
  MSmpMultiTypeBtch03Dto body = null;
  MSmpMultiTypeBtch04Dto footer = null;
  if (in instanceof MSmpMultiTypeBtch02Dto) { // Header
   header = (MSmpMultiTypeBtch02Dto) in;
  } else if (in instanceof MSmpMultiTypeBtch03Dto) { // Body
   body = (MSmpMultiTypeBtch03Dto) in;
  } else if (in instanceof MSmpMultiTypeBtch04Dto) { // Footer
   footer = (MSmpMultiTypeBtch04Dto) in;
  }
  /**
   * Multi Type Out Dto processing
   * - Write processing of Multi Type is defined by including it in the Master DTO.
   * - For reference, this sample is configured to pass the read DTO directly to Write as-is.
   */
  if (header != null) {
   out.setHeader(header);
  }
  if (body != null) {
   out.setBody(body);
  }
  if (footer != null) {
   out.setFooter(footer);
  }
  return out;
 }
}
SWLab Bankware Global
  • 전체
  • BXM
  • BXCM
  • BXCP
  • BXI
제품 선택 시 더 정확한 매뉴얼 가이드를 제공해드립니다.

Copyright© Bankwareglobal All Rights Reserved.