LoadCatalogAssociationItemReader.java

package com.sintia.ffl.admin.optique.catalogue.batch.reader.loadcatalog;

import com.sintia.ffl.admin.optique.catalogue.batch.reader.AbstractAssociationItemReader;
import com.sintia.ffl.admin.optique.catalogue.batch.reporter.LoadCatalogReporter;
import com.sintia.ffl.admin.optique.catalogue.batch.reporter.Reporter;
import com.sintia.ffl.admin.optique.catalogue.models.AssociationCSV;
import org.springframework.batch.core.configuration.annotation.StepScope;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * Read raw data from a csv file and convert them to {@link AssociationCSV}.
 * Used for the catalog loading job
 *
 * @author jumazet
 */
@Component
@StepScope
public class LoadCatalogAssociationItemReader extends AbstractAssociationItemReader {

	@Autowired
	private LoadCatalogReporter reporter;

	public LoadCatalogAssociationItemReader(
			@Value("#{jobParameters[associationFileName]}") String fileName,
			@Value("${local.resources.directory}") String localDirectory,
			@Value("${catalog.corrected.directory}") String specificDirectory) {

		super(fileName, localDirectory, specificDirectory);
	}

	@Override
	public Reporter getReporter() {
		return this.reporter;
	}
}