Class CsvMetadataBuilder

java.lang.Object
com.aquima.interactions.framework.util.CsvMetadataBuilder

public class CsvMetadataBuilder extends Object
Util class for easy datasource creation for a CSV resource connection.
Since:
8.3
Author:
Jon van Leuven
  • Field Details

  • Constructor Details

    • CsvMetadataBuilder

      public CsvMetadataBuilder()
  • Method Details

    • addColumnInfo

      public void addColumnInfo(DataType type, String formatPattern, String localeCode)
      This method adds column information to the metadata object
      Parameters:
      type - The datatype of the column, may not be null.
      formatPattern - The format pattern of the column, may be null.
      localeCode - The format pattern of the column, may be null (may not be null when a pattern is provided).
    • addColumnInfo

      public void addColumnInfo(DataType type, String valueFormatName)
      This method adds column information to the metadata object
      Parameters:
      type - The datatype of the column, may not be null.
      valueFormatName - The name of the value format that should be used, may be null.
    • addColumnInfo

      public void addColumnInfo(DataType type)
      This method adds column information to the metadata object with a default value format.
      Parameters:
      type - The datatype of the column, may not be null.
    • setIsFixedWidthText

      public void setIsFixedWidthText(boolean isFixedWidthText)
      This method sets if the resource should be parsed as a fixed width text resource.
      Parameters:
      isFixedWidthText - if the resource should be parsed as a fixed width text resource.
    • setColumnWidths

      public void setColumnWidths(int[] columnWidths)
      This method sets the column widths for a fixed width text resource.
      Parameters:
      columnWidths - the column widths for a fixed width text resource.
    • setDelimiter

      public void setDelimiter(char delimiter)
      This method sets the delimiter to use for separating entries.
      Parameters:
      delimiter - the delimiter to use for separating entries.
    • setQuoteCharacter

      public void setQuoteCharacter(char quoteCharacter)
      This method sets the character to use for quoted elements.
      Parameters:
      quoteCharacter - the character to use for quoted elements.
    • setHasRowHeaders

      public void setHasRowHeaders(boolean hasRowHeaders)
      This method sets if the CSV resource's first row contains the headers.
      Parameters:
      hasRowHeaders - if the CSV resource's first row contains the headers.
    • setCharset

      public void setCharset(String charset)
    • toDatasource

      public void toDatasource(IConnectionParameterVisitor visitor)
      Use this method to add the metadata to the IConnectionParameterVisitor that is used in by the IResourceConnectionDS.
      Parameters:
      visitor - The visitor to add the csv metadata to.
      Throws:
      InitializationException - This exception is thrown when the connection definition could not be added.