generated from openMF/payment-hub-ee
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[G2PCCODV-50] include Gov-360, Gov-325 update (#92)
* include Gov-360 update * include Gov-325 update * update tenants config * remove extra fields from transfer * add bpmn config bulk_processor_account_lookup * update variable name * import phee-494 changes from master * fix gov-325 additions * fix deduplication issues * update pipeline * temp remove checkstyle command * remove schema_name
- Loading branch information
Showing
9 changed files
with
157 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/main/java/hu/dpc/phee/operator/file/CsvFileService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package hu.dpc.phee.operator.file; | ||
|
||
import com.fasterxml.jackson.databind.MappingIterator; | ||
import com.fasterxml.jackson.dataformat.csv.CsvMapper; | ||
import com.fasterxml.jackson.dataformat.csv.CsvSchema; | ||
import hu.dpc.phee.operator.entity.batch.Transaction; | ||
import java.io.IOException; | ||
import java.io.Reader; | ||
import java.nio.charset.Charset; | ||
import java.nio.file.Files; | ||
import java.nio.file.Paths; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@Slf4j | ||
public class CsvFileService { | ||
|
||
@Autowired | ||
private CsvMapper csvMapper; | ||
|
||
public List<Transaction> getTransactionList(String filename) { | ||
List<Transaction> transactionList; | ||
try { | ||
CsvSchema schema = CsvSchema.emptySchema().withHeader(); | ||
Reader reader = Files.newBufferedReader(Paths.get(filename), Charset.defaultCharset()); | ||
MappingIterator<Transaction> readValues = csvMapper.readerWithSchemaFor(Transaction.class).with(schema).readValues(reader); | ||
transactionList = new ArrayList<>(); | ||
while (readValues.hasNext()) { | ||
Transaction current = readValues.next(); | ||
transactionList.add(current); | ||
} | ||
} catch (IOException e) { | ||
log.debug(e.getMessage()); | ||
log.error("Error building TransactionList for file: {}", filename); | ||
return null; | ||
} | ||
return transactionList; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters