SupplementVerreIteStepConfig.java

package com.sintia.ffl.admin.optique.services.batch.refpromoteur.export.ite;

import com.sintia.ffl.admin.optique.dal.entities.SupplementVerreIte;
import com.sintia.ffl.admin.optique.dal.repositories.SupplementVerreIteRepository;
import com.sintia.ffl.admin.staging.FileUtils;
import com.sintia.ffl.admin.staging.step.export.AbstractSinglePromoteurExportStepConfig;
import com.sintia.ffl.adminui.commons.enums.TypeStaging;
import com.sintia.ffl.core.commons.enums.CodePromoteur;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
import org.springframework.batch.core.configuration.annotation.StepScope;
import org.springframework.batch.integration.async.AsyncItemWriter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.IOException;

@Configuration
public class SupplementVerreIteStepConfig extends
        AbstractSinglePromoteurExportStepConfig<SupplementVerreIte, Integer, SupplementVerreIteRepository> {
    
    public SupplementVerreIteStepConfig(){
        super(TypeStaging.REF_PROMOTEUR, CodePromoteur.ITE);
    }
    
    @Bean
    public Step supplementVerreIteStep(StepBuilderFactory stepBuilderFactory, FileUtils fileUtils, SupplementVerreIteRepository supplementVerreIteRepository) throws IOException {
        return super.buildStep(stepBuilderFactory, supplementVerreIteRepository, fileUtils);
    }
    
    @Bean("supplementVerreIteWriter")
    @StepScope
    @Override
    public AsyncItemWriter<SupplementVerreIte> writer(
            FileUtils fileUtils,
            @Value("#{jobParameters['envSource'] ?: 'pprod'}") String envSource,
            @Value("#{jobParameters['envCible'] ?: 'pprod'}") String envCible,
            @Value("#{jobParameters['codePromoteur']}") String codePromoteur
    ) throws IOException {
        return super.buildWriter(fileUtils, envSource, envCible, codePromoteur);
    }
}