Package org.nuxeo.ecm.directory
Class DirectoryCSVLoader
java.lang.Object
org.nuxeo.ecm.directory.DirectoryCSVLoader
Helper to load data from a CSV file.
The actual consumer of rows is a parameter passed by the caller.
- Since:
- 8.4
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The special CSV value ("__NULL__") used to denote that anull
should be used for a value. -
Method Summary
Modifier and TypeMethodDescriptionprotected static Blob
createBlob
(String dataFileName) protected static Object
protected static InputStream
getResource
(String name) static void
Loads the CSV data file based on the provided schema, and creates the corresponding entries using the provided loader.static void
Loads the CSV data file based on the provided schema, and creates the corresponding entries using the provided loader.protected static InputStream
Gets theInputStream
from aURL
, avoiding JAR caches.protected static BiConsumer<Map<String,
Object>, Integer> toLoaderEnrichedOnError
(Consumer<Map<String, Object>> loader)
-
Field Details
-
CSV_NULL_MARKER
The special CSV value ("__NULL__") used to denote that anull
should be used for a value.- See Also:
-
-
Method Details
-
loadData
public static void loadData(String dataFileName, char delimiter, Schema schema, Consumer<Map<String, Object>> loader) Loads the CSV data file based on the provided schema, and creates the corresponding entries using the provided loader.- Parameters:
dataFileName
- the file name containing CSV datadelimiter
- the CSV column separatorschema
- the data schemaloader
- the actual consumer of loaded rows- Since:
- 8.4
- See Also:
-
createBlob
-
loadData
public static void loadData(Blob dataBlob, char delimiter, Schema schema, Consumer<Map<String, Object>> loader) Loads the CSV data file based on the provided schema, and creates the corresponding entries using the provided loader.- Parameters:
dataBlob
- the blob containing CSV datadelimiter
- the CSV column separatorschema
- the data schemaloader
- the actual consumer of loaded rows- Since:
- 11.1
-
toLoaderEnrichedOnError
-
decode
-
getResource
-
open
Gets theInputStream
from aURL
, avoiding JAR caches.- Since:
- 11.1
-