public final class XmlExport
extends java.lang.Object
Runtime support is partial at this time; not all modes and features are supported.
| Modifier and Type | Class and Description |
|---|---|
static class |
XmlExport.Escaper
Implementation of the Interface that defines API for the factories stream writers use for creating
"escaping writers".
|
static class |
XmlExport.Fatal
Exception to signal immediate end of export.
|
private static interface |
XmlExport.XmlElementWriter
Implementations of this interface actively write XML /XSD code.
|
private static interface |
XmlExport.XmlWriter
Implementations of this interface actively write XML /XSD code.
|
| Modifier and Type | Field and Description |
|---|---|
private static TempTableSchema.Column |
AFTER_ROWID |
private static java.lang.String |
ATTR_NS_XSI
XML namespace attribute
|
private static java.lang.String |
ATTR_XSI_NIL
Nil attribute
|
private java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
childByParent
Parent -> Child table names for the NESTED relations
|
private java.util.Set<java.lang.String> |
childFields
Child fields for the current NESTED relations with FOREIGN-KEY-HIDDEN = true
|
private java.util.Map<java.lang.String,java.util.Set<java.lang.String>> |
childFieldsByChild
Child fields for NESTED relations with FOREIGN-KEY-HIDDEN = true per child table name
|
private int |
childRecords
Number of child records just read
|
private static TempTableSchema.Column |
DATASOURCE_ROWID |
private DataSet |
ds
The current
DataSet, if one is processed. |
private java.lang.String |
dsName
The current
DataSet name, if one is processed. |
private java.lang.String |
encoding
Character encoding (not currently used).
|
private static TempTableSchema.Column |
ERROR_FLAG |
private static TempTableSchema.Column |
ERROR_STRING |
private boolean |
external
Flag indicating that we're creating external schema
|
private java.util.Map<java.lang.String,java.lang.String> |
extSchemas
External schemas by NS
|
private boolean |
format
Flag indicating whether XML output should be pretty-printed
|
private boolean |
hasChild
Current table has childs
|
private static java.lang.String |
INDENT
The 4GL output files use a 2-space indentation.
|
private int |
indentLevel
The indentation level.
|
private java.util.Map<java.lang.Integer,org.apache.commons.lang3.tuple.Pair<java.lang.String,TableMapper.LegacyIndexInfo>> |
indexes
The list of indexes, in order of their buffers.
|
private java.util.Set<DataRelation> |
keyrefs
We store here the
DataRelations which have promoted to xsd:keyrefs. |
private static java.lang.String |
lineSep
Platform-specific line separator
|
private static CentralLogger |
LOG
Logger
|
private boolean |
nested
Flag indicating that we're creating schema for the tested table
|
private static XmlExport.XmlElementWriter |
NOOP
noop XmlElementWriter
|
private static java.lang.String |
NS_URI
Namespace URI for XML schema
|
private java.lang.String |
nsPrefix
The current
DataSet prefix, if one is processed. |
private java.lang.String |
nsUri
The current
DataSet namespace, if one is processed. |
private static TempTableSchema.Column |
ORIGIN_ROWID |
private java.util.Map<java.lang.String,java.lang.String> |
parentByChild
Child -> Parent table names for the NESTED relations
|
private java.util.Map<java.lang.String,java.lang.String> |
prefixByNs
Default prefix for NS by NS
|
private int |
prodataRelationCount
Number of DataSet non PARENT-ID-RELATION relations
|
private java.util.Map<java.lang.String,org.apache.commons.lang3.tuple.Pair<java.lang.String,java.lang.String>> |
prodsErrors
The map with eventual error strings.
|
private int |
relCount
Number of DataSet relations
|
private java.lang.String |
rootNsPrefix
The namespace prefix for the currently exported temp-table, which is a root of the nested realtions tree
|
private java.lang.String |
rootNsUri
The namespace for the currently exported temp-table, which is a root of the nested realtions tree
|
private int |
rootsWritten
Number of dataset/tables root element written
|
private java.lang.String |
rootTableName
Root table name (for DATA-SET:WRITE-XML(SCHEMA) with SERIALIZE-HIDDEN = true
|
private int |
rootTableRecordsWritten
Number of root table records written
|
private static TempTableSchema.Column |
ROW_STATE |
private java.util.Stack<java.lang.Boolean> |
savedHasChild
Stack of 'hasChild' flag values
|
private boolean |
serializeHidden
The value of the DataSet SERIALIZE-HIDDEN attribute
|
private java.util.Map<java.lang.String,TempTableSchema> |
tables
The map of DATA-SET tables by legacy names
|
private java.util.Map<java.lang.String,java.util.List<TempTableSchema>> |
tablesByNs
The DATA-SET tables grouped by namespace.
|
private TargetData |
target
XML data target which normalizes access of various media to an output stream.
|
private java.lang.String |
ttNsPrefix
The namespace prefix for the currently exported temp-table, if any.
|
private java.util.Map<java.lang.String,TableMapper.LegacyIndexInfo> |
uidxByUniqueNames
Unique names for unique indexes map to their original
LegacyIndexInfo objects. |
private java.util.Map<TableMapper.LegacyIndexInfo,java.lang.String> |
uidxUniqueNames
Maps the
LegacyIndexInfo objects to unique names for them, if their name is not unique
across the dataset. |
private javax.xml.stream.XMLStreamWriter |
writer
XML stream writer
|
private XmlExport.XmlElementWriter |
writeXmlSchema
XML schema writer
|
private java.util.Set<java.lang.String> |
writtenSchemas
Tables schemas already written
|
private boolean |
xsiWritten
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" was written
|
| Constructor and Description |
|---|
XmlExport(TargetData target,
boolean formatted,
java.lang.String encoding)
Constructor which saves the internal data for writing a XML/XSD stream.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
attrFailure()
Report warnings 13065/13093, and finish export.
|
private java.lang.String |
extSchemaName(java.lang.String ns)
Get the name of the external schema for the namespace.
|
private void |
indent()
Write a soft indent to the XML output stream, if formatting is enabled.
|
private static boolean |
isEmpty(java.lang.String s)
Check if the string is empty.
|
private void |
lineBreak()
Write a line break to the XML output stream, if formatting is enabled.
|
private boolean |
serializeDsTables(boolean writeBeforeImage,
boolean omitInitialValues)
Serialize DataSet tables
|
private int |
serializeTempTable(DataRelation relation,
TemporaryBuffer buffer,
java.lang.String rowName,
java.lang.String xmlns,
boolean omitInitialValues,
boolean includeHidden,
boolean includeProds,
boolean before)
Writes the content of a TEMP-TABLE to serializer.
|
private boolean |
tables(boolean forSchema)
Extract tables's data from the DATASET
|
private boolean |
write(XmlExport.XmlWriter code,
java.lang.String method,
java.lang.String widgetType)
The framework for writing a XML file.
|
private void |
writeAnnotation(boolean minSchema)
Write DATA-SET schema annotation
|
private void |
writeBeforeBuffer()
Write BEFORE-BUFFER data.
|
private BufferImpl |
writeBeforeData(BufferImpl buf,
TempRecord dmo)
Write before data
|
private void |
writeChildRecords(BufferImpl buf,
TempRecord dmo,
boolean prodsId,
boolean omitInitialValues)
Write child records of the current record
|
private boolean |
writeColumnAttrs(TempTableSchema schema,
TempTableSchema.Column column,
java.util.SortedSet<java.lang.Integer> fields,
boolean hasAttributes,
boolean defaultValues,
boolean minSchema,
boolean isDataset)
Writes the XML-SCHEMA element or attrubute of a TEMP-TABLE column to XML stream.
|
private void |
writeColumns(Record dmo,
java.lang.Iterable<TempTableSchema.Column> columns,
boolean hidden,
boolean noInit)
Write data for the given columns from a single record into the XML output stream.
|
private void |
writeComplexType(XmlExport.XmlElementWriter bodyWriter,
XmlExport.XmlElementWriter attrWriter)
Write the element.
|
boolean |
writeDataset(DataSet dataSet,
java.lang.String schemaLocation,
boolean writeXmlSchema,
boolean minXmlSchema,
boolean writeBeforeImage,
boolean omitInitialValues)
Performs the export of a DATASET.
|
private void |
writeDatasetIndexes()
Write DATA-SET indexes
|
private void |
writeDataSetKeyRefs()
Write DATA-SET data relations.
|
boolean |
writeDatasetSchema(DataSet dataSet,
boolean minSchema,
boolean noInitial)
Performs the export of a DATASET schema.
|
private boolean |
writeDatasetSchemaImpl(boolean minSchema,
boolean defaultValues,
java.lang.String nodeName)
Writes a XML-SCHEMA to XML stream.
|
private void |
writeDatum(TempTableSchema.Column column,
BaseDataType datum)
Write a single data value to the XML output stream, according to the instructions stored
in the temp-table schema.
|
private void |
writeDatum2(TempTableSchema.Column column,
BaseDataType datum)
Write a single data value to the XML output stream, according to the instructions stored
in the temp-table schema.
|
private void |
writeDsSchemaBody(java.lang.String nodeName,
boolean minSchema,
boolean defaultValues)
Write DATA-SET schema body
|
private void |
writeDsTables(boolean minSchema,
boolean defaultValues)
Write DATA-SET tables' schemas
|
private void |
writeDsTableSchema(BufferImpl after,
boolean minSchema,
boolean defaultValues)
Write DATA-SET table schema
|
private void |
writeElement(java.lang.String name,
XmlExport.XmlElementWriter attrWriter)
Write the element.
|
private void |
writeElement(java.lang.String name,
XmlExport.XmlElementWriter attrWriter,
XmlExport.XmlElementWriter bodyWriter)
Write the element.
|
private void |
writeEndElement()
Write end of the element.
|
private boolean |
writeExternalSchema(java.lang.String ns,
boolean minSchema,
boolean defaultValues)
Write external schema for a namespace
|
private void |
writeProdErrors()
Write errors.
|
boolean |
writeRecord(BufferImpl bufferImpl,
boolean omitInitial)
Writes a single record.
|
private void |
writeRecord(TemporaryBuffer buffer,
TempRecord dmo,
java.lang.String rowName,
TempTableSchema schema,
java.lang.String xmlns,
boolean hidden,
boolean prodsId,
boolean before,
boolean omitInitialValues)
Write a temp-table record's data to the XML output stream.
|
private void |
writeSchema(java.lang.String nsPrefix,
java.lang.String nsUri)
Write
schema element of a table/data-set. |
private void |
writeStartElement(java.lang.String name)
Write start of the element.
|
private void |
writeTableColums(BufferImpl buffer,
TempTableSchema schema,
java.lang.String tableName,
boolean defaultValues,
boolean minSchema,
boolean inDataset,
boolean isDataset)
Write table schema columns
|
private void |
writeTableElement(TempTableSchema schema,
boolean minSchema,
java.lang.String tableName,
java.lang.String legacyName,
java.lang.String xmlNodeName,
java.lang.String nsPrefix,
boolean isDataSet)
Write
element element of a table. |
private boolean |
writeTableSchema(BufferImpl buffer,
TempTableSchema schema,
boolean minSchema,
boolean defaultValues)
Performs the export of a TEMP-TABLE schema.
|
private boolean |
writeTableSchema(BufferImpl buffer,
TempTableSchema schema,
boolean minSchema,
boolean defaultValues,
boolean inDataset)
Performs the export of a TEMP-TABLE schema.
|
boolean |
writeTableSchema(TemporaryBuffer buffer,
boolean minSchema,
boolean noInitial)
Performs the export of a TEMP-TABLE schema.
|
private boolean |
writeTableSchemaImpl(BufferImpl buffer,
TempTableSchema schema,
java.lang.String tableName,
boolean defaultValues,
boolean minSchema,
boolean inDataset)
Writes the XML-SCHEMA of a TEMP-TABLE to XML stream.
|
boolean |
writeTempTable(TemporaryBuffer buffer,
java.lang.String schemaLocation,
boolean writeXmlSchema,
boolean minXmlSchema,
boolean writeBeforeImage,
boolean omitInitialValues)
Constructor which immediately performs the export of a TEMP-TABLE.
|
private void |
writeTextElement(java.lang.String name,
XmlExport.XmlElementWriter attrWriter,
XmlExport.XmlElementWriter textWriter)
Write the element with text node only.
|
private boolean |
writeToHandle(java.util.function.Function<XmlExport,java.lang.Boolean> writer)
Export to a handle.
|
private static final CentralLogger LOG
private static final java.lang.String INDENT
private static final java.lang.String ATTR_NS_XSI
private static final java.lang.String NS_URI
private static final java.lang.String ATTR_XSI_NIL
private static final java.lang.String lineSep
private static final XmlExport.XmlElementWriter NOOP
private final boolean format
private final TargetData target
private final java.lang.String encoding
private boolean external
private boolean nested
private javax.xml.stream.XMLStreamWriter writer
private int indentLevel
private DataSet ds
DataSet, if one is processed. null if a table is processed.private java.lang.String dsName
DataSet name, if one is processed. null if a table is processed.private java.lang.String nsUri
DataSet namespace, if one is processed. null if a table is processed.private java.lang.String nsPrefix
DataSet prefix, if one is processed. null if a table is processed.private boolean serializeHidden
private int relCount
private int prodataRelationCount
private final java.util.Map<java.lang.Integer,org.apache.commons.lang3.tuple.Pair<java.lang.String,TableMapper.LegacyIndexInfo>> indexes
private final java.util.Map<java.lang.String,TempTableSchema> tables
private java.util.Map<java.lang.String,java.util.List<TempTableSchema>> tablesByNs
private java.util.Map<java.lang.String,java.lang.String> extSchemas
private java.util.Set<java.lang.String> writtenSchemas
private java.util.Map<java.lang.String,java.lang.String> prefixByNs
private final java.util.Map<java.lang.String,java.util.List<java.lang.String>> childByParent
private final java.util.Map<java.lang.String,java.lang.String> parentByChild
private java.util.Map<java.lang.String,java.util.Set<java.lang.String>> childFieldsByChild
private java.util.Set<java.lang.String> childFields
private final java.util.Map<java.lang.String,org.apache.commons.lang3.tuple.Pair<java.lang.String,java.lang.String>> prodsErrors
private XmlExport.XmlElementWriter writeXmlSchema
private java.lang.String rootNsUri
private java.lang.String rootNsPrefix
private java.lang.String ttNsPrefix
private boolean hasChild
private int childRecords
private final java.util.Stack<java.lang.Boolean> savedHasChild
private boolean xsiWritten
private int rootsWritten
private java.lang.String rootTableName
private int rootTableRecordsWritten
private final java.util.Map<TableMapper.LegacyIndexInfo,java.lang.String> uidxUniqueNames
LegacyIndexInfo objects to unique names for them, if their name is not unique
across the dataset.private final java.util.Map<java.lang.String,TableMapper.LegacyIndexInfo> uidxByUniqueNames
LegacyIndexInfo objects. This is the
reverse of uidxUniqueNames. All unique indexes can be found here.private final java.util.Set<DataRelation> keyrefs
DataRelations which have promoted to xsd:keyrefs. Those not present
in this set will be serialized as prodata:relations.private static final TempTableSchema.Column ERROR_FLAG
private static final TempTableSchema.Column ORIGIN_ROWID
private static final TempTableSchema.Column DATASOURCE_ROWID
private static final TempTableSchema.Column ERROR_STRING
private static final TempTableSchema.Column AFTER_ROWID
private static final TempTableSchema.Column ROW_STATE
public XmlExport(TargetData target, boolean formatted, java.lang.String encoding)
target - XML data target which normalizes access of various media to an output stream.formatted - true if serialized output should be pretty-printed for human-friendly
reading; false to omit formatting.encoding - Character encoding (not currently used).public boolean writeDataset(DataSet dataSet, java.lang.String schemaLocation, boolean writeXmlSchema, boolean minXmlSchema, boolean writeBeforeImage, boolean omitInitialValues)
dataSet - The DatSet from which data is exported.schemaLocation - Path to XML schema (not currently used).writeXmlSchema - true to write XML schema information; false to write only data.
If true, schema will be written to schemaLocation, if provided;
if not provided, schema will be embedded in XML output. Not currently honored.minXmlSchema - true to write minimal schema information; false to write verbose
schema information. Ignored if writeXmlSchema is false. Not
currently honored.writeBeforeImage - Not currently honored.omitInitialValues - If true, record values which match default initial values will be omitted
from serialized output, else they will be included. Not currently honored.true on success. Otherwise the error is already dispatched to
ErrorManager before returning.private boolean serializeDsTables(boolean writeBeforeImage,
boolean omitInitialValues)
writeBeforeImage - Not currently honored.omitInitialValues - If true, record values which match default initial values will be omitted
from serialized output, else they will be included. Not currently honored.true if at least of the tables has changesprivate void writeProdErrors()
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException - on Errorpublic boolean writeTempTable(TemporaryBuffer buffer, java.lang.String schemaLocation, boolean writeXmlSchema, boolean minXmlSchema, boolean writeBeforeImage, boolean omitInitialValues)
buffer - Temp-table buffer from which data is exported.schemaLocation - Path to XML schema (not currently used).writeXmlSchema - true to write XML schema information; false to write only data.
If true, schema will be written to schemaLocation, if provided;
if not provided, schema will be embedded in XML output. Not currently honored.minXmlSchema - true to write minimal schema information; false to write verbose
schema information. Ignored if writeXmlSchema is false. Not
currently honored.writeBeforeImage - Not currently honored.omitInitialValues - If true, record values which match default initial values will be omitted
from serialized output, else they will be included. Not currently honored.true on success. Otherwise the error is already dispatched to
ErrorManager before returning.public boolean writeDatasetSchema(DataSet dataSet, boolean minSchema, boolean noInitial)
dataSet - The DatSet to be described.minSchema - true to write minimal schema information; false to write verbose
schema information. Ignored if writeXmlSchema is false. Not
currently honored.noInitial - If true, record values which match default initial values will be omitted
from serialized output, else they will be included. Not currently honored.true on success. Otherwise, the error is already dispatched to
ErrorManager before returning.private boolean tables(boolean forSchema)
forSchema - Flag indicating that data is extracted for WRITE-XMLSCHEMAtrue if OK.public boolean writeTableSchema(TemporaryBuffer buffer, boolean minSchema, boolean noInitial)
buffer - A buffer of a TempTable to be described.minSchema - true to write minimal schema information; false to write verbose
schema information. Ignored if writeXmlSchema is false.noInitial - If true, record values which match default initial values will be omitted
from serialized output, else they will be included. Not currently honored.true on success. Otherwise, the error is already dispatched to
ErrorManager before returning.public boolean writeRecord(BufferImpl bufferImpl, boolean omitInitial)
bufferImpl - The buffer which holds the record to be exported.omitInitial - If true the unmodified fields (those that are equals to the declared initial value)
are skipped in order to minimize the output.true if operation is successful and false if an error occurred.private boolean writeToHandle(java.util.function.Function<XmlExport,java.lang.Boolean> writer)
X-Document is currently supported.writer - The writer function.true if the export was successful.private boolean writeTableSchema(BufferImpl buffer, TempTableSchema schema, boolean minSchema, boolean defaultValues) throws javax.xml.stream.XMLStreamException
buffer - A buffer of a TempTable to be described.schema - The schema of the TEMP-TABLE.minSchema - true to write minimal schema information; false to write verbose
schema information. Ignored if writeXmlSchema is false. Not
currently honored.defaultValues - If true, record values which match default initial values will be omitted
from serialized output, else they will be included.
NOTE: actually setting [defaultValues] to [TRUE] which is the [omit-initial-values] from
ABL will cause some extra info to be added in field description (see + attributes):
<xsd:element name="f11" type="xsd:string" nillable="true" +minOccurs="0" +default=""/>
<xsd:element name="f12" type="xsd:int" nillable="true" +minOccurs="0" +default="0"/>
<xsd:element name="f13" type="xsd:date" nillable="true" +minOccurs="0" +prodata:initial="prodata:unknown"/>
<xsd:element name="f14" type="xsd:decimal" nillable="true" +minOccurs="0" +default="0.0"/>
true on success. Otherwise the error is already dispatched to
ErrorManager before returning.javax.xml.stream.XMLStreamException - If XML-related issued occur.private boolean writeTableSchema(BufferImpl buffer, TempTableSchema schema, boolean minSchema, boolean defaultValues, boolean inDataset) throws javax.xml.stream.XMLStreamException
buffer - A buffer of a TempTable to be described.schema - The schema of the TEMP-TABLE.minSchema - true to write minimal schema information; false to write verbose
schema information. Ignored if writeXmlSchema is false. Not
currently honored.defaultValues - If true, record values which match default initial values will be omitted
from serialized output, else they will be included.
NOTE: actually setting [defaultValues] to [TRUE] which is the [omit-initial-values] from
ABL will cause some extra info to be added in field description (see + attributes):
<xsd:element name="f11" type="xsd:string" nillable="true" +minOccurs="0" +default=""/>
<xsd:element name="f12" type="xsd:int" nillable="true" +minOccurs="0" +default="0"/>
<xsd:element name="f13" type="xsd:date" nillable="true" +minOccurs="0" +prodata:initial="prodata:unknown"/>
<xsd:element name="f14" type="xsd:decimal" nillable="true" +minOccurs="0" +default="0.0"/>
inDataset - If true, this is part of a dataset SCHEMA and additional attributes will
be written.true on success. Otherwise the error is already dispatched to
ErrorManager before returning.javax.xml.stream.XMLStreamException - If XML-related issued occur.private void writeStartElement(java.lang.String name)
throws javax.xml.stream.XMLStreamException
name - element name.javax.xml.stream.XMLStreamExceptionprivate void writeComplexType(XmlExport.XmlElementWriter bodyWriter, XmlExport.XmlElementWriter attrWriter) throws javax.xml.stream.XMLStreamException
bodyWriter - body writerattrWriter - attributes' writerjavax.xml.stream.XMLStreamExceptionprivate void writeElement(java.lang.String name,
XmlExport.XmlElementWriter attrWriter)
throws javax.xml.stream.XMLStreamException
name - element name.attrWriter - attributes' writerjavax.xml.stream.XMLStreamExceptionprivate void writeTextElement(java.lang.String name,
XmlExport.XmlElementWriter attrWriter,
XmlExport.XmlElementWriter textWriter)
throws javax.xml.stream.XMLStreamException
name - element name.textWriter - attributes' writerjavax.xml.stream.XMLStreamExceptionprivate void writeElement(java.lang.String name,
XmlExport.XmlElementWriter attrWriter,
XmlExport.XmlElementWriter bodyWriter)
throws javax.xml.stream.XMLStreamException
name - element name.attrWriter - attributes' writerbodyWriter - body writerjavax.xml.stream.XMLStreamExceptionprivate void writeEndElement()
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionprivate void writeTableElement(TempTableSchema schema, boolean minSchema, java.lang.String tableName, java.lang.String legacyName, java.lang.String xmlNodeName, java.lang.String nsPrefix, boolean isDataSet) throws javax.xml.stream.XMLStreamException
element element of a table.schema - table schema.minSchema - true to write minimal schema information; false to write verbose
schema information.tableName - table name.legacyName - table legacy name.xmlNodeName - table XML node name.nsPrefix - table XML prefix.isDataSet - flag indicating that the table is a part of a data-set.javax.xml.stream.XMLStreamException - on errorprivate void writeSchema(java.lang.String nsPrefix,
java.lang.String nsUri)
throws javax.xml.stream.XMLStreamException
schema element of a table/data-set.nsPrefix - XML prefix of a table/data-set.nsUri - XML namespace URI of a table/data-set.javax.xml.stream.XMLStreamException - on error.private boolean writeDatasetSchemaImpl(boolean minSchema,
boolean defaultValues,
java.lang.String nodeName)
throws javax.xml.stream.XMLStreamException
minSchema - true to write minimal schema information; false to write verbose
schema information. Ignored if writeXmlSchema is false. Not
currently honored.defaultValues - If true, the initial values for the fields will be written.nodeName - The DataSet's node name.true on success. Otherwise the error is already dispatched to
ErrorManager before returning.javax.xml.stream.XMLStreamException - If XML-related issued occurs.private void writeDsSchemaBody(java.lang.String nodeName,
boolean minSchema,
boolean defaultValues)
throws javax.xml.stream.XMLStreamException
minSchema - true to write minimal schema information; false to write verbose
schema information. Ignored if writeXmlSchema is false. Not
currently honored.defaultValues - If true, the initial values for the fields will be written.nodeName - The DataSet's node name.javax.xml.stream.XMLStreamException - If XML-related issued occurs.private void writeDsTables(boolean minSchema,
boolean defaultValues)
throws javax.xml.stream.XMLStreamException
minSchema - true to write minimal schema information; false to write verbose
schema information. Ignored if writeXmlSchema is false. Not
currently honored.defaultValues - If true, the initial values for the fields will be written.javax.xml.stream.XMLStreamException - If XML-related issued occurs.private void writeDsTableSchema(BufferImpl after, boolean minSchema, boolean defaultValues) throws javax.xml.stream.XMLStreamException
after - table buffer.minSchema - true to write minimal schema information; false to write verbose
schema information. Ignored if writeXmlSchema is false. Not
currently honored.defaultValues - If true, the initial values for the fields will be written.javax.xml.stream.XMLStreamException - If XML-related issued occurs.private void writeAnnotation(boolean minSchema)
throws javax.xml.stream.XMLStreamException
minSchema - true to write minimal schema information; false to write verbose
schema information. Ignored if writeXmlSchema is false. Not
currently honored.javax.xml.stream.XMLStreamException - If XML-related issued occurs.private void writeDataSetKeyRefs()
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException - If XML-related issued occurs.private void writeDatasetIndexes()
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException - If XML-related issued occurs.private boolean writeExternalSchema(java.lang.String ns,
boolean minSchema,
boolean defaultValues)
throws javax.xml.stream.XMLStreamException
ns - namespaceminSchema - true to write minimal schema information; false to write verbose
schema information. Ignored if writeXmlSchema is false. Not
currently honored.defaultValues - If true, the initial values for the fields will be written.javax.xml.stream.XMLStreamException - If XML-related issued occur.private java.lang.String extSchemaName(java.lang.String ns)
ns - namespaceprivate boolean writeTableSchemaImpl(BufferImpl buffer, TempTableSchema schema, java.lang.String tableName, boolean defaultValues, boolean minSchema, boolean inDataset) throws javax.xml.stream.XMLStreamException
buffer - The buffer that identifies the TEMP-TABLE to be described.schema - The schema of the TEMP-TABLE.tableName - The name of the table.defaultValues - If true the initial values are written for the fields that declared them.minSchema - true to write minimal schema information; false to write verbose
schema information. Ignored if writeXmlSchema is false.inDataset - If true, this is part of a dataset SCHEMA and additional attributes will
be written.true on success. Otherwise the error is already dispatched to
ErrorManager before returning.javax.xml.stream.XMLStreamException - If XML-related issued occurs.private void writeTableColums(BufferImpl buffer, TempTableSchema schema, java.lang.String tableName, boolean defaultValues, boolean minSchema, boolean inDataset, boolean isDataset) throws javax.xml.stream.XMLStreamException
buffer - The buffer that identifies the TEMP-TABLE to be described.schema - The schema of the TEMP-TABLE.tableName - The name of the table.defaultValues - If true the initial values are written for the fields that declared them.minSchema - true to write minimal schema information; false to write verbose
schema information. Ignored if writeXmlSchema is false.inDataset - If true, this is part of a dataset SCHEMA and additional attributes will
be written.isDataset - Flag indicating that the table is a part of a dataset.javax.xml.stream.XMLStreamException - If XML-related issued occurs.private void writeBeforeBuffer()
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException - If XML-related issued occurs.private boolean writeColumnAttrs(TempTableSchema schema, TempTableSchema.Column column, java.util.SortedSet<java.lang.Integer> fields, boolean hasAttributes, boolean defaultValues, boolean minSchema, boolean isDataset) throws javax.xml.stream.XMLStreamException
schema - The schema of the TEMP-TABLE.defaultValues - If true the initial values are written for the fields that declared them.column - The table column in questionfields - Sorted set of the taable fields ORDERs (to calculate userOrder attribute)hasAttributes - Flag indicating that schema contains attributesminSchema - true to write minimal schema information; false to write verbose
schema information. Ignored if writeXmlSchema is false.isDataset - If true, this is part of a dataset SCHEMA and additional attributes will
be written.true on success. Otherwise the error is already dispatched to
ErrorManager before returning.javax.xml.stream.XMLStreamException - If XML-related issued occurs.private int serializeTempTable(DataRelation relation, TemporaryBuffer buffer, java.lang.String rowName, java.lang.String xmlns, boolean omitInitialValues, boolean includeHidden, boolean includeProds, boolean before)
relation - The relation on which this buffer is a child of.buffer - The buffer to be used for accessing TEMP-TABLE records.rowName - The name of the XML element that holds a record.xmlns - The XML namespace uri, is set.omitInitialValues - Flag indicating that initial values should be not serilaizedincludeHidden - If true, the hidden fields will also be dumped.includeProds - If true, the PROGRESS specific attribute will be written.before - This is a BEFORE table. Rows written will be slightly decorated.ErrorManager before returning.private void writeRecord(TemporaryBuffer buffer, TempRecord dmo, java.lang.String rowName, TempTableSchema schema, java.lang.String xmlns, boolean hidden, boolean prodsId, boolean before, boolean omitInitialValues)
buffer - The buffer being serialized.dmo - Object containing temp-table record's data.rowName - Name applied to the element or attribute associated with the row data in the XML
output.schema - The table schema to be used.xmlns - The XML namespace uri, is set.hidden - If true include the hidden fields (__name__) for each record
written to stream.prodsId - If true include the prods:id attribute for each record written.before - true if a BEFORE-TABLE record is processed.private BufferImpl writeBeforeData(BufferImpl buf, TempRecord dmo) throws javax.xml.stream.XMLStreamException
buf - The buffer being serialized.dmo - Object containing temp-table record's data.javax.xml.stream.XMLStreamException - on errorprivate void writeChildRecords(BufferImpl buf, TempRecord dmo, boolean prodsId, boolean omitInitialValues)
buf - The buffer being serialized.dmo - Object containing temp-table record's data.prodsId - If true include the prods:id attribute for each record written.omitInitialValues - Flag indicating that initial values should be not serilaizedprivate void writeColumns(Record dmo, java.lang.Iterable<TempTableSchema.Column> columns, boolean hidden, boolean noInit) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException, java.lang.reflect.InvocationTargetException, javax.xml.stream.XMLStreamException
dmo - The DMO to be serialized.columns - The set of columns for that DMO.hidden - If true include the hidden fields (__name__) for each record
written to stream.java.lang.IllegalAccessException - if a DMO getter method cannot be accessed using reflection.java.lang.IllegalArgumentException - if an illegal argument is passed to the DMO getter method for a column.java.lang.reflect.InvocationTargetException - if there is a problem invoking a getter method on the given DMO.javax.xml.stream.XMLStreamException - if there is an error writing to the XML stream.private void writeDatum(TempTableSchema.Column column, BaseDataType datum) throws javax.xml.stream.XMLStreamException
This version ensures that the group and decimal separators are ',' and '.' for the duration of the serialization.
column - Temp-table column schema information.datum - Datum to be written to XML output.javax.xml.stream.XMLStreamException - if there is an error writing to the XML stream.private void writeDatum2(TempTableSchema.Column column, BaseDataType datum) throws javax.xml.stream.XMLStreamException
column - Temp-table column schema information.datum - Datum to be written to XML output.javax.xml.stream.XMLStreamException - if there is an error writing to the XML stream.private void lineBreak()
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException - if there is an error writing to the XML stream.private void indent()
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException - if there is an error writing to the XML stream.private boolean write(XmlExport.XmlWriter code, java.lang.String method, java.lang.String widgetType)
target
with requested encoding, write XML header and allow the code to write
the XML body (main element). At the end, the end of document is written and the file is
closed.
In case that the code exit abruptly, the expected Exception s are catched as
a last resort and the stack trace is printed.
code - The code to be executed. It should build the actual XML content.method - The identifier for the method using the source stream.
Only used for composing the error messages.widgetType - The parent widget. Only used for composing the error messages.true on success. Otherwise the error is already dispatched to
ErrorManager before returning.private void attrFailure()
private static boolean isEmpty(java.lang.String s)
s - String to be checkedtrue if the string is empty