ModePaiementStepConfig.java

  1. package com.sintia.ffl.admin.audio.services.batch.refcommun.export;

  2. import com.sintia.ffl.admin.audio.dal.entities.ModePaiement;
  3. import com.sintia.ffl.admin.audio.dal.repositories.ModePaiementRepository;
  4. import com.sintia.ffl.admin.staging.FileUtils;
  5. import com.sintia.ffl.admin.staging.step.export.AbstractCommunExportStepConfig;
  6. import com.sintia.ffl.adminui.commons.enums.TypeStaging;
  7. import org.springframework.batch.core.Step;
  8. import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
  9. import org.springframework.batch.core.configuration.annotation.StepScope;
  10. import org.springframework.batch.integration.async.AsyncItemWriter;
  11. import org.springframework.beans.factory.annotation.Value;
  12. import org.springframework.context.annotation.Bean;
  13. import org.springframework.context.annotation.Configuration;

  14. import java.io.IOException;

  15. @Configuration
  16. public class ModePaiementStepConfig extends AbstractCommunExportStepConfig<ModePaiement, Integer, ModePaiementRepository> {

  17.     public ModePaiementStepConfig(){
  18.         super(
  19.                 TypeStaging.REF_COMMUN
  20.         );
  21.     }

  22.     @Bean
  23.     public Step modePaiementStep(StepBuilderFactory stepBuilderFactory, ModePaiementRepository modePaiementRepository, FileUtils fileUtils) throws IOException {
  24.         return super.buildStep(stepBuilderFactory, fileUtils, modePaiementRepository);
  25.     }

  26.     @Bean("modePaiementWriter")
  27.     @StepScope
  28.     @Override
  29.     public AsyncItemWriter<ModePaiement> writer(
  30.             FileUtils fileUtils,
  31.             @Value("#{jobParameters['envSource'] ?: 'pprod'}") String envSource,
  32.             @Value("#{jobParameters['envCible'] ?: 'pprod'}") String envCible
  33.     ) throws IOException {
  34.         return super.buildWriter(fileUtils, envSource, envCible);
  35.     }

  36. }