public class ExportSpec extends Object
To be valid, an instance of this class must define at least a source and a destination.
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; }
ProcedureContext.doExport(ExportSpec)
,
ImportSpec
Constructor and Description |
---|
ExportSpec() |
Modifier and Type | Method and 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.
|
public Adaptation getSourceAdaptation()
setSourceAdaptation(Adaptation)
public void setSourceAdaptation(Adaptation aSource)
setRequest(Request)
' instead.aSource
- the dataset to export.public File getDestinationFile()
setDestinationFile(File)
public void setDestinationFile(File target)
If the destination file is not set, an output stream must be set.
target
- destination file that the export will write.setDestinationStream(OutputStream)
public OutputStream getDestinationStream()
setDestinationStream(OutputStream)
public void setDestinationStream(OutputStream target)
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).
target
- destination stream for the export.setDestinationFile(File)
public boolean isCloseStreamWhenFinished()
setCloseStreamWhenFinished(boolean)
public void setCloseStreamWhenFinished(boolean closeStreamWhenFinished)
If not set, this property has the value true
.
setOmitXMLDeclaration(boolean)
public boolean isOmitXMLDeclaration()
setOmitXMLDeclaration(boolean)
public void setOmitXMLDeclaration(boolean omitXMLDeclaration)
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.
setCloseStreamWhenFinished(boolean)
public boolean isOmitXMLComment()
setOmitXMLComment(boolean)
public void setOmitXMLComment(boolean omitXMLComment)
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.
public boolean isIncludesComputedValues()
setIncludesComputedValues(boolean)
public void setIncludesComputedValues(boolean includesComputedValues)
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
.
public boolean isIncludesTechnicalData()
setIncludesTechnicalData(boolean)
public void setIncludesTechnicalData(boolean includesTechnicalData)
ebxd:lastTime
and ebxd:uuid
.
If not set, this property has the value true
.
public SchemaNode getSelection()
setSelection(SchemaNode)
public void setSelection(SchemaNode selection)
If not set, this property is null
. This means that the whole content is exported.
public boolean isExportToCSV()
true
if performing a CSV export.
This is the case when the method getCSVSpec()
does not return null
.public ExportImportCSVSpec getCSVSpec()
setCSVSpec(ExportImportCSVSpec)
public void setCSVSpec(ExportImportCSVSpec csvSpec)
null
if performing an XML export.
Default value is null
.
public boolean isContentIndented()
setContentIndented(boolean)
public void setContentIndented(boolean indent)
If not set, this property has the value true
.
If performing a CSV
export,
this property is ignored.
public Request getRequest()
setRequest(Request)
public void setRequest(Request request)
If not set, this property is null
. This means that the whole table content is exported.
public String getViewPublication()
setViewPublication(String)
public void setViewPublication(String aPublication)
aPublication
- the unique publication name of the custom view to be applied.UIHttpManagerComponent.setViewPublication(String)
public List<SchemaNode> getRequestSchemaNodes()
setRequestSchemaNodes(List)
public void setRequestSchemaNodes(List<SchemaNode> aListOfDataModelNodes)
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.
aListOfDataModelNodes
- List of data model nodes
.SchemaNode
public void setRequestSchemaNodesOrderedByTableNodesOrder(List<SchemaNode> aListOfDataModelNodes)
setRequestSchemaNodes
, except that the export
follows the order of the table nodes instead of the specified list.setRequestSchemaNodes(List)
public boolean isOrderedByTableNodesOrder()
public boolean isCheckAccessRules()
setCheckAccessRules(boolean)
public void setCheckAccessRules(boolean checkAccessRules)
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.
public boolean isSessionDependingDisplay()
setSessionDependingDisplay(boolean)
public void setSessionDependingDisplay(boolean sessionDependingDisplay)
When set to true
:
public String toStringInfo()