Acteurs

Il s’agit d’alimenter automatiquement les rôles d’un workflow en utilisant l’annuaire. On utilisera fréquemment les notions de responsabilités dans l’annuaire à ce niveau :

  • Responsable
  • Responsable hiérarchique
  • Assistant

Ce type d’abonnement ne nécessite pas de configuration XML spécifique.

La classe d’abonnement a utiliser est com.axemble.vdp.mapping.extensions.ActorsMappingExtension.

Here is a subscription definition example based on document actors:

<subscription name="onChange" field-id="Utilisateur" subscription-class="com.axemble.vdp.mapping.extensions.ActorsMappingExtension">
	<on-stage name="Tache"/>
	<action field-id="ManagerRole" action-key="@toHierarchicalManager(Utilisateur)"/>
	<action field-id="HierarchicalManagerRole" action-key="@toManager(Utilisateur)"/>
	<action field-id="AssistantRole" action-key="@toAssistant(Utilisateur)"/>
	<action field-id="Role" action-key="@toRole(Utilisateur)"/>
</subscription>

The previous example shows how to achieve subscriptions that permits to recover directory information,particularly the hierarchical superior, the superior or even the assistant. It shows how to allocate a role to a user field.

This second example shows how to allocate a role from a users list:

<subscription name="onChange" field-id="ListeDePersonnes" subscription-class="com.axemble.vdp.mapping.extensions.ActorsMappingExtension">
	<on-stage name="Tache"/>
	<action field-id="Role" action-key="@toRole(ListeDePersonnes)"/>
</subscription> 

Tags

Subscription

The “subscription” element defines the subscription input in XML of the resource template.

Element Description
field-id Modified document field and trigger of the “onChange” event.
name Name of occurred event
prop-id Not available
subscription-class Extension class: com.axemble.vdp.mapping.extensions.ResourceBrowserMappingExtension

On-stage

The “on-stage” element defines the input of a step on which the subscription will be run.

Element Description
name System name of the concerned step. The keyword sys_CreationWizard enables to indicate that the treatment will be processed only on the action of process document creation.

Action

The “action” element defines the input of an action to be performed after an event is triggered.

Element Description
field-id System name of the subscribed field
prop-id Not available
action-key Property of trigger object obtained by introspection

The actions

Actions define all the document fields that will be updated when subscription is run. Actions can only be defined at the XML document level of the resource template. It is possible to define 1 to n actions.

The filters

Filters on steps can be placed to restrict subscriptions running on some steps. If no step has been specified, the subscription will be valid at all steps of the document. Filters are defined at the XML document level of the resource template. The on-stage tags can be present from 0 to n times.

Introspection

Introspection will let you access the object’s intrinsic properties. These properties should be accessible through the “get” type methods. Introspection is possible at the “action-key” attribute level of the “action” tag.

Functions

Available formulas

Ce type d’abonnement ne permet d’affecter que des champs de type “role”. On passera aux formules ci-dessous des champs de type : utilisateur (ou liste d’utilisateurs).

Formule Concerned classes Description
@toRole(property_name) Collection of users DirectoryElement Allocation of a role with a user or a list of users.
@toManager(property_name) Allocation of a role with a user’s superior.
@toHierarchicalManager(property_name) User or DirectoryElement Allocation of a role with a user’s hierarchical superior.
@toAssistant(property_name) User or DirectoryElement Allocation of a role with a user’s assistant.

Exemple

Soit un processus à 2 étapes :

  • Une étape de demande : rôle “demandeur”
  • Une étape de validation : rôle “validateur”

On souhaite que le validateur soit affecté automatiquement avec le responsable hiérarchique du demandeur.

Il faut dans un premier temps réaliser un abonnement pour rapatrier le créateur du document dans un champ “utilisateur”. Ensuite, sur le changement de ce champ “utilisateur”, il sera possible de récupérer son supérieur hiérarchique et le stocker dans le contenu du rôle “validateur”.

<subscription name="onLoad" on-stage="sys_CreationWizard" subscription-class="com.axemble.vdp.mapping.extensions.ResourceBrowserMappingExtension">
   <action field-id="CreatorUser" throw-events="true" update-mode="both" action-key="@toDirectoryElement(sys_Creator)"/>
</subscription>

<subscription field-id="CreatorUser" name="onChange" subscription-class="com.axemble.vdp.mapping.extensions.ActorsMappingExtension">
     <action field-id="Manager" action-key="@toHierarchicalManager(CreatorUser)"/>
</subscription>

Source : https://wiki.myvdoc.net/xwiki/bin/view/Dev+Floor/ActorsSubscription