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 Details

    • CSV_NULL_MARKER

      public static final String CSV_NULL_MARKER
      The special CSV value ("__NULL__") used to denote that a null 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 data
      delimiter - the CSV column separator
      schema - the data schema
      loader - the actual consumer of loaded rows
      Since:
      8.4
      See Also:
    • createBlob

      protected static Blob createBlob(String dataFileName)
    • 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 data
      delimiter - the CSV column separator
      schema - the data schema
      loader - the actual consumer of loaded rows
      Since:
      11.1
    • toLoaderEnrichedOnError

      protected static BiConsumer<Map<String,Object>,Integer> toLoaderEnrichedOnError(Consumer<Map<String,Object>> loader)
    • decode

      protected static Object decode(Field field, String value)
    • getResource

      protected static InputStream getResource(String name)
    • open

      protected static InputStream open(URL url)
      Gets the InputStream from a URL, avoiding JAR caches.
      Since:
      11.1