The delegation can be fully controlled by the APIs provided by the VDoc development kit. A new class "Controller" has been implemented to handle the delegation. This class is named com.axemble.vdoc.sdk.interfaces.IDelegationController.
From this class it is possible to delegate elements known as of definition or dynamic. Every interfaces implementing the interface com.axemble.vdoc.sdk.supports.IDelegationSupport are likely to be concerned by the delegation module.
The methods of the IDelegationController interface
The following code extract displays all the methods available on the IDelegationController interface.
import com.axemble.vdoc.sdk.interfaces.IController; import com.axemble.vdoc.sdk.interfaces.IReport; import com.axemble.vdoc.sdk.supports.IDelegationSupport; public interface IDelegationController extends IController { // general delegation void addDelegation( IUser user, IUser substituteUser ); void removeDelegation( IUser user ); // delegation on the definition elements void addDelegation( IUser user, IUser substituteUser, IDelegationSupport delegationSupport ); void addDelegation( IUser user, IUser substituteUser, IDelegationSupport delegationSupport, String comment ); void removeDelegation( IUser user, IDelegationSupport delegationSupport ); void breakDelegation( IUser user, IDelegationSupport delegationSupport ); // delegation on the dynamic elements void addDelegation( IUser user, IUser substituteUser, IWorkflowInstance workflowInstance, ITask task ); void removeDelegation( IUser user, IWorkflowInstance workflowInstance, ITask task ); void breakDelegation( IUser user, IWorkflowInstance workflowInstance, ITask task ); // definitive delegation (replacement) void delegate( IUser user, IUser substituteUser, ITaskInstance taskInstance ); IReport delegateResources( ICatalog catalog, Collection roles, Collection resources, IUser user, IUser substituteUser ); IReport delegateRoles( ICatalog catalog, Collection roles, Collection resources, IUser user, IUser substituteUser ); }
The delegation may be applied on the following definition elements:
Example of delegation
This example presents the method breakDelegation() which permits to manage the exception cases on a delegation.
In this example, every documents of a connected user are delegated to the user "sboirol" except for the documents coming from the application named "administrative"
// retrieving the connected user IUser user = workflowModule.getLoggedOnUser(); // retrieving its execution context IContext context = workflowModule.getContext( user ); // retrieving another user whom delegate the documents IUser sboirol = workflowModule.getUserByLogin( "sboirol" ); // retrieving the delegation controller IDelegationController delegationController = workflowModule.getDelegationController(); // delegating every elements to the user 'sboirol' delegationController.addDelegation( user, sboirol ); // creating a delegation exception for the application named 'administrative' ICatalog catalog = workflowModule.getCatalog( context, "administrative" ); delegationController.breakDelegation( user, catalog );