Class CsvDatasetConfiguration
java.lang.Object
com.samupert.univpm.eurostat.dataset.CsvDatasetConfiguration
CSV dataset configuration.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.batch.core.JobcsvDatasetImportJob(org.springframework.batch.core.repository.JobRepository jobRepository, org.springframework.batch.core.Step csvDatasetImportStep) Job to import the CSV dataset.org.springframework.batch.core.StepcsvDatasetImportStep(org.springframework.batch.core.repository.JobRepository jobRepository, org.springframework.transaction.PlatformTransactionManager transactionManager, org.springframework.batch.item.ItemReader<MonetaryPoverty> csvItemReader, org.springframework.batch.item.ItemWriter<MonetaryPoverty> csvItemWriter) Step to import the CSV dataset.org.springframework.batch.item.ItemReader<MonetaryPoverty>csvItemReader(org.springframework.core.io.Resource csvResource) Reader to read the CSV dataset.org.springframework.batch.item.ItemWriter<MonetaryPoverty>csvItemWriter(jakarta.persistence.EntityManagerFactory entityManagerFactory) Writer to write the CSV dataset to.org.springframework.batch.item.file.mapping.FieldSetMapper<MonetaryPoverty>Field set mapper to map the CSV dataset rows to theMonetaryPovertyclass.org.springframework.batch.item.file.LineMapper<MonetaryPoverty>Line mapper to map the CSV dataset rows to theMonetaryPovertyclass.org.springframework.batch.item.file.transform.LineTokenizerLine tokenizer to tokenize the CSV dataset rows.
-
Constructor Details
-
CsvDatasetConfiguration
public CsvDatasetConfiguration()
-
-
Method Details
-
csvDatasetImportJob
@Bean public org.springframework.batch.core.Job csvDatasetImportJob(org.springframework.batch.core.repository.JobRepository jobRepository, org.springframework.batch.core.Step csvDatasetImportStep) Job to import the CSV dataset.- Parameters:
jobRepository- The repository where the jobs are stored.csvDatasetImportStep- The step to import the CSV dataset.- Returns:
- The job to import the CSV dataset.
-
csvDatasetImportStep
@Bean public org.springframework.batch.core.Step csvDatasetImportStep(org.springframework.batch.core.repository.JobRepository jobRepository, org.springframework.transaction.PlatformTransactionManager transactionManager, org.springframework.batch.item.ItemReader<MonetaryPoverty> csvItemReader, org.springframework.batch.item.ItemWriter<MonetaryPoverty> csvItemWriter) Step to import the CSV dataset.- Parameters:
jobRepository- The repository where the jobs are stored.transactionManager- The transaction manager used to execute the steps.csvItemReader- The reader to read the CSV dataset.csvItemWriter- The writer to write the CSV dataset to.- Returns:
- The step to import the CSV dataset.
-
csvItemReader
@Bean public org.springframework.batch.item.ItemReader<MonetaryPoverty> csvItemReader(org.springframework.core.io.Resource csvResource) Reader to read the CSV dataset.- Parameters:
csvResource- The CSV dataset resource to import.- Returns:
- The reader to read the CSV dataset.
-
csvItemWriter
@Bean public org.springframework.batch.item.ItemWriter<MonetaryPoverty> csvItemWriter(jakarta.persistence.EntityManagerFactory entityManagerFactory) throws Exception Writer to write the CSV dataset to.- Parameters:
entityManagerFactory- The entity manager factory to use to write the CSV dataset to.- Returns:
- The writer to write the CSV dataset to.
- Throws:
Exception- When the writer cannot be created.
-
lineMapper
Line mapper to map the CSV dataset rows to theMonetaryPovertyclass.- Returns:
- The line mapper to map the CSV dataset.
-
lineTokenizer
@Bean public org.springframework.batch.item.file.transform.LineTokenizer lineTokenizer()Line tokenizer to tokenize the CSV dataset rows.- Returns:
- The line tokenizer to tokenize the CSV dataset.
-
fieldSetMapper
@Bean public org.springframework.batch.item.file.mapping.FieldSetMapper<MonetaryPoverty> fieldSetMapper()Field set mapper to map the CSV dataset rows to theMonetaryPovertyclass.- Returns:
- The field set mapper to map the CSV dataset rows to the
MonetaryPovertyclass.
-