Principle
The Operation API reacts to the execution of operations within FlowerDocs Core. A operation is an action performed by a user on a component.
The operations managers (or
OperationHandler) are called when an operation is executed to react to it and apply specific processing. They can be called before (pre-treatment) or after (post-processing) the execution of the operation.
The execution of an operation can be divided into three phases:
1 . The OperationHandler recorded in the pre-processing phase are called
TheOperation is executed
The OperationHandler recorded in the pre-processing phase are called
Subscription
In order for an operation manager to react to the execution of an operation, it must be subscribed to it. Subscribing to the execution of an operation involves creating a configuration document of class OperationHandlerRegistration
.
The subscription defines the type of operations to which the manager must react by configuring a
action (creation, update…) and a
component category. Its
execution phase (before or after) indicates whether the manager should react before or after execution of the operation.
In addition, the subscription determines whether the reaction to the execution of an operation is synchronous or asynchronous (executed in another thread so as not to block the operation performed by the user).
To limit the number of calls, it is possible to define an execution filter that FlowerDocs will resolve to trigger or not the call to the operation manager depending on the context.
The fields on which filters can be applied depend on the
component category chosen. Here is an exhaustive list :
- Document, folder and virtual folder : tag list, component class
- Tasks : tag list, component class, assigned user, process identifier
- Task class : identifier, process identifier
- Others : identifier
Via the administration interface, it is possible to select other fields, notably on administration components: they will not be taken into account.
Operations Manager
An operations Manager (or
OperationHandler) is a code fragment called when an operation is executed. They can be divided into three categories:
- native : provided natively by FlowerDocs Core and executed within its JVM
- hooks: exposed as REST web services
To contextualize their execution, an object
OperationContext is provided as input. The context can be used to retrieve information concerning the execution of the operation, such as the component concerned or the modifications made.