Package com.orchestranetworks.service

# Class ExportSpec

java.lang.Object
com.orchestranetworks.service.ExportSpec

public class ExportSpec extends Object
Defines the settings of an export.

To be valid, an instance of this class must define at least a source and a destination.

#### Usage

An example of a table export to a CSV file:

     private ExportSpec getExportSpecForCSV(
            File csvFile,
            AdaptationTable table,
            Header headerType)
     {
            ExportImportCSVSpec csvSpec = new ExportImportCSVSpec();
            csvSpec.setHeader(headerType);

            ExportSpec exportSpec = new ExportSpec();
            exportSpec.setCSVSpec(csvSpec);
            exportSpec.setRequest(table.createRequest());
            exportSpec.setDestinationFile(csvFile);
            exportSpec.setIncludesTechnicalData(false);
            return exportSpec;
     }

See Also:
  - `ProcedureContext.doExport(ExportSpec)`
  - `ImportSpec`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ExportSpec()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `ExportImportCSVSpec`
  `getCSVSpec()`
  `File`
  `getDestinationFile()`
  `OutputStream`
  `getDestinationStream()`
  `Request`
  `getRequest()`
  `List<SchemaNode>`
  `getRequestSchemaNodes()`
  `SchemaNode`
  `getSelection()`
  `Adaptation`
  `getSourceAdaptation()`
  `String`
  `getViewPublication()`
  `boolean`
  `isCheckAccessRules()`
  `boolean`
  `isCloseStreamWhenFinished()`
  `boolean`
  `isContentIndented()`
  `boolean`
  `isExportToCSV()`
  Returns `true` if performing a CSV export.
  `boolean`
  `isIncludesComputedValues()`
  `boolean`
  `isIncludesTechnicalData()`
  `boolean`
  `isOmitXMLComment()`
  `boolean`
  `isOmitXMLDeclaration()`
  `boolean`
  `isOrderedByTableNodesOrder()`
  `boolean`
  `isSessionDependingDisplay()`
  `void`
  `setCheckAccessRules(boolean checkAccessRules)`
  Specifies whether permissions must be checked for the export.
  `void`
  `setCloseStreamWhenFinished(boolean closeStreamWhenFinished)`
  Specifies that the export process must close the stream upon export completion.
  `void`
  `setContentIndented(boolean indent)`
  For XML exports, specifies to indent the content of the document.
  `void`
  `setCSVSpec(ExportImportCSVSpec csvSpec)`
  Specifies the expected settings of a CSV export, or `null` if performing an XML export.
  `void`
  `setDestinationFile(File target)`
  Specifies the file to which to export the document.
  `void`
  `setDestinationStream(OutputStream target)`
  Specifies the stream to which to write the exported document.
  `void`
  `setIncludesComputedValues(boolean includesComputedValues)`
  Specifies if computed values should be included in the export.
  `void`
  `setIncludesTechnicalData(boolean includesTechnicalData)`
  Specifies if technical data should be included in the export.
  `void`
  `setOmitXMLComment(boolean omitXMLComment)`
  For XML exports, specifies whether to omit the generated XML comment that describes the location of data and the date of the export from beginning of the file.
  `void`
  `setOmitXMLDeclaration(boolean omitXMLDeclaration)`
  For XML exports, specifies whether to omit the XML declaration from beginning of the export.
  `void`
  `setRequest(Request request)`
  Specifies to export content filtered by the provided request.
  `void`
  `setRequestSchemaNodes(List<SchemaNode> aListOfDataModelNodes)`
  Specifies the nodes (or "columns" from a user or SQL perspective) to export.
  `void`
  `setRequestSchemaNodesOrderedByTableNodesOrder(List<SchemaNode> aListOfDataModelNodes)`
  Same as the method `setRequestSchemaNodes`, except that the export follows the order of the table nodes instead of the specified list.
  `void`
  `setSelection(SchemaNode selection)`
  Specifies that the export will only include the content under the specified node.
  `void`
  `setSessionDependingDisplay(boolean sessionDependingDisplay)`
  Specifies whether to apply the standard XML format (default) or user-friendly, session dependent formatting and labeling.
  `void`
  `setSourceAdaptation(Adaptation aSource)`
  Specifies the source dataset of the export.
  `void`
  `setViewPublication(String aPublication)`
  Specifies to export table content filtered by the provided view.
  `String`
  `toString()`
  `String`
  `toStringInfo()`
  Returns the main attributes of the exported dataset.

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

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

- ## Constructor Details

  - ### ExportSpec

    public ExportSpec()

- ## Method Details

  - ### getSourceAdaptation

    public Adaptation getSourceAdaptation()
    See Also:
      - `setSourceAdaptation(Adaptation)`

  - ### setSourceAdaptation

    public void setSourceAdaptation(Adaptation aSource)
    Specifies the source dataset of the export. If exporting a table, use '`setRequest(Request)`' instead.
    Parameters:
      `aSource` - the dataset to export.

  - ### getDestinationFile

    public File getDestinationFile()
    See Also:
      - `setDestinationFile(File)`

  - ### setDestinationFile

    public void setDestinationFile(File target)
    Specifies the file to which to export the document.

    If the destination file is not set, an output stream must be set.

    Parameters:
      `target` - destination file that the export will write.
    See Also:
      - `setDestinationStream(OutputStream)`

  - ### getDestinationStream

    public OutputStream getDestinationStream()
    See Also:
      - `setDestinationStream(OutputStream)`

  - ### setDestinationStream

    public void setDestinationStream(OutputStream target)
    Specifies the stream to which to write the exported document.

    A destination stream is a more general alternative to a destination file.

    It is up to the caller of this method to provide a buffered output stream (if necessary for performance considerations).

    Parameters:
      `target` - destination stream for the export.
    See Also:
      - `setDestinationFile(File)`

  - ### isCloseStreamWhenFinished

    public boolean isCloseStreamWhenFinished()
    See Also:
      - `setCloseStreamWhenFinished(boolean)`

  - ### setCloseStreamWhenFinished

    public void setCloseStreamWhenFinished(boolean closeStreamWhenFinished)
    Specifies that the export process must close the stream upon export completion.

    If not set, this property has the value `true`.

    See Also:
      - `setOmitXMLDeclaration(boolean)`

  - ### isOmitXMLDeclaration

    public boolean isOmitXMLDeclaration()
    Since:
      5.4.0
    See Also:
      - `setOmitXMLDeclaration(boolean)`

  - ### setOmitXMLDeclaration

    public void setOmitXMLDeclaration(boolean omitXMLDeclaration)
    For XML exports, specifies whether to omit the XML declaration from beginning of the export. Use this method when exporting content to be included within a larger document.

    An example of an XML declaration:

    `<?xml version="1.0" encoding="UTF-8"?>`

    If not set, the property has the value `false`. This property is ignored for CSV exports.

    Since:
      5.4.0
    See Also:
      - `setCloseStreamWhenFinished(boolean)`

  - ### isOmitXMLComment

    public boolean isOmitXMLComment()
    Since:
      5.5.0
    See Also:
      - `setOmitXMLComment(boolean)`

  - ### setOmitXMLComment

    public void setOmitXMLComment(boolean omitXMLComment)
    For XML exports, specifies whether to omit the generated XML comment that describes the location of data and the date of the export from beginning of the file.

    An example of an XML comment:

    `<!--XML content generated for /root/table in dataset DataSet1 in dataspace DataSpaceA on 2014-03-26T16:29:58.296 by user [admin].-->`

    If not set, the property has the value `false`. This property is ignored for CSV exports.

    Since:
      5.5.0

  - ### isIncludesComputedValues

    public boolean isIncludesComputedValues()
    See Also:
      - `setIncludesComputedValues(boolean)`

  - ### setIncludesComputedValues

    public void setIncludesComputedValues(boolean includesComputedValues)
    Specifies if computed values should be included in the export. Computed values are nodes with `osd:function` declarations (see Computed Values).

    Warning: For XML exports, if `false` is specified, the exported document may be invalid according to the XML Schema. This is the case when a computed value node has `maxOccurs > 0`.

    If not set, this property has the value `true`.

  - ### isIncludesTechnicalData

    public boolean isIncludesTechnicalData()
    See Also:
      - `setIncludesTechnicalData(boolean)`

  - ### setIncludesTechnicalData

    public void setIncludesTechnicalData(boolean includesTechnicalData)
    Specifies if technical data should be included in the export. Technical data is internal repository information, for example the attributes `ebxd:lastTime` and `ebxd:uuid`.

    If not set, this property has the value `true`.

  - ### getSelection

    public SchemaNode getSelection()
    See Also:
      - `setSelection(SchemaNode)`

  - ### setSelection

    public void setSelection(SchemaNode selection)
    Specifies that the export will only include the content under the specified node.

    If not set, this property is `null`. This means that the whole content is exported.

  - ### isExportToCSV

    public boolean isExportToCSV()
    Returns `true` if performing a CSV export. This is the case when the method `getCSVSpec()` does not return `null`.

  - ### getCSVSpec

    public ExportImportCSVSpec getCSVSpec()
    See Also:
      - `setCSVSpec(ExportImportCSVSpec)`

  - ### setCSVSpec

    public void setCSVSpec(ExportImportCSVSpec csvSpec)
    Specifies the expected settings of a CSV export, or `null` if performing an XML export.

    Default value is `null`.

  - ### isContentIndented

    public boolean isContentIndented()
    See Also:
      - `setContentIndented(boolean)`

  - ### setContentIndented

    public void setContentIndented(boolean indent)
    For XML exports, specifies to indent the content of the document.

    If not set, this property has the value `true`.

    If performing a `CSV` export, this property is ignored.

  - ### getRequest

    public Request getRequest()
    See Also:
      - `setRequest(Request)`

  - ### setRequest

    public void setRequest(Request request)
    Specifies to export content filtered by the provided request.

    If not set, this property is `null`. This means that the whole table content is exported.

  - ### getViewPublication

    public String getViewPublication()
    See Also:
      - `setViewPublication(String)`

  - ### setViewPublication

    public void setViewPublication(String aPublication)
    Specifies to export table content filtered by the provided view. This method is reserved for use with tabular views. An exception occurs if applied to a hierarchy view.
    Parameters:
      `aPublication` - the unique publication name of the custom view to be applied.
    Since:
      5.3.2
    See Also:
      - Technical reference
      - `UIHttpManagerComponent.setViewPublication(String)`

  - ### getRequestSchemaNodes

    public List<SchemaNode> getRequestSchemaNodes()
    See Also:
      - `setRequestSchemaNodes(List)`

  - ### setRequestSchemaNodes

    public void setRequestSchemaNodes(List<SchemaNode> aListOfDataModelNodes)
    Specifies the nodes (or "columns" from a user or SQL perspective) to export. The export follows the order of the specified `List`.

    If not set, all nodes in the table are exported (except computed values, if those are excluded using the method `setIncludesComputedValues(boolean)`).

    Limitation: If the specified node is a terminal group, all nodes under this group will not be exported to CSV format, whereas they will be exported to XML format.

    Parameters:
      `aListOfDataModelNodes` - List of `data model nodes`.
    See Also:
      - `SchemaNode`

  - ### setRequestSchemaNodesOrderedByTableNodesOrder

    public void setRequestSchemaNodesOrderedByTableNodesOrder(List<SchemaNode> aListOfDataModelNodes)
    Same as the method `setRequestSchemaNodes`, except that the export follows the order of the table nodes instead of the specified list.
    See Also:
      - `setRequestSchemaNodes(List)`

  - ### isOrderedByTableNodesOrder

    public boolean isOrderedByTableNodesOrder()
    See Also:
      - `setRequestSchemaNodesOrderedByTableNodesOrder(List)`

  - ### isCheckAccessRules

    public boolean isCheckAccessRules()
    See Also:
      - `setCheckAccessRules(boolean)`

  - ### setCheckAccessRules

    public void setCheckAccessRules(boolean checkAccessRules)
    Specifies whether permissions must be checked for the export.

    Default value is `true`. If set to `false`, the user performing the export will gain access to columns, records, and fields values that were inaccessible through the user interface.

  - ### isSessionDependingDisplay

    public boolean isSessionDependingDisplay()
    See Also:
      - `setSessionDependingDisplay(boolean)`

  - ### setSessionDependingDisplay

    public void setSessionDependingDisplay(boolean sessionDependingDisplay)
    Specifies whether to apply the standard XML format (default) or user-friendly, session dependent formatting and labeling.

    When set to `true`:

    - values (dates and numbers) are formatted according to the current session preferences;
    - labels for the locale of the current session are used whenever possible;
    - consequently, a re-import of the exported file will not be possible;
    - for an XML export, another consequence is that the exported document will not conform to its XML Schema Document.
    See Also:
      - `SchemaNode.displayOccurrence(Object, boolean, com.orchestranetworks.instance.ValueContext, Locale)`

  - ### toStringInfo

    public String toStringInfo()
    Returns the main attributes of the exported dataset.

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`