Interface ValueContextForUpdate

All Superinterfaces:
ValueContext

public interface ValueContextForUpdate extends ValueContext
This container interface provides the possibility of setting values on persisted or transient content whose structure and types conform to an underlying data model.

Path interpretation

This interface has the following specificity regarding the way paths are interpreted in path-based methods (ValueContext.getValue(Path), ValueContext.getNode(Path), setValue(Object, Path), etc.): if the specified path is absolute and this context is a record, it starts at the record root (not the dataset root).

See Also:
  • Method Details

    • setValue

      Sets the value of the specified node. The value's Java type must be consistent with the data model node type.

      For a terminal node, the value AdaptationValue.INHERIT_VALUE can be set to specify that a node inherits its value from the parent dataset (this is the default value for any newly created dataset).

      The container will validate the value against the data model type and constraints when the transaction is committed.

      Permissions on the specified node will be evaluated before committing the changes, except when some extra privileges are granted in the containing trigger or procedure context. See setPrivilegeForNode(Path) and ProcedureContext.setAllPrivileges(boolean) for more information.

      Access and mapping rules

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

      Throws:
      UnavailableContentError - If content has become unavailable due to a data model error.
      PathAccessException - If the specified node does not exist.
      IllegalArgumentException - If:
      • the specified node cannot be written;
      • the specified value is not consistent with the data model node type;
      • the specified node is under an aggregated list;
      • the specified node is under a terminal node and the value to set is the value AdaptationValue.INHERIT_VALUE.
    • setValueFromXsString

      void setValueFromXsString(String aString, Path aPath) throws UnavailableContentError, PathAccessException
      Sets the string value specified. The string must comply with the standard representation of the associated type, as specified by XML Schema.

      This method first converts the specified string, then invokes setValue(Object, Path).

      Permissions on the specified node will be evaluated before committing the changes, except when some extra privileges are granted in the containing trigger or procedure context. See setPrivilegeForNode(Path) and ProcedureContext.setAllPrivileges(boolean) for more information.

      Access and mapping rules

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

      Throws:
      UnavailableContentError
      PathAccessException
      See Also:
    • setPrivilegeForNode

      void setPrivilegeForNode(Path aNodePath) throws PathAccessException, IllegalArgumentException
      Disables all permission checks for the specified node during the current operation.
      Privilege scope

      The privilege is granted for the whole update or create operation of the current record or dataset, but does not apply to the UI. This implies that permission checks for the specified node will be skipped until the operation is over. This privilege can be granted by a trigger, or in a procedure.

      For instance, given a user with read-only permission on the specified node:

      • an import user service launched by this user could still set a value for this node.
      • a procedure executed with this user session and with setAllPrivileges(false) could still set a value for this node.
      • a SOAP data service call with this user session could still set a value for this node.
      • any trigger with no privilege granted could still set a value for this node when multiple triggers are specified by the data model. Indeed, all triggers implied in the operation are affected by the privilege.
      Throws:
      PathAccessException - If the specified node does not exist.
      IllegalArgumentException - If the specified node is not terminal or null.
      Since:
      5.8.0
    • setValueEnablingPrivilegeForNode

      void setValueEnablingPrivilegeForNode(Object aValue, Path aNodePath) throws UnavailableContentError, PathAccessException, IllegalArgumentException
      Utility method to set a value for the specified node while disabling all permission checks for this node.

      This is the same as calling setPrivilegeForNode(Path) and setValue(Object, Path) successively. As a consequence, the privilege is granted beyond the invocation of this method, as specified by setPrivilegeForNode(Path).

      Throws:
      UnavailableContentError - If content has become unavailable due to a data model error.
      PathAccessException - If the specified node does not exist.
      IllegalArgumentException - If:
      • the specified node cannot be written;
      • the specified value is not consistent with the data model node type;
      • the specified node is under an aggregated list;
      • the specified node is under a terminal node and the value to set is the AdaptationValue.INHERIT_VALUE.
      Since:
      5.9.0
      See Also: