Interface DependenciesDefinitionContext

All Superinterfaces:
SchemaNodeContext
All Known Subinterfaces:
ConstraintContext, ConstraintContextOnTable, TableRefFilterContext

public interface DependenciesDefinitionContext extends SchemaNodeContext
Provides methods for setting dependencies in the context of a constraint and its data model.

Dependencies and validation

This context provides methods for declaring a constraint's dependencies. Constraint dependencies are used to minimize the number of calls to these constraints during the validation process. For instance, in the context of programmatic constraints, calls to the method Constraint.checkOccurrence(Object, ValueContextForValidation) will be minimized if dependencies are defined. Three modes are available:

  1. Local dependency: In this mode, the validation result of the current constraint depends only on the local value of the underlying node. Besides modification of this local value, the validation result will not be affected by any external events. This mode is enabled by calling the method ConstraintContext.setDependencyToLocalNode().
  2. Explicit dependencies: In this mode, the validation result of the current constraint depends only on updates of the source nodes that have been specified explicitly. Besides such updates and modification of the local value, the validation result will not be affected by any external events. One or more explicit dependencies can be specified using methods:
  3. Unknown dependencies (default): In this mode, the validation result of the current constraint depends on unknown sources or events (for example, data stored in an external system). This is the default mode, enabled if neither of the above methods has been called or if the element containing this constraint is computed by a value function or is an inherited field (defines the property osd:inheritance).

Attention:

  • Dependencies on computed values and inherited fields (define the property osd:inheritance) are not allowed. Constraints applied on elements defining a value function will be automatically set to Unknown dependencies mode. Consequently, if a constraint attempts to specify an explicit dependency, an IllegalArgumentException will be thrown.
  • If local or explicit dependencies are specified, they must be in complete accordance with the constraint's actual implementation. More precisely, if a dependency is missing, the validation result could be inaccurate.
  • It is not mandatory to specify dependencies. The specification of local or explicit dependencies is useful when large volumes of data must be validated and/or the validation algorithm is particularly expensive. In other cases, the default unknown dependencies mode is sufficient.
  • In EBX® user interface mode, the current constraint is always checked when user input is submitted.

See Also:
  • Method Details

    • addDependencyToModify

      void addDependencyToModify(SchemaNode aLocalSource)
      Specifies that the validation result of the current constraint depends on the value of the specified source node in the same record.

      In terms of incremental validation, this means that, in the context of the modified record, this constraint is subject to revalidation each time the value of the source node is modified.

      Attention:

      • A call to this method implies that all dependencies are explicitly declared (explicit dependencies mode). For more information, see Dependencies and validation above.
      • If the source or current node are computed by a value function or are an inherited field (defines the property osd:inheritance), this constraint will be considered to be in unknown dependencies mode.
      Throws:
      IllegalStateException - if a local dependency has been set to this constraint.
      IllegalStateException - if this constraint is set to Unknown dependencies mode.
      IllegalStateException - if this method is called in a ConstraintContextOnTable.
      IllegalArgumentException - if the specified source node does not have a local value; that is:
    • addDependencyToInsertAndDelete

      void addDependencyToInsertAndDelete(SchemaNode aTableSourceNode)
      Specifies that the validation result of the current constraint depends on the insertions and deletions of the specified table node.

      In the context of incremental validation, this means that the current constraint will be subject to a global (re)validation for all records of the table if any of the following events occur:

      • An insertion in the specified source table;
      • A deletion in the specified source table.
      Attention: A call to this method implies that all dependencies are explicitly declared (explicit dependencies mode). For more information, see Dependencies and validation above.

      Throws:
      IllegalStateException - if a local dependency has been set for this constraint.
      IllegalStateException - if this constraint is set in Unknown dependencies mode.
      IllegalArgumentException - if specified source is not a table node.
    • addDependencyToInsertAndDeleteInOtherInstance

      void addDependencyToInsertAndDeleteInOtherInstance(Path tablePathInContainer, AdaptationReference containerReference, HomeKey homeReference)
      Specifies that the validation result of the current constraint depends on the insertions and deletions of the specified table node of a given dataset in a specific dataspace.

      In the context of incremental validation, this means that the current constraint will be subject to a global (re)validation for all the records of the table if any of the following events occur:

      • An insertion in the specified source table;
      • A deletion in the specified source table.

      Attention: A call to this method implies that all dependencies are explicitly declared (explicit dependencies mode). For more information, see Dependencies and validation above.

      Throws:
      IllegalStateException - if a local dependency has been set for this constraint.
      IllegalArgumentException - if specified source is not a table node. if specified containerReference is null. if specified homeReference is null.
      See Also:
    • addDependencyToInsertAndDeleteInOtherInstance

      void addDependencyToInsertAndDeleteInOtherInstance(Path tablePathInContainer, AdaptationReference containerReference)
      Specifies that the validation result of the current constraint depends on the insertions and deletions of the specified table node of a given instance.

      In terms of incremental validation, this means that the current constraint will be subject to a global (re)validation for all the records of the table if any of the following events occur:

      • An insertion in the specified source table;
      • A deletion in the specified source table.

      Attention: A call to this method implies that all dependencies are explicitly declared (explicit dependencies mode). For more information, see Dependencies and validation above.

      Throws:
      IllegalStateException - if a local dependency has been set for this constraint.
      IllegalArgumentException - if specified source is not a table node. if specified containerReference is null.
      See Also:
    • addDependencyToInsertDeleteAndModify

      void addDependencyToInsertDeleteAndModify(SchemaNode aSourceNode)
      Specifies that the validation result of the current constraint depends on insertions, modifications and deletions on the specified node.

      In terms of incremental validation, this means that the current constraint will be subject to a global (re)validation for all the records of the table if any of the following events occur:

      • An insertion in the source table;
      • A deletion in the source table;
      • A modification of any node in any records in the source table if the source node is a table node;
      • A modification of the source node in any records in the source table if the source node is a table record node,

      Attention:

      • A call to this method implies that all dependencies are explicitly declared (explicit dependencies mode). For more information, see Dependencies and validation above.
      • If the source node is a table record node and if it or the current node are computed by a value function or are an inherited field (defines the property osd:inheritance), this constraint will be considered to be in unknown dependencies mode.
      Parameters:
      aSourceNode - specifies the source node and table on which this constraint depends; if the source is a table node, any insertion, modification and deletion in the table will result in the revalidation of the current constraint for all records of the table; if the source is a table record node, the revalidation is more restrictive since only modification of the specified node and any insertions or deletions will result in revalidation.
      Throws:
      IllegalStateException - if a local dependency has been set for this constraint.
      IllegalStateException - if this constraint is set in Unknown dependencies mode.
      IllegalArgumentException - if the specified source node is not a table node or table record node.
  • addDependencyToInsertDeleteAndModifyInOtherInstance

    void addDependencyToInsertDeleteAndModifyInOtherInstance(SchemaNode sourceNode, AdaptationReference containerDataSetReference, HomeKey dataSpaceReference)
    Specifies that the validation result of the current constraint depends on the insertions, modifications and deletions on the specified node in a given dataset in a specific dataspace.

    In terms of incremental validation, this means that the current constraint will be subject to a global (re)validation for all the records of the table if any of the following events occur:

    • An insertion in the source table;
    • A deletion in the source table;
    • A modification of any node in any records in the source table, if the source node is a table node;
    • A modification of the source node in any records in the source table, if the source node is a table record node,

    Attention:

    • A call to this method implies that all dependencies are explicitly declared (explicit dependencies mode). For more information, see Dependencies and validation above.
    • If the source node is a table record node and if it or the current node are computed by a value function or are an inherited field (define the property osd:inheritance), this constraint will be considered to be in unknown dependencies mode.
    Parameters:
    sourceNode - specifies the source node and table on which this constraint depends; if the source is a table node, any insertion, modification and deletion in the table will result in the revalidation of the current constraint for all the records of the table; if the source is a table record node, the revalidation is more restrictive since only the modification of the specified node or any insertion or deletion will result in revalidation.
    Throws:
    IllegalStateException - if a local dependency has been set for this constraint.
    IllegalStateException - if this constraint is set in Unknown dependencies mode.
    IllegalArgumentException - if the specified source node is not a table node or a table record node. if specified containerReference is null. if specified homeReference is null.
  • addDependencyToInsertDeleteAndModifyInOtherInstance

    void addDependencyToInsertDeleteAndModifyInOtherInstance(SchemaNode sourceNode, AdaptationReference containerReference)
    Specifies that the validation result of the current constraint depends on the insertions, modifications and deletions on the specified node in a given dataset.

    In the context of incremental validation, this means that the current constraint will be subject to a global (re)validation for all the records of the table if any of the following events occur:

    • An insertion in the source table;
    • A deletion in the source table;
    • a modification of any node is done in any records in the source table, if the source node is a table node;
    • A modification of the source node in any records in the source table, if the source node is a table record node,

    Attention:

    • A call to this method implies that all dependencies are explicitly declared (explicit dependencies mode). For more information, see Dependencies and validation above.
    • If the source node is a table record node and if it or the current node are computed by a value function or are an inherited field (define the property osd:inheritance) then this constraint will be considered to be in unknown dependencies mode.
    Parameters:
    sourceNode - specifies the source node and table on which this constraint depends; if the source is a table node, any insertion, modification and deletion in the table will result in the revalidation of the current constraint for all the records of the table; if the source is a table record node, the revalidation is more restrictive since only the modification of the specified node or any insertion or deletion will result in revalidation.
    Throws:
    IllegalStateException - if a local dependency has been set for this constraint.
    IllegalStateException - if this constraint is set in Unknown dependencies mode.
    IllegalArgumentException - if the specified source node is not a table node or a table record node. if specified containerReference is null.