public class DataRelation extends HandleResource implements ADMData, CommonHandleChain, DataRelationInterface, DynamicResource, QueryAssociable
DataRelation defines one relation between a pair of parent and child buffers in a
DataSet that have a one-to-one or one-to-many parent-child relationship. A
DataRelation identifies the parent and child buffers, and the fields in each buffer
that define the primary and foreign key fields of the relation.| Modifier and Type | Field and Description |
|---|---|
private boolean |
active
The ACTIVE status of this relation.
|
private java.lang.String |
admData
Current value of PRIVATE-DATA.
|
private java.util.List<java.lang.String> |
afterFields
The set of AFTER fields.
|
private java.util.List<java.lang.String> |
beforeFields
The set of AFTER fields.
|
private BufferImpl |
childBuffer
The child buffer.
|
private DataSet |
dataSet
The parent
DataSet where this DataRelation is defined. |
private boolean |
fkHidden
The FOREIGN-KEY-HIDDEN status of this relation.
|
private boolean |
isValid
Flags for valid property.
|
private int |
maximumLevel
The MAXIMUM-LEVEL status of this relation.
|
private java.lang.String |
name
The value of
NAME attribute. |
private boolean |
nested
The NESTED status of this relation.
|
private BufferImpl |
parentBuffer
The parent buffer.
|
private java.lang.String |
parentLink
For PARENT-ID relations, this specifies the field that points to parent 'foreign' key.
|
private java.lang.String |
privateData
Current value of PRIVATE-DATA.
|
private QueryWrapper |
query
The current value of
QUERY attribute. |
private boolean |
recursive
true to flag this as a RECURSIVE relation. |
private static RefCount |
refCount
Reference counter.
|
private java.lang.String[] |
relationFields
The relation fields for this object.
|
private boolean |
reposition
The REPOSITION status of this relation.
|
private java.lang.String |
whereString
The current value of
WHERE-STRING attribute. |
instProc, pm| Constructor and Description |
|---|
DataRelation(DataSet dataSet,
Buffer parent,
Buffer child,
java.lang.String[] relationFields,
java.lang.String strPairs,
boolean recursive)
Creates a new simple
DataRelation based on join between pairs of fields from parent
and child buffer. |
DataRelation(DataSet dataSet,
Buffer parent,
Buffer child,
java.lang.String parentLink,
java.util.List<java.lang.String> beforeFields,
java.util.List<java.lang.String> afterFields,
boolean dynamic)
Creates a new simple
DataRelation based on join between pairs of fields from parent and child
buffer. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
_dynamic()
Returns
true if the buffer is dynamic. |
(package private) java.lang.String |
_getRelationFields()
Extract the list of relation fields.
|
(package private) boolean |
_isActive()
Checks whether this relation is active.
|
private boolean |
_isParentIdRelation()
Internal check whether this is a parent-id-relation.
|
boolean |
_isRecursive()
Checks whether this data-relation is recursive.
|
(package private) boolean |
_isReposition()
Query the current value of
REPOSITION attribute. |
(package private) void |
confirmDynamic()
Confirms that this object is dynamic.
|
private boolean |
createQuery(java.lang.String where)
Modifies the current WHERE expression that links the child table to its parent.
|
character |
getADMData()
Get the value of the ADM-DATA attribute.
|
handle |
getChildBuffer()
Obtain the buffer handle of the child member of this data-relation object.
|
BufferImpl |
getChildBufferNative()
Obtain the buffer of the child member of this data-relation object.
|
java.lang.String |
getChildTable()
Obtain the name of the child table.
|
handle |
getCurrentQuery()
Obtain the handle to the
DataSet query that contains the currently selected row in
the BindingSource. |
handle |
getCurrentQuery(long bandIndex)
Obtain the handle to the
DataSet query that contains the currently selected row in
the BindingSource. |
handle |
getCurrentQuery(NumberType bandIndex)
Obtain the handle to the
DataSet query that contains the currently selected row in
the BindingSource. |
logical |
getForeignKeyHidden()
Checks whether the foreign key fields in the child records of a nested data-relation are
hidden.
|
integer |
getMaximumLevel()
Obtain the maximum level where a recursive data-relation stops.
|
handle |
getNextSibling()
Get the
NEXT-SIBLING attribute of this handle. |
handle |
getParentBuffer()
Obtain the buffer handle of the parent member.
|
BufferImpl |
getParentBufferNative()
Obtain the buffer of the parent member.
|
character |
getParentFieldsAfter()
Obtain a comma-separated list of fields from the parent record in the relation to be
written to XML after all nested child records.
|
character |
getParentFieldsBefore()
Obtain a comma-separated list of fields from the parent record in the relation to be
written to XML before any nested child records.
|
java.lang.String |
getParentTable()
Obtain the name of the parent table.
|
handle |
getPrevSibling()
Get the
PREV-SIBLING attribute of this handle. |
character |
getPrivateData()
Get the
PRIVATE-DATA attribute of this handle. |
QueryWrapper |
getQuery()
Get the query associated with this relation.
|
handle |
getQueryAsHandle()
Get the query associated with this relation.
|
java.lang.String[] |
getRelationFieldArray()
The original set of field pairs.
|
character |
getRelationFields()
Obtains a comma-separated list of parent-field, child-field pairs describing the
relationship between parent and child buffers as specified in the data-relation object
definition.
|
java.lang.String[] |
getRelationFields(boolean parent)
Extracts the list of relation fields for only one of the tables, in form of an array.
|
logical |
getReposition()
Obtain the reposition mode of this data-relation object.
|
character |
getWhereString()
Obtains the current WHERE expression from the query generated that links the child table to
its parent.
|
protected boolean |
hasNameConstraints()
Allows each resource to declare whether it has some naming constraints.
|
logical |
isActive()
Corresponds to
ACTIVE ABL attribute. |
logical |
isNested()
Checks whether child rows of a
DataSet temp-table buffer are nested within their
parent rows when writing the XML representation of DataSet object that contains
data-relations. |
logical |
isParentIdRelation()
Checks whether the relationship between parent and child records is based on the
RECID type of the parent record. |
logical |
isRecursive()
Checks whether this data-relation is recursive.
|
character |
name()
Get the
name attribute of this object. |
void |
name(character name)
Set the
name attribute of this object. |
void |
name(java.lang.String name)
Set the
name attribute of this object. |
protected boolean |
resourceDelete()
Worker to be implemented by each resource.
|
void |
setActive(boolean active)
Corresponds to
ACTIVE ABL attribute. |
void |
setActive(logical active)
Corresponds to
ACTIVE ABL attribute. |
void |
setADMData(character value)
Set the value of the ADM-DATA attribute.
|
void |
setADMData(java.lang.String value)
Set the value of the ADM-DATA attribute.
|
void |
setForeignKeyHidden(boolean hide)
Configures whether the foreign key fields in the child records of a nested data-relation are
hidden.
|
void |
setForeignKeyHidden(logical hide)
Configures whether the foreign key fields in the child records of a nested data-relation are
hidden.
|
void |
setMaximumLevel(long max)
Configures the maximum level where a recursive data-relation stops.
|
void |
setMaximumLevel(NumberType max)
Configures the maximum level where a recursive data-relation stops.
|
void |
setNested(boolean nested)
Configures whether child rows of a
DataSet temp-table buffer are nested within their
parent rows when writing the XML representation of DataSet object that contains
data-relations. |
void |
setNested(logical nested)
Configures whether child rows of a
DataSet temp-table buffer are nested within their
parent rows when writing the XML representation of DataSet object that contains
data-relations. |
void |
setPrivateData(character data)
Set the
PRIVATE-DATA attribute of this handle. |
void |
setPrivateData(java.lang.String data)
Set the
PRIVATE-DATA attribute of this handle. |
void |
setQueryAsHandle(handle qry)
Set the query associated with the given resource.
|
void |
setQueryAsHandle(QueryWrapper qry)
Set the query associated with the given resource.
|
void |
setReposition(boolean reposition)
Sets the reposition mode of this data-relation object.
|
void |
setReposition(logical reposition)
Sets the reposition mode of this data-relation object.
|
void |
setWhereString(java.lang.String where)
Modifies the current WHERE expression that links the child table to its parent.
|
void |
setWhereString(Text where)
Modifies the current WHERE expression that links the child table to its parent.
|
java.lang.String |
toString()
Returns a string representation of this object.
|
boolean |
valid()
Reports if this object is valid for use.
|
_instantiatingProcedure, addToPool, delete, doDelete, equals, hashCode, id, id, implicitDeletion, incrementTrigger, instantiatingProcedure, invalidAttribute, processResource, readOnlyError, readOnlyError, registerResource, resourceType, setInstantiatingProcedure, type, unableToAssignUnknown, unknownclone, finalize, getClass, notify, notifyAll, wait, wait, waitreadOnlyError, readOnlyError, resourceTypeid, id, unknowndynamicallowDeleteprivate final DataSet dataSet
DataSet where this DataRelation is defined.private final BufferImpl parentBuffer
private final BufferImpl childBuffer
private final boolean recursive
true to flag this as a RECURSIVE relation.private final java.lang.String[] relationFields
private final java.util.List<java.lang.String> afterFields
private final java.util.List<java.lang.String> beforeFields
private final java.lang.String parentLink
private boolean active
private boolean nested
private boolean reposition
private boolean fkHidden
private int maximumLevel
private java.lang.String whereString
WHERE-STRING attribute.private java.lang.String privateData
private java.lang.String admData
private java.lang.String name
NAME attribute.private boolean isValid
DataRelations are valid from the moment they are
created until the object is dropped/deleted. Once it is deleted and made invalid, the
object cannot be made valid again.private QueryWrapper query
QUERY attribute. Uses lazy initialization.private static final RefCount refCount
DataRelations.public DataRelation(DataSet dataSet, Buffer parent, Buffer child, java.lang.String[] relationFields, java.lang.String strPairs, boolean recursive)
DataRelation based on join between pairs of fields from parent
and child buffer. This is the constructor called when a ADD-RELATION method is
successful.dataSet - The DataSet.parent - The parent buffer.child - The child buffer.relationFields - The set of fields. The list has an even number of values, the values on odd indexes
being the parent fields and the even ones are the child fields.strPairs - The pair of fields, as string as they appear in the legacy statement.recursive - true if this is a recursive relation.public DataRelation(DataSet dataSet, Buffer parent, Buffer child, java.lang.String parentLink, java.util.List<java.lang.String> beforeFields, java.util.List<java.lang.String> afterFields, boolean dynamic)
DataRelation based on join between pairs of fields from parent and child
buffer. This is the constructor called when a ADD-PARENT-ID-RELATION method is successful.parent - The parent buffer.child - The child buffer.parentLink - The name of the RECID field of child buffer that is used to join
with the parent buffer.beforeFields - The list of fields to be serialized before.afterFields - The list of fields to be serialized after.dynamic - Use true for dynamically created relations.void confirmDynamic()
This method finishes setting this object parent-procedure and makes sure it is deleted at the appropriate moment (when the parent dataset is deleted). This is only needed for dynamically created relations.
public logical isActive()
ACTIVE ABL attribute. Deactivate an individual data-relation in a
DataSet object.isActive in interface DataRelationInterfaceACTIVE attribute.public void setActive(boolean active)
ACTIVE ABL attribute. Deactivate an individual data-relation in a
DataSet object.setActive in interface DataRelationInterfaceactive - The new state of ACTIVE attribute.public void setActive(logical active)
ACTIVE ABL attribute. Deactivate an individual data-relation in a
DataSet object.setActive in interface DataRelationInterfaceactive - The new state of ACTIVE attribute.public handle getChildBuffer()
CHILD-BUFFER attribute.getChildBuffer in interface DataRelationInterfacepublic BufferImpl getChildBufferNative()
CHILD-BUFFER attribute.public java.lang.String getChildTable()
public handle getCurrentQuery()
DataSet query that contains the currently selected row in
the BindingSource. Corresponds to CURRENT-QUERY ABL method.getCurrentQuery in interface DataRelationInterfaceDataSet query that contains the currently selected rowpublic handle getCurrentQuery(long bandIndex)
DataSet query that contains the currently selected row in
the BindingSource. Corresponds to CURRENT-QUERY ABL method.getCurrentQuery in interface DataRelationInterfacebandIndex - 0-based integer value that specifies the band index in a hierarchical gridDataSet query that contains the currently selected rowpublic handle getCurrentQuery(NumberType bandIndex)
DataSet query that contains the currently selected row in
the BindingSource. Corresponds to CURRENT-QUERY ABL method.getCurrentQuery in interface DataRelationInterfacebandIndex - 0-based integer value that specifies the band index in a hierarchical gridDataSet query that contains the currently selected rowpublic character getRelationFields()
RELATION-FIELDS readonly ABL attribute.getRelationFields in interface DataRelationInterfacepublic character getWhereString()
WHERE-STRING attribute.getWhereString in interface DataRelationInterfacepublic void setWhereString(java.lang.String where)
WHERE-STRING ABL attribute.setWhereString in interface DataRelationInterfacewhere - the new predicate.public void setWhereString(Text where)
WHERE-STRING ABL attribute.
Unlike other attributes, this attribute can be set tu unknown value!
setWhereString in interface DataRelationInterfacewhere - the new predicate.public logical getForeignKeyHidden()
FOREIGN-KEY-HIDDEN attribute.getForeignKeyHidden in interface DataRelationInterfaceFOREIGN-KEY-HIDDEN attribute for this relation.public void setForeignKeyHidden(boolean hide)
FOREIGN-KEY-HIDDEN attribute.setForeignKeyHidden in interface DataRelationInterfacehide - the new value of FOREIGN-KEY-HIDDEN attribute of this relation.public void setForeignKeyHidden(logical hide)
FOREIGN-KEY-HIDDEN attribute.setForeignKeyHidden in interface DataRelationInterfacehide - the new value of FOREIGN-KEY-HIDDEN attribute of this relation.public integer getMaximumLevel()
MAXIMUM-LEVEL ABL attribute.getMaximumLevel in interface DataRelationInterfacepublic void setMaximumLevel(NumberType max)
MAXIMUM-LEVEL ABL attribute.setMaximumLevel in interface DataRelationInterfacemax - the new number of iterations at which the recursion stops.public void setMaximumLevel(long max)
MAXIMUM-LEVEL ABL attribute.setMaximumLevel in interface DataRelationInterfacemax - the new number of iterations at which the recursion stops.public logical getReposition()
true, the relation
mode is REPOSITION. Otherwise, the relation mode is SELECTION. The default
value is false. This is the getter of the REPOSITION attribute.getReposition in interface DataRelationInterfacetrue when the reposition mode is REPOSITION and false
when reposition mode is SELECTION.public void setReposition(logical reposition)
true to set the relation
mode to REPOSITION and false to set it to SELECTION. This is the
setter of the REPOSITION attribute.setReposition in interface DataRelationInterfacereposition - the new reposition mode as described above.public void setReposition(boolean reposition)
true to set the relation
mode to REPOSITION and false to set it to SELECTION. This is the
setter of the REPOSITION attribute.setReposition in interface DataRelationInterfacereposition - the new reposition mode as described above.public character getParentFieldsAfter()
getParentFieldsAfter in interface DataRelationInterfacepublic character getParentFieldsBefore()
getParentFieldsBefore in interface DataRelationInterfacepublic handle getParentBuffer()
PARENT-BUFFER ABL read-only attributegetParentBuffer in interface DataRelationInterfacepublic BufferImpl getParentBufferNative()
PARENT-BUFFER ABL read-only attributepublic java.lang.String getParentTable()
public logical isNested()
DataSet temp-table buffer are nested within their
parent rows when writing the XML representation of DataSet object that contains
data-relations.isNested in interface DataRelationInterfaceyes if the child rows are nested within their parent rows.public void setNested(boolean nested)
DataSet temp-table buffer are nested within their
parent rows when writing the XML representation of DataSet object that contains
data-relations.setNested in interface DataRelationInterfacenested - The new value of the NESTED attribute.public void setNested(logical nested)
DataSet temp-table buffer are nested within their
parent rows when writing the XML representation of DataSet object that contains
data-relations.setNested in interface DataRelationInterfacenested - The new value of the NESTED attribute.public logical isRecursive()
isRecursive in interface DataRelationInterfaceyes when this data-relation is recursive.public boolean _isRecursive()
true when this data-relation is recursive.public logical isParentIdRelation()
RECID type of the parent record. In a PARENT-ID-RELATION, the value of
RELATION-FIELDS attribute will be the name of the child buffer’s RECID field.isParentIdRelation in interface DataRelationInterfaceYES if this is a PARENT-ID-RELATIONpublic handle getQueryAsHandle()
getQueryAsHandle in interface QueryAssociableunknown if none exists.public QueryWrapper getQuery()
null if none exists.public void setQueryAsHandle(handle qry)
setQueryAsHandle in interface QueryAssociableqry - The query to associate.public void setQueryAsHandle(QueryWrapper qry)
setQueryAsHandle in interface QueryAssociableqry - The query to associate.public character getADMData()
getADMData in interface ADMDatapublic void setADMData(java.lang.String value)
setADMData in interface ADMDatavalue - The new value.public void setADMData(character value)
setADMData in interface ADMDatavalue - The new value.public character name()
name attribute of this object.public void name(java.lang.String name)
name attribute of this object.public void name(character name)
name attribute of this object.public boolean valid()
valid in interface WrappedResourcetrue if we are valid (can be used).public handle getNextSibling()
NEXT-SIBLING attribute of this handle.getNextSibling in interface CommonHandleChainpublic handle getPrevSibling()
PREV-SIBLING attribute of this handle.getPrevSibling in interface CommonHandleChainpublic character getPrivateData()
PRIVATE-DATA attribute of this handle.getPrivateData in interface CommonHandleChainpublic void setPrivateData(character data)
PRIVATE-DATA attribute of this handle.setPrivateData in interface CommonHandleChaindata - The new private-data value.public void setPrivateData(java.lang.String data)
PRIVATE-DATA attribute of this handle.setPrivateData in interface CommonHandleChaindata - The new private-data value.public boolean _dynamic()
true if the buffer is dynamic.
This is not emitted by conversion, is used internally by FWD.
_dynamic in interface DynamicResourcetrue if the resource is dynamic, false otherwise.public java.lang.String[] getRelationFields(boolean parent)
PARENT-ID relation only the parent link is returned.parent - Pass true for fields from parent table and false for fields from child table.protected boolean hasNameConstraints()
false, requiring that its name should be
validated before assignment.HandleChain.validateName(java.lang.String)protected boolean resourceDelete()
HandleResource.delete().resourceDelete in class HandleResourcetrue.public java.lang.String[] getRelationFieldArray()
java.lang.String _getRelationFields()
PARENT-ID relation only the
parent link is returned, otherwise the set of pairs that defines the RELATION-FIELDS
attribute is returned.boolean _isActive()
ACTIVE attribute.boolean _isReposition()
REPOSITION attribute.REPOSITION attribute.private boolean _isParentIdRelation()
true when parentLink is not null.private boolean createQuery(java.lang.String where)
WHERE-STRING ABL attribute.where - The new predicate.true if operation is successful.public java.lang.String toString()
toString in class HandleResource