Package com.orchestranetworks.schema.trigger

# Interface BeforeModifyInstanceContext

All Superinterfaces:
  `InstanceTriggerExecutionContext`, `TriggerExecutionContext`

public interface BeforeModifyInstanceContext extends InstanceTriggerExecutionContext
Provides a context for executing operations before modifying dataset fields.

Since:
  6.0.0
See Also:
  - `InstanceTrigger.handleBeforeModify(BeforeModifyInstanceContext)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `ValueChanges`
  `getChanges()`
  Returns the changes that will modify the current dataset.
  `Adaptation`
  `getDataset()`
  Returns the dataset to be modified.
  `ValueContext`
  `getDatasetContext()`
  Returns the dataset context for performing the update.
  `ValueContextForUpdate`
  `getDatasetContextForUpdate()`
  Returns the dataset context for performing the update.
  `boolean`
  `isAllPrivileges()`
  `void`
  `setAllPrivileges()`
  Disables all permission checks for all nodes during the current operation.

  ### Methods inherited from interface com.orchestranetworks.schema.trigger.InstanceTriggerExecutionContext

  `getAdaptationHome`

  ### Methods inherited from interface com.orchestranetworks.schema.trigger.TriggerExecutionContext

  `getSession`

- ## Method Details

  - ### getChanges

    ValueChanges getChanges()
    Returns the changes that will modify the current dataset.

    More precisely, the returned changes are those that are known just before entering the trigger method `handleBeforeModify`. If, during the execution of this method, a `ValueContextForUpdate.setValue...` is invoked, it is not taken into account by the returned object. Such additional modifications are taken into account after `handleBeforeModify`, and the trigger can access them (all changes) in `handleAfterModify`.

    See Also:
      - `AfterModifyInstanceContext.getChanges()`
      - `InstanceTrigger.handleBeforeModify(BeforeModifyInstanceContext)`

  - ### getDatasetContextForUpdate

    ValueContextForUpdate getDatasetContextForUpdate()
    Returns the dataset context for performing the update. This has the same content as the `read context`, but allows setting additional data in the context.

  - ### getDatasetContext

    ValueContext getDatasetContext()
    Returns the dataset context for performing the update. This has the same content as the `read context`, but allows setting additional data in the context.

  - ### getDataset

    Adaptation getDataset()
    Returns the dataset to be modified.

  - ### isAllPrivileges

    boolean isAllPrivileges()
    See Also:
      - `setAllPrivileges()`

  - ### setAllPrivileges

    void setAllPrivileges()
    Disables all permission checks for all nodes during the current operation.

    Using this method is not recommended, because the scope of the granted privileges is very wide. It is instead recommended to use `ValueContextForUpdate.setPrivilegeForNode(com.orchestranetworks.schema.Path)`, which allows to grant privilege to required nodes only.

    ##### Privilege scope

    As soon as these privileges are granted by this method, permission check for the specified node will be skipped during the whole operation.

    For instance, given a user with read-only permission on the some updated nodes:

    - an import user service launched by this user could still set a value for these nodes.
    - a Procedure executed with this user session and with `setAllPrivileges(false)` could still set a value for these nodes.
    - a SOAP data service call with this user session could still set a value for these nodes.
    - any trigger with no privilege granted could still set a value for these nodes when multiple triggers are specified by the data model. Indeed, all triggers implied in the operation are affected by the privilege.

    The granted privilege will return to its previous state just after the update operation and before the invocation of after modify triggers.

    See Also:
      - `ValueContextForUpdate.setPrivilegeForNode(com.orchestranetworks.schema.Path)`