FILE(FIXED) TO FILE(DELIMITED)

  • 배치 작업 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="MSmpFixedToDelimited*Btch"/>
        </base-package>
    </job-component>

    <!--
        * 배치작업 : FILE(FIXED) TO FILE(DELIMITED) 샘플
        * 배치스텝
            - JSmpFixedToDelimited100 : FILE(FIXED) TO FILE(DELIMITED) 샘플 초기화 처리
            - JSmpFixedToDelimited200 : FIXED 형식의 파일을 DELIMITED 형식의 파일로 Write 처리
     -->
    <job id="JSmpFixedToDelimited" xmlns="http://www.bankwareglobal.com/schema/batchex">
        <step id="JSmpFixedToDelimited100" next="JSmpFixedToDelimited200" parent="parentStep">
            <tasklet ref="MSmpFixedToDelimitedInitBtch"/>
        </step>
        <step id="JSmpFixedToDelimited200" parent="parentStep">
            <tasklet>
                <chunk reader="RJSmpFixedToDelimited200" processor="MSmpFixedToDelimitedBtch" writer="WJSmpFixedToDelimited200"/>
            </tasklet>
        </step>
    </job>


    <!--
        * 샘플용직원정보 Fixed File을 Read 하기위한 bean 설정
     -->
    <bean id="RJSmpFixedToDelimited200" parent="RFix" scope="step">
        <property name="resource" value="file:///data1/prod/bxm400/dat/fixed_file_#{jobParameters['oDate']}.txt" />
        <property name="encoding" value="UTF-8" />
        <property name="targetType" value="bxm.dft.smp.batch.bean.dto.MSmpFixedToDelimitedBtch01Dto" />
    </bean>

    <!--
        * 샘플용직원정보를 Delimited File로 Write 하기위한 bean 설정
     -->
    <bean id="WJSmpFixedToDelimited200" parent="WDelimit" scope="step">
        <property name="resource" value="file:///data1/prod/bxm400/dat/delimited_file_#{jobParameters['oDate']}.txt" />
        <property name="encoding" value="UTF-8" />
        <property name="delimiter" value=";"/>
        <property name="targetType" value="bxm.dft.smp.batch.bean.dto.MSmpFixedToDelimitedBtch01Dto" />
    </bean>
</beans>
  • 배치 소스코드 Sample

@BxmBean("MSmpFixedToDelimitedBtch")
@Scope("step")
@BxmCategory(logicalName = "FILE(FIXED) TO FILE(DELIMITED) 샘플")
public class MSmpFixedToDelimitedBtch
        implements ItemProcessor<MSmpFixedToDelimitedBtch01Dto, MSmpFixedToDelimitedBtch01Dto> {

    final Logger logger = LoggerFactory.getLogger(this.getClass());

    /**
     * process
     * - 처리 대상 데이터를 건 별로 업무요건에 따라 처리하는 역할을 수행한다.
     */
    @Override
    @BxmCategory(logicalName = "process : 샘플용 직원정보 처리")
    public MSmpFixedToDelimitedBtch01Dto process(MSmpFixedToDelimitedBtch01Dto in) throws Exception {
        MSmpFixedToDelimitedBtch01Dto out = null;

        /**
         * File Read한 데이터 확인
         */
        if (in.getFeduEmpNo() == 0 || in.getFeduDeptNo() == 0) {
            logger.warn("사원번호[{}], 부서번호[{}]가 유효하지 않습니다. Skip 처리합니다.",
                    new Object[] { in.getFeduEmpNo(), in.getFeduDeptNo() });
            return null;
        }

        /**
         * 개별 업무로직 수행
         * ...
         * ...
         */
        out = in;

        return out;
    }
}
SWLab Bankware Global
  • 전체
  • BXM
  • BXCM
  • BXCP
  • BXI
제품 선택 시 더 정확한 매뉴얼 가이드를 제공해드립니다.

Copyright© Bankwareglobal All Rights Reserved.