Package su.onno.importer
Class DocumentCsvImportService
java.lang.Object
su.onno.importer.DocumentCsvImportService
Parses CSV files and applies rows to a document type through
DocumentCommandService.-
Constructor Summary
ConstructorsConstructorDescriptionDocumentCsvImportService(org.jdbi.v3.core.Jdbi jdbi, DocumentCommandService documentCommands, OnnoImportProperties properties) -
Method Summary
Modifier and TypeMethodDescriptionimportDocuments(DocumentDescriptor desc, byte[] csv, String charsetName, Map<String, String> mapping, DocumentImportMode mode, boolean dryRun, boolean postAfterImport, String groupBy, Principal principal) Imports documents using a field-to-header mapping, e.g.
-
Constructor Details
-
DocumentCsvImportService
public DocumentCsvImportService(org.jdbi.v3.core.Jdbi jdbi, DocumentCommandService documentCommands, OnnoImportProperties properties)
-
-
Method Details
-
importDocuments
public ImportResult importDocuments(DocumentDescriptor desc, byte[] csv, String charsetName, Map<String, String> mapping, DocumentImportMode mode, boolean dryRun, boolean postAfterImport, String groupBy, Principal principal) Imports documents using a field-to-header mapping, e.g.{"number":"Number"}.Header attributes use plain keys (
"customer"); tabular-section lines use dotted keys ("lines.product"). WhengroupBynames a CSV column, consecutive or scattered rows that share its value collapse into one document — header fields come from the group's first row and every row contributes one line to each mapped tabular section. WithoutgroupBy, each CSV row becomes its own document (with a single tabular line per section when tabular fields are mapped).
-