public static class DataSet.Builder
extends java.lang.Object
DataSet
object statically, that is, using the
DEFINE DATASET
statement. It exposes a set of chaining methods that take each
option parameters and set them into the DataSet
being constructed. The chaining must
finish with generate()
to obtain the final DataSet
object. Before
returning, the generate()
will do the final checks and register the object to be
returned with the DataSetManager
.Modifier and Type | Field and Description |
---|---|
private java.util.List<java.lang.Runnable> |
buildChain |
private boolean |
isNew
This is a builder for a shared new
DataSet . |
private boolean |
isShared
This is a builder for a shared
DataSet . |
private java.lang.String |
legacyName
The legacy name of the
DataSet . |
private boolean |
referenceOnly
This is a reference of a
DataSet defined in another procedure / class. |
private DataSet |
target |
Constructor and Description |
---|
Builder(java.lang.String legacyName,
boolean isShared,
boolean isNew)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
DataSet.Builder |
addDataRelation(java.lang.String relName,
boolean reposition,
boolean nested,
boolean fkHidden,
boolean inactive,
boolean recursive,
Buffer parent,
Buffer child,
DataSet.FieldPair... relationFieldPairs)
Configure a data relation.
|
DataSet.Builder |
addParentIdRelation(java.lang.String relName,
Buffer parentBuffer,
Buffer childBuffer,
java.lang.String parentIdField)
This method chains a
PARENT-ID-RELATION option to the DataSet builder. |
DataSet.Builder |
addParentIdRelation(java.lang.String relName,
Buffer parentBuffer,
Buffer childBuffer,
java.lang.String parentIdField,
java.lang.String[] parentFieldsBefore,
java.lang.String[] parentFieldsAfter)
This method chains a
PARENT-ID-RELATION option to the DataSet builder. |
DataSet.Builder |
forBuffers(Buffer... bufs)
Configures the set of buffers for the
DataSet . |
DataSet |
generate()
Validates and registers the
DataSet to DataSetManager , making it valid. |
DataSet.Builder |
setNamespacePrefix(java.lang.String prefix)
Sets the ns prefix attribute.
|
DataSet.Builder |
setNamespaceUri(java.lang.String namespace)
Sets the namespace attribute.
|
DataSet.Builder |
setReferenceOnly()
Mark the DataSet as reference only.
|
DataSet.Builder |
setSerializeHidden()
Mark the DataSet's serialize-hidden attribute.
|
DataSet.Builder |
setSerializeName(java.lang.String serName)
Sets the serialize name attribute.
|
DataSet.Builder |
setXmlNodeName(java.lang.String nodeName)
Sets the name of the xml node attribute.
|
DataSet.Builder |
setXmlNodeType(java.lang.String nodeType)
Sets the xml node type attribute.
|
private final boolean isShared
DataSet
.private final boolean isNew
DataSet
.private final java.lang.String legacyName
DataSet
.private boolean referenceOnly
DataSet
defined in another procedure / class.private final java.util.List<java.lang.Runnable> buildChain
private DataSet target
public Builder(java.lang.String legacyName, boolean isShared, boolean isNew)
DataSet
.legacyName
- The legacy name of the DataSet
.isShared
- This is a shared DataSet
.isNew
- This is a new DataSet
. Only in combination with isShared
.public DataSet.Builder setNamespaceUri(java.lang.String namespace)
NAMESPACE-URI
option from
DEFINE DATASET
statement.namespace
- The namespace for the DataSet
to be constructed.public DataSet.Builder setNamespacePrefix(java.lang.String prefix)
NAMESPACE-PREFIX
option from
DEFINE DATASET
statement.prefix
- The ns prefix for the DataSet
to be constructed.public DataSet.Builder setXmlNodeName(java.lang.String nodeName)
XML-NODE-NAME
option from
DEFINE DATASET
statement.nodeName
- The xml node name for the DataSet
to be constructed.public DataSet.Builder setSerializeName(java.lang.String serName)
SERIALIZE-NAME
option from
DEFINE DATASET
statement.serName
- The serialize name for the DataSet
to be constructed.public DataSet.Builder setXmlNodeType(java.lang.String nodeType)
XML-NODE-TYPE
option from
DEFINE DATASET
statement.nodeType
- The node type for the DataSet
to be constructed.public DataSet.Builder setSerializeHidden()
SERIALIZE-HIDDEN
option from DEFINE DATASET
statement.public DataSet.Builder setReferenceOnly()
REFERENCE-ONLY
option from
DEFINE DATASET
statement.public DataSet.Builder forBuffers(Buffer... bufs)
DataSet
. Corresponds to FOR
option
from DEFINE DATASET
statement.bufs
- The set buffers for the DataSet
to be constructed.public DataSet.Builder addDataRelation(java.lang.String relName, boolean reposition, boolean nested, boolean fkHidden, boolean inactive, boolean recursive, Buffer parent, Buffer child, DataSet.FieldPair... relationFieldPairs)
DATA-RELATION
set of options from
DEFINE DATASET
statement.relName
- The relation name.reposition
- Specifies the relation mode as REPOSITION
as opposed to the default
SELECTION
relation mode.nested
- If true
, the child rows of a DataSet
buffer are nested within
their parent rows when writing a JSON representation of data or an XML
representation of data or schema.fkHidden
- Specifies that foreign key fields in nested data relations are omitted when
writing JSON or XML data, and that foreign key fields are optional in the XML
Schema representation of the child table definition.
If NESTED
option is false
, this option is ignored.inactive
- Setting this to true
allows to have two relations between the same two
DataSet temp-table buffers, but only have one relation active at a time.recursive
- Allows DataSet FILL
method to load self-referencing elements.parent
- The parent buffer in this data-relation. This must be one of the buffers
identified by the buffers added with forBuffers()
above.child
- The child buffer in this data-relation. This must be one of the buffers
identified by the buffers added with forBuffers()
above.relationFieldPairs
- A set of field pairs (parent, child)*.public DataSet.Builder addParentIdRelation(java.lang.String relName, Buffer parentBuffer, Buffer childBuffer, java.lang.String parentIdField)
PARENT-ID-RELATION
option to the DataSet
builder.relName
- A name for the data relation.parentBuffer
- The parent buffer.childBuffer
- The child buffer.parentIdField
- The field from child buffer of RECID
type that points to a record in
parent buffer.public DataSet.Builder addParentIdRelation(java.lang.String relName, Buffer parentBuffer, Buffer childBuffer, java.lang.String parentIdField, java.lang.String[] parentFieldsBefore, java.lang.String[] parentFieldsAfter)
PARENT-ID-RELATION
option to the DataSet
builder.relName
- A name for the data relation.parentBuffer
- The parent buffer.childBuffer
- The child buffer.parentIdField
- The field from child buffer of RECID
type that points to a record in
parent buffer.parentFieldsBefore
- The list of fields from the parentBuffer
temp-table record that are to
be written to XML before any childBuffer
temp-table records.parentFieldsAfter
- The list of fields from the parentBuffer
temp-table record that are to
be written to XML after all childBuffer
temp-table records.public DataSet generate()
DataSet
to DataSetManager
, making it valid.DataSet
.