LentilleControleRemisePromoteurAssoLoadStepConfig.java
package com.sintia.ffl.admin.optique.services.batch.refpromoteur.load.promoteur;
import com.sintia.ffl.admin.optique.dal.entities.LentilleControleRemisePromoteurAsso;
import com.sintia.ffl.admin.optique.dal.repositories.LentilleControleRemisePromoteurAssoRepository;
import com.sintia.ffl.admin.staging.FileUtils;
import com.sintia.ffl.admin.staging.GenerericItemReadFromFile;
import com.sintia.ffl.admin.staging.StagingStepListener;
import com.sintia.ffl.admin.staging.step.imports.AbstractPromoteurImportStepConfig;
import com.sintia.ffl.adminui.commons.enums.TypeStaging;
import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.configuration.annotation.JobScope;
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
import org.springframework.batch.core.configuration.annotation.StepScope;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.io.IOException;
@Slf4j
@Configuration
public class LentilleControleRemisePromoteurAssoLoadStepConfig extends
AbstractPromoteurImportStepConfig<LentilleControleRemisePromoteurAsso, Integer, LentilleControleRemisePromoteurAssoRepository> {
public LentilleControleRemisePromoteurAssoLoadStepConfig(){
super(LentilleControleRemisePromoteurAsso.class, TypeStaging.REF_PROMOTEUR);
}
@Bean
@JobScope
public Step lentilleControleRemisePromoteurAssoLoadStep(StepBuilderFactory stepBuilderFactory,
LentilleControleRemisePromoteurAssoRepository lentilleControleRemisePromoteurAssoRepository, FileUtils fileUtils,
StagingStepListener<LentilleControleRemisePromoteurAsso, Integer> stepListener) throws IOException {
return super.buildStep(stepBuilderFactory, lentilleControleRemisePromoteurAssoRepository, fileUtils, stepListener);
}
@Bean("lentilleControleRemisePromoteurAssoItemReader")
@StepScope
@Override
public GenerericItemReadFromFile<LentilleControleRemisePromoteurAsso> reader(
FileUtils fileUtils,
@Value("#{jobParameters['envSource'] ?: 'pprod'}") String envSource,
@Value("#{jobParameters['envCible'] ?: 'pprod'}") String envCible,
@Value("#{jobParameters['codePromoteur']}") String codePromoteur
) throws IOException {
return super.buildReader(fileUtils, envSource, envCible, codePromoteur);
}
}