Class OperationContext

java.lang.Object
java.util.AbstractMap<String,Object>
org.nuxeo.ecm.automation.OperationContext
All Implemented Interfaces:
AutoCloseable, Map<String,Object>
Direct Known Subclasses:
RestOperationContext

public class OperationContext extends AbstractMap<String,Object> implements AutoCloseable
An operation context. Holds context objects, a context parameters map and a list of operations to run.

Context objects are:

  • The Operation Chain Input - optional. It will be used as the input for the first operation in the chain. If input is null then only VOID methods in the first operation will be matched.
  • A Core Session - which is optional and should be provided by the caller. (either at creation time as a constructor argument, either using the setCoreSession(CoreSession) method. When running the operation chain in asynchronous mode another session will be created by preserving the current session credentials.

Each entry in the operation list contains the ID of the operation to be run and a map of operation parameters to use when initializing the operation.

The context parameters map can be filled with contextual information by the caller. Each operation will be able to access the contextual data at runtime and to update it if needed.

Author:
Bogdan Stefanescu
  • Field Details

    • commit

      protected boolean commit
      Whether to save the session at the end of the chain execution. The default is true.
    • handleTransaction

      protected boolean handleTransaction
      Whether this context should handle the transaction.
      Since:
      2021.18
    • vars

      protected final Map<String,Object> vars
      The context variables.
    • stacks

      protected final Map<String,Deque<Object>> stacks
      Each stack use a key the type of the objects in the stack: document, documents, blob or blobs
    • loginStack

      protected LoginStack loginStack
      A logins stack manage multiple logins and sessions in a single chain execution
    • input

      protected Object input
      The execution input that will be updated after an operation run with the operation output
    • trace

      protected List<String> trace
      A list of trace. Since 5.7.3 messages is no longer useful for tracing. Use chain call backs to do it.
    • callback

      protected OperationCallback callback
      Since:
      5.7.3 Collect operation invokes.
  • Constructor Details

    • OperationContext

      public OperationContext()
    • OperationContext

      public OperationContext(CoreSession session)
    • OperationContext

      protected OperationContext(CoreSession session, Map<String,Object> bindings)
  • Method Details