SchemaDentaireStepConfig.java

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

  2. import com.sintia.ffl.admin.dentaire.dal.entities.SchemaDentaire;
  3. import com.sintia.ffl.admin.dentaire.dal.repositories.SchemaDentaireRepository;
  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 SchemaDentaireStepConfig extends
  17.         AbstractCommunExportStepConfig<SchemaDentaire, Integer, SchemaDentaireRepository> {
  18.    
  19.     public SchemaDentaireStepConfig(){
  20.         super(
  21.                 TypeStaging.REF_COMMUN
  22.         );
  23.     }
  24.    
  25.     @Bean
  26.     public Step schemaDentaireStep(StepBuilderFactory stepBuilderFactory, SchemaDentaireRepository schemaDentaireRepository,  FileUtils fileUtils) throws IOException {
  27.         return super.buildStep(stepBuilderFactory, fileUtils, schemaDentaireRepository);
  28.     }
  29.    
  30.     @Bean("schemaDentaireWriter")
  31.     @StepScope
  32.     @Override
  33.     public AsyncItemWriter<SchemaDentaire> writer(
  34.             FileUtils fileUtils,
  35.             @Value("#{jobParameters['envSource'] ?: 'pprod'}") String envSource,
  36.             @Value("#{jobParameters['envCible'] ?: 'pprod'}") String envCible
  37.     ) throws IOException {
  38.         return super.buildWriter(fileUtils, envSource, envCible);
  39.     }
  40.    
  41. }