Package org.nuxeo.ecm.directory
Class DirectoryCSVLoader
- java.lang.Object
-
- org.nuxeo.ecm.directory.DirectoryCSVLoader
-
public class DirectoryCSVLoader extends Object
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
Fields Modifier and Type Field Description static String
CSV_NULL_MARKER
The special CSV value ("__NULL__") used to denote that anull
should be used for a value.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static Blob
createBlob(String dataFileName)
protected static Object
decode(Field field, String value)
protected static InputStream
getResource(String name)
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.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.protected static InputStream
open(URL url)
Gets theInputStream
from aURL
, avoiding JAR caches.protected static BiConsumer<Map<String,Object>,Integer>
toLoaderEnrichedOnError(Consumer<Map<String,Object>> loader)
-
-
-
Field Detail
-
CSV_NULL_MARKER
public static final String CSV_NULL_MARKER
The special CSV value ("__NULL__") used to denote that anull
should be used for a value.- See Also:
- Constant Field Values
-
-
Method Detail
-
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:
loadData(Blob, char, Schema, Consumer)
-
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
protected static BiConsumer<Map<String,Object>,Integer> toLoaderEnrichedOnError(Consumer<Map<String,Object>> loader)
-
getResource
protected static InputStream getResource(String name)
-
open
protected static InputStream open(URL url)
Gets theInputStream
from aURL
, avoiding JAR caches.- Since:
- 11.1
-
-