Class ExportSpec
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; }
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
boolean
boolean
Returnstrue
if performing a CSV export.boolean
boolean
boolean
boolean
boolean
boolean
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, ornull
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 methodsetRequestSchemaNodes
, 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.toString()
Returns the main attributes of the exported dataset.
-
Constructor Details
-
ExportSpec
public ExportSpec()
-
-
Method Details
-
getSourceAdaptation
- See Also:
-
setSourceAdaptation
Specifies the source dataset of the export. If exporting a table, use 'setRequest(Request)
' instead.- Parameters:
aSource
- the dataset to export.
-
getDestinationFile
- See Also:
-
setDestinationFile
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:
-
getDestinationStream
- See Also:
-
setDestinationStream
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:
-
isCloseStreamWhenFinished
public boolean isCloseStreamWhenFinished()- See Also:
-
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:
-
isOmitXMLDeclaration
public boolean isOmitXMLDeclaration()- Since:
- 5.4.0
- See Also:
-
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:
-
isOmitXMLComment
public boolean isOmitXMLComment()- Since:
- 5.5.0
- See Also:
-
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
public void setIncludesComputedValues(boolean includesComputedValues) Specifies if computed values should be included in the export. Computed values are nodes withosd: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 hasmaxOccurs > 0
.If not set, this property has the value
true
. -
isIncludesTechnicalData
public boolean isIncludesTechnicalData()- See Also:
-
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 attributesebxd:lastTime
andebxd:uuid
.If not set, this property has the value
true
. -
getSelection
- See Also:
-
setSelection
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()Returnstrue
if performing a CSV export. This is the case when the methodgetCSVSpec()
does not returnnull
. -
getCSVSpec
- See Also:
-
setCSVSpec
Specifies the expected settings of a CSV export, ornull
if performing an XML export.Default value is
null
. -
isContentIndented
public boolean isContentIndented()- See Also:
-
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
- See Also:
-
setRequest
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
- See Also:
-
setViewPublication
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:
-
getRequestSchemaNodes
- See Also:
-
setRequestSchemaNodes
Specifies the nodes (or "columns" from a user or SQL perspective) to export. The export follows the order of the specifiedList
.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 ofdata model nodes
.- See Also:
-
setRequestSchemaNodesOrderedByTableNodesOrder
Same as the methodsetRequestSchemaNodes
, except that the export follows the order of the table nodes instead of the specified list.- See Also:
-
isOrderedByTableNodesOrder
public boolean isOrderedByTableNodesOrder() -
isCheckAccessRules
public boolean isCheckAccessRules()- See Also:
-
setCheckAccessRules
public void setCheckAccessRules(boolean checkAccessRules) Specifies whether permissions must be checked for the export.Default value is
true
. If set tofalse
, 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
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.
-
toStringInfo
Returns the main attributes of the exported dataset. -
toString
-