Package com.orchestranetworks.service

# Class ExportImportCSVSpec

java.lang.Object
com.orchestranetworks.service.ExportImportCSVSpec

public class ExportImportCSVSpec extends Object
Defines the settings for executing an import or export to "Comma-separated values" format (CSV).

See Also:
  - `ExportSpec.setCSVSpec(ExportImportCSVSpec)`
  - `ImportSpec.setCSVSpec(ExportImportCSVSpec)`
  - CSV Specification

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static final class`
  `ExportImportCSVSpec.Header`
  Specifies the header type of the CSV document.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `NULL_STRING_CODE`
  Value is: `"ebx-csv:nil"`.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ExportImportCSVSpec()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getEncoding()`
  `char`
  `getFieldSeparator()`
  `ExportImportCSVSpec.Header`
  `getHeader()`
  `String`
  `getLineSeparator()`
  `String`
  `getListSeparator()`
  `char`
  `getTextDelimiter()`
  `boolean`
  `isForceEnclosingFields()`
  `boolean`
  `isInheritanceEnabled()`
  `boolean`
  `isNullStringEncoded()`
  `void`
  `setEncoding(String encoding)`
  Specifies the character encoding to be used.
  `void`
  `setFieldSeparator(char separator)`
  Specifies the field separator to be used.
  `void`
  `setForceEnclosingFields(boolean forceEnclosingFields)`
  Specifies that, during an export, all fields are to be enclosed within text delimiter characters, even if the fields do not contain any special characters.
  `void`
  `setHeader(ExportImportCSVSpec.Header headerType)`
  Specifies the header of the CSV file; can be `ExportImportCSVSpec.Header.NONE`.
  `void`
  `setInheritanceEnabled(boolean inheritanceEnabled)`
  Specifies if the inheritance will be taken into account during a CSV export or import.
  `void`
  `setLineSeparator(String separator)`
  Specifies the line separator to be used.
  `void`
  `setListSeparator(String separator)`
  Specifies the list separator to be used.
  `void`
  `setNullStringEncoded(boolean nullStringEncoded)`
  Specifies if `null` strings will be translated to `ebx-csv:nil` values in CSV fields.
  `void`
  `setTextDelimiter(char delimiter)`
  Specifies the text delimiter to be used.

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### NULL_STRING_CODE

    public static final String NULL_STRING_CODE
    Value is: `"ebx-csv:nil"`.
    See Also:
      - `setNullStringEncoded(boolean)`
      - Constant Field Values

- ## Constructor Details

  - ### ExportImportCSVSpec

    public ExportImportCSVSpec()

- ## Method Details

  - ### getFieldSeparator

    public char getFieldSeparator()
    See Also:
      - `setFieldSeparator(char)`

  - ### getLineSeparator

    public String getLineSeparator()
    See Also:
      - `setLineSeparator(String)`

  - ### getListSeparator

    public String getListSeparator()
    Since:
      5.6.0
    See Also:
      - `setListSeparator(String)`

  - ### getEncoding

    public String getEncoding()
    See Also:
      - `setEncoding(String)`

  - ### setFieldSeparator

    public void setFieldSeparator(char separator)
    Specifies the field separator to be used.

    If not set, the value of this property is `','` (comma).

  - ### setLineSeparator

    public void setLineSeparator(String separator)
    Specifies the line separator to be used.

    If not set, the value of this property is `'\r\n'` (CRLF).

  - ### setListSeparator

    public void setListSeparator(String separator)
    Specifies the list separator to be used.

    If not set, the value of this property is `'\r\n'` (CRLF).

    Since:
      5.6.0

  - ### setEncoding

    public void setEncoding(String encoding)
    Specifies the character encoding to be used.

    If not set, the value of this property is `'UTF-8'`.

    Parameters:
      `encoding` - the name of a supported encoding (see `Charset`).

  - ### getHeader

    public ExportImportCSVSpec.Header getHeader()
    See Also:
      - `setHeader(com.orchestranetworks.service.ExportImportCSVSpec.Header)`

  - ### setHeader

    public void setHeader(ExportImportCSVSpec.Header headerType)
    Specifies the header of the CSV file; can be `ExportImportCSVSpec.Header.NONE`.

    The header is set to `ExportImportCSVSpec.Header.LABEL` by default.

  - ### getTextDelimiter

    public char getTextDelimiter()
    See Also:
      - `setTextDelimiter(char)`

  - ### isForceEnclosingFields

    public boolean isForceEnclosingFields()
    See Also:
      - `setForceEnclosingFields(boolean)`

  - ### setTextDelimiter

    public void setTextDelimiter(char delimiter)
    Specifies the text delimiter to be used. The text delimiter is used for enclosing fields that contain special characters (the field separator character, the line separator character, or the text delimiter itself).

    If not set, the value of this property is `'"'` (double-quote).

    See Also:
      - `setForceEnclosingFields(boolean)`

  - ### setForceEnclosingFields

    public void setForceEnclosingFields(boolean forceEnclosingFields)
    Specifies that, during an export, all fields are to be enclosed within text delimiter characters, even if the fields do not contain any special characters.

    If not set, this property is `false`.

    See Also:
      - `setTextDelimiter(char)`

  - ### isNullStringEncoded

    public boolean isNullStringEncoded()
    See Also:
      - `setNullStringEncoded(boolean)`

  - ### setNullStringEncoded

    public void setNullStringEncoded(boolean nullStringEncoded)
    Specifies if `null` strings will be translated to `ebx-csv:nil` values in CSV fields.

    - If not set, a `null` string is exported as an empty string.
    - If set, depending on the distinction between a `null` value and an empty string:
      - If the distinction is preserved, a round-trip export-import will replace `null` string values with empty strings.
      - Otherwise, a round-trip export-import will preserve `null` values.
    See Also:
      - `NULL_STRING_CODE`
      - Empty string management

  - ### isInheritanceEnabled

    public boolean isInheritanceEnabled()
    Since:
      5.6.0
    See Also:
      - `setInheritanceEnabled(boolean)`

  - ### setInheritanceEnabled

    public void setInheritanceEnabled(boolean inheritanceEnabled)
    Specifies if the inheritance will be taken into account during a CSV export or import.
    - For a CSV export
      - If set to `false` (the default), inheritance is ignored then,
        - resolved values of fields are exported;
        - `occulted records` are not exported.
      - If set to `true`, inheritance is taken into account during the export then:
        - a technical data `x:defMode` that specifies the definition mode for each record is added to the first column of the CSV file. The possible values of `x:defMode` are 'N', 'T', 'V' and 'C' and correspond respectively to `inherit`, `root`, `overwrite` and `occult` modes;
        - a technical data `x:inh` that specifies if the field is inherited or occulted is added before each field column;
        - resolved values of fields are exported.
    - For a CSV Import
      - If set to `false` (the default), inheritance is ignored and record fields are overwritten with imported values.
      - If set to `true`, inheritance is taken into account during the import then:
        - if the read value of column `x:defMode` is 'N', the record is forced to be in inherit mode that means;
        - it is occulted then deleted, if an `overwritten record` with the same primary key exists in the current table;
        - it is deleted, if an `occulted record` with the same primary key exists in the current table;
        - nothing is done, if an `inherited record` with the same primary key exists in the current table;
        - nothing is done, if no record exists with the same primary key in the current table.
        - if the read value of column `x:defMode` is 'C', the record is forced to be in occult mode that means;
        - it is deleted, if an `inherited record` with the same primary key exists in the target table;
        - it is occulted, if an `overwritten record` with the same primary key exists in the current table;
        - nothing is done, if an `occulted record` with the same primary key exists in the current table;
        - nothing is done, if no record exists with the same primary key in the current table.
        - if the read value of column `x:inh` is 'N', the field following this column is forced to be in inherit mode; `AdaptationValue.INHERIT_VALUE` is set;
        - otherwise, record fields are overwritten with imported values.

    Limitations:

    - During a CSV export or import, if the dataset of the table has no parent or if the table has no inherited field, inheritance is always ignored.
    Since:
      5.6.0
    See Also:
      - `Adaptation.getOccurrenceDefinitionMode()`
      - `Adaptation.getValueWithoutResolution(Path)`
      - CSV import and export
      - Inheritance and value resolution