Package com.orchestranetworks.instance

# Interface ValueContext

All Known Subinterfaces:
  `ChildEntity`, `Entity`, `MainEntity`, `ValueContextForInputValidation`, `ValueContextForUpdate`, `ValueContextForValidation`

public interface ValueContext
Common interface for accessing the content and context of a dataset or record.

See Also:
  - `Adaptation.createValueContext()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Adaptation`
  `getAdaptationInstance()`
  Returns the current dataset.
  `AdaptationTable`
  `getAdaptationTable()`
  If this context is for a table record, returns the table that contains it; returns `null` if this is for a dataset or a user service data context object that are not a record.
  `AdaptationHome`
  `getHome()`
  Returns the current dataspace or snapshot.
  `SchemaNode`
  `getNode()`
  Returns the current data model node of this context.
  `SchemaNode`
  `getNode(Path aPath)`
  Returns the data model node at the specified path.
  `Object`
  `getValue()`
  Returns the value of the current node of this context.
  `Object`
  `getValue(Path aPath)`
  Returns the value of the specified node.
  `Object`
  `getValue(SchemaNode aNode)`
  Returns the value of the specified node.

- ## Method Details

  - ### getHome

    AdaptationHome getHome()
    Returns the current dataspace or snapshot.

    For a user service data context object that is not a record or a dataset, always returns the reference dataspace.

  - ### getNode

    SchemaNode getNode()
    Returns the current data model node of this context. When a path-based access is performed, any relative path is resolved with respect to this node.
    See Also:
      - `getValue(Path)`

  - ### getNode

    SchemaNode getNode(Path aPath) throws PathAccessException
    Returns the data model node at the specified path. If the path is relative, it is resolved with respect to the current node of this context.
    Throws:
      `PathAccessException`
    See Also:
      - `getNode()`

  - ### getValue

    Object getValue(SchemaNode aNode)
    Returns the value of the specified node.
    Throws:
      `IllegalArgumentException` - if the specified node does not belong to the data model of the current content.
      `IllegalArgumentException` - if the current content is a table record and the specified node is not in the same table as the one of the current record.
      `IllegalArgumentException` - if the current content is a dataset and the specified node is a table record node.
    See Also:
      - `getValue(Path)`
      - `Adaptation.get(SchemaNode)`

  - ### getValue

    Object getValue(Path aPath) throws PathAccessException
    Returns the value of the specified node.

    The resolution of the value is done according to the following rules:

    1. If the specified node is a function, always returns the evaluation of the function.
    2. If the target node specifies a specific `osd:inheritance` inheritance property, returns the locally defined value if a local value is defined (or "overwritten"/`null`); if no local value is defined, looks up the first locally defined value, according to the `osd:inheritance` properties.
    3. Otherwise, the default inheritance mechanism is used: if the value is locally defined, it is returned (it can be `null`); otherwise, looks up the first locally defined value according to the built-in child-to-parent relationship of datasets; if no locally defined value is found, the data model default value is returned (`null` is returned if the data model does not define a default value).

    ##### Access and mapping rules

    The access and mapping rules between XML Schema and Java are described in the chapter Mapping to Java.

    Throws:
      `PathAccessException` - if `aPath` does not refer to an existing node in the underlying type tree structure, or the specified node is above a terminal node.
    See Also:
      - `Adaptation`
      - `Adaptation.get(Path)`

  - ### getValue

    Object getValue() throws PathAccessException
    Returns the value of the current node of this context.

    This method is equivalent to `getValue(Path.SELF)`.

    Throws:
      `PathAccessException`

  - ### getAdaptationInstance

    Adaptation getAdaptationInstance()
    Returns the current dataset.

    If this context is on a table record, returns the current dataset that contains the table. Never returns `null` if current value is from a dataset or record. Returns `null` for user service data context objects that are not a record or a dataset.

    See Also:
      - `getAdaptationTable()`

  - ### getAdaptationTable

    AdaptationTable getAdaptationTable()
    If this context is for a table record, returns the table that contains it; returns `null` if this is for a dataset or a user service data context object that are not a record.
    See Also:
      - `Adaptation.getContainerTable()`