EtatDemandeTiersPayantStepConfig.java

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

import com.sintia.ffl.admin.dentaire.dal.entities.EtatDemandeTiersPayant;
import com.sintia.ffl.admin.dentaire.dal.repositories.EtatDemandeTiersPayantRepository;
import com.sintia.ffl.admin.staging.FileUtils;
import com.sintia.ffl.admin.staging.step.export.AbstractCommunExportStepConfig;
import com.sintia.ffl.adminui.commons.enums.TypeStaging;
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 EtatDemandeTiersPayantStepConfig extends AbstractCommunExportStepConfig<EtatDemandeTiersPayant, Integer, EtatDemandeTiersPayantRepository> {
	
	public EtatDemandeTiersPayantStepConfig(){
		super(
				TypeStaging.REF_COMMUN
		);
	}
	
	@Bean
	public Step etatDemandeTiersPayantStep(StepBuilderFactory stepBuilderFactory, EtatDemandeTiersPayantRepository etatDemandeTiersPayantRepository, FileUtils fileUtils) throws IOException {
		return super.buildStep(stepBuilderFactory, fileUtils, etatDemandeTiersPayantRepository);
	}
	
	@Bean("etatDemandeTiersPayantWriter")
	@StepScope
	@Override
	public AsyncItemWriter<EtatDemandeTiersPayant> writer(
			FileUtils fileUtils,
			@Value("#{jobParameters['envSource'] ?: 'pprod'}") String envSource,
			@Value("#{jobParameters['envCible'] ?: 'pprod'}") String envCible
	) throws IOException {
		return super.buildWriter(fileUtils, envSource, envCible);
	}
	
}