Class XmlImport.Builder

All Implemented Interfaces:
XmlImportBuilder
Enclosing class:
XmlImport

public static class XmlImport.Builder
extends FileImportBuilder<XmlImport.Builder,​XmlImport>
implements XmlImportBuilder
The Builder class allows setting properties for an XML import and provides a build() method which returns a XmlImport object that will use the configured properties to import batch data.
  • Constructor Details

    • Builder

      public Builder​(String namespace, String table)
      Creates the XmlImportBuilder object. Normally accessed through XmlImport.builder(String, String).
      Parameters:
      namespace - The String name of the namespace into which data will be imported.
      table - The String name of the table into which data will be imported.
  • Method Details

    • setDelimiter

      public XmlImport.Builder setDelimiter​(char delimiter)
      Set the delimiter character used for array data elements. Default is comma. This can be used to set a different character such as pipe (|), semi-colon (;), or any other single character.
      Specified by:
      setDelimiter in interface XmlImportBuilder
      Parameters:
      delimiter - The char to use as an array delimiter.
      Returns:
      this builder.
    • setConstantColumnValue

      public XmlImport.Builder setConstantColumnValue​(String constantColumnValue)
      Sets the value to use for source columns with a sourceType of CONSTANT.
      Specified by:
      setConstantColumnValue in interface XmlImportBuilder
      Parameters:
      constantColumnValue - String value for the constant column.
      Returns:
      this builder.
    • setElementType

      public XmlImport.Builder setElementType​(String elementType)
      Sets the name or path of the element that will contain data elements.
      Specified by:
      setElementType in interface XmlImportBuilder
      Parameters:
      elementType - The String element name or path under which to find data elements.
      Returns:
      this builder.
    • setStartIndex

      public XmlImport.Builder setStartIndex​(int startIndex)
      Set the value starting from the root of the document, of the index (1 being the first top-level element in the document after the root) of the element under which data can be found.
      Specified by:
      setStartIndex in interface XmlImportBuilder
      Parameters:
      startIndex - int index value of the starting element.
      Returns:
      this builder.
    • setStartDepth

      public XmlImport.Builder setStartDepth​(int startDepth)
      Set the value, under the element indicated by Start Index, indication how many levels of first children to traverse to find an element that contains data to import.
      Specified by:
      setStartDepth in interface XmlImportBuilder
      Parameters:
      startDepth - int value of the starting depth.
      Returns:
      this builder.
    • setMaxDepth

      public XmlImport.Builder setMaxDepth​(int maxDepth)
      Sets a value indicating, starting from Start Depth, how many levels of element paths to traverse and concatenate to provide a list that can be selected under Element Name.
      Specified by:
      setMaxDepth in interface XmlImportBuilder
      Parameters:
      maxDepth - int value of the maximum depth.
      Returns:
      this builder.
    • setUseAttributeValues

      public XmlImport.Builder setUseAttributeValues​(boolean useAttributeValues)
      Sets whether field values will be taken from attribute values. E.g., <Record ID="XYZ" Price="10.25" />
      Specified by:
      setUseAttributeValues in interface XmlImportBuilder
      Parameters:
      useAttributeValues - boolean of whether to use attribute values. Default is false.
      Returns:
      this builder.
    • setUseElementValues

      public XmlImport.Builder setUseElementValues​(boolean useElementValues)
      Sets whether field values will be taken from element values. E.g., <Price>10.25</>
      Specified by:
      setUseElementValues in interface XmlImportBuilder
      Parameters:
      useElementValues - boolean of whether to use element values. Default is true.
      Returns:
      this builder.
    • setPositionValues

      public XmlImport.Builder setPositionValues​(boolean positionValues)
      Set whether field values within the document will be found by name or by position.

      E.g., a value called Price might be contained in an element named Price, or an attribute named Price. When this option is included, field names (column names) will be taken from the table schema, and the data values will be parsed into them by matching the position of the value with the position of column in the schema.

      Specified by:
      setPositionValues in interface XmlImportBuilder
      Parameters:
      positionValues - boolean of whether to use positional values. Default is false.
      Returns:
      this builder.
    • getThis

      protected XmlImport.Builder getThis()
      Description copied from class: ImportBuilder
      Returns this builder. Concrete subclasses mus provide "this" so that the setters can chain properly.
      Specified by:
      getThis in class ImportBuilder<XmlImport.Builder,​XmlImport>
      Returns:
      this builder.
    • build

      public XmlImport build()
      Creates an XmlImport object using the properties that have been set in the XmlImport.Builder.
      Specified by:
      build in interface XmlImportBuilder
      Specified by:
      build in class ImportBuilder<XmlImport.Builder,​XmlImport>
      Returns:
      A XmlImport object.