The delegation

Controlling the delegation

The delegation can be fully controlled by the APIs provided by the Process 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 interface 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 );

}

Delegation of definition elements

The delegation may be applied on the following definition elements:

  • ICatalog: the applications;
  • IWorkflowContainer: the processes;
  • Process versions: the versions of process;

Example of delegation

This example presents the method breakDelegation() which permits to manage the exception cases on a delegation.

In this example, every document of a connected user are delegated to the user “userExample” 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 userExample = workflowModule.getUserByLogin( "userExample" );

// retrieving the delegation controller
IDelegationController delegationController = workflowModule.getDelegationController();

// delegating every elements to the user 'userExample'
delegationController.addDelegation( user, userExample );

// creating a delegation exception for the application named 'administrative'
ICatalog catalog = workflowModule.getCatalog( context, "administrative" );
delegationController.breakDelegation( user, catalog );

Delegation of dynamic elements

The delegation may also be applied to the dynamic elements such as the unit documents and the todo tasks.

Operating on the process document

The Process development kit provides, through the process document extension class, events on the delegation.

By defining a document-type extension class,it is possible to react on the following events:

Event Description
onBeforeDelegate Enables to control the display of the process document delegation wizard.
onAfterDelegate Enables to process code once the delegation on the document is done.
onBeforeDelegateTaskOnly Enables to control the display of the task delegation wizard.
onAfterDelegateTaskOnly Enables to process code once the delegation on the task is done.
onBeforeRefuseDelegation Enables to control the display of the refusing delegation wizard.
onAfterRefuseDelegation Enables to process code once the delegation has been refused.
onBeforeCancelDelegation Enables to control the display of the canceling delegation wizard.
onAfterCancelDelegation Enables to process code once the delegation has been canceled.