RemiseMontureScsStepConfig.java
package com.sintia.ffl.admin.optique.services.batch.refpromoteur.export.scs;
import com.sintia.ffl.admin.optique.dal.entities.RemiseMontureScs;
import com.sintia.ffl.admin.optique.dal.repositories.RemiseMontureScsRepository;
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 RemiseMontureScsStepConfig extends
AbstractSinglePromoteurExportStepConfig<RemiseMontureScs, Integer, RemiseMontureScsRepository> {
public RemiseMontureScsStepConfig(){
super(TypeStaging.REF_PROMOTEUR, CodePromoteur.SCS);
}
@Bean
public Step remiseMontureScsStep(StepBuilderFactory stepBuilderFactory, FileUtils fileUtils, RemiseMontureScsRepository remiseMontureScsRepository) throws IOException {
return super.buildStep(stepBuilderFactory, remiseMontureScsRepository, fileUtils);
}
@Bean("remiseMontureScsWriter")
@StepScope
@Override
public AsyncItemWriter<RemiseMontureScs> 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);
}
}