Workflow avancé plusieurs personnes
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2013 10:41 AM
Bonjour,
J'essaie tant bien que mal de réaliser un workflow avancé. Voici le schéma activiti:
[IMG]http://img819.imageshack.us/img819/7839/urk3.png[/IMG]
Voici le message d'erreur :
[IMG]http://img15.imageshack.us/img15/6497/2gch.png[/IMG]
Billabong-model-context.xml:
Billabongmodel.xml
Code du workflow
Le workflow n'est par terminé, mais j'ai déjà une erreur lors du démarrage du workflow …
Aussi, comment faire passer la variable des boutons "Valider, Refuser, Erreur" pour rediriger vers la bonne UserTask ?
En vous remerciant !
J'essaie tant bien que mal de réaliser un workflow avancé. Voici le schéma activiti:
[IMG]http://img819.imageshack.us/img819/7839/urk3.png[/IMG]
Voici le message d'erreur :
[IMG]http://img15.imageshack.us/img15/6497/2gch.png[/IMG]
Billabong-model-context.xml:
<?xml version='1.0' encoding='UTF-8'?><!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'> <beans> <!– Registration of new models –> <bean id="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap"> <property name="models"> <list> <value>alfresco/extension/BillabongModel.xml</value> </list> </property> </bean> <!– <bean id="billabong.workflowBootstrap" parent="workflowDeployer"> <property name="workflowDefinitions"> <list> <props> <prop key="engineId">activiti</prop> <prop key="location">alfresco/extension/workflow/parallel-review-billabongcompta.bpmn20.xml</prop> <prop key="mimetype">text/xml</prop> <prop key="redeploy">true</prop> </props> </list> </property> </bean> –> </beans>
Billabongmodel.xml
<?xml version="1.0" encoding="UTF-8"?><!– Définition d'un nouveau modèle –><!– La partie importante ici est "name" –><model name="bg:billabongModel" xmlns="http://www.alfresco.org/model/dictionary/1.0"> <!– Optional meta-data about the model –> <description>Modele de donnees Billabong</description> <author>Billabong</author> <version>0.1</version> <!– Imports are required to allow references to definitions in other models –> <imports> <!– Import Alfresco Dictionary Definitions –> <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/> <!– Import Alfresco Content Domain Model Definitions –> <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/> <!– Importation du modele BPM pour les workflows –> <import uri="http://www.alfresco.org/model/bpm/1.0" prefix="bpm"/> </imports> <namespaces> <namespace uri="billabong.model" prefix="bg"/> </namespaces> <constraints> <!– Liste des départements disponible dans la liste déroulante –> <constraint name="bg:consDepartement" type="LIST"> <parameter name="allowedValues"> <list> <value>Comptable</value> <value>Informatique</value> <value>Marketing</value> <value>Logistique</value> <value>Achats</value> </list> </parameter> </constraint> <constraint name="bg:consApprobation" type="LIST"> <parameter name="allowedValues"> <list> <value>Valider</value> <value>Refuser</value> <value>Erreur</value> </list> </parameter> </constraint> </constraints> <types> <!– Création du modèle de propriété pour la fiche d'édition –> <type name="bg:ficheEdition"> <title> Fiche d'édition </title> <parent>cm:content</parent> <properties> <property name="bg:numero"> <title> Numéro fiche edition </title> <type>d:long</type> <mandatory>true</mandatory> </property> <property name="bg:montant"> <title> Montant total de l'édition </title> <type>d:long</type> <mandatory>true</mandatory> </property> </properties> <!– Association des Factures à la fiche d'éditions –> <associations> <association name="bg:FactureEdition"> <title>Factures liées</title> <source> <mandatory>false</mandatory> <many>true</many> <!– Une édition peut être associé a plusieurs factures –> </source> <target> <class>bg:facture</class> <mandatory>false</mandatory> <many>false</many> <!– Une facture peut être associé uniquement a une Fiche d'éditions –> </target> </association> </associations> </type> <!– Création du modèle de propriété pour l'ordre de paiement –> <type name="bg:ordrePaiement"> <title>Ordre de paiement</title> <parent>cm:content</parent> <properties> <property name="bg:numeroPaiment"> <title>Numéro de l'ordre de paiement</title> <type>d:long</type> <mandatory>true</mandatory> </property> </properties> <!– Association de l'ordre de paiement aux editions –> <associations> <association name="bg:OrdresEditions"> <title>Fiches Edition liées</title> <source> <mandatory>false</mandatory> <many>true</many> <!– Un ordre de paiement peut être associé a plusieurs fiches d'éditions –> </source> <target> <class>bg:ficheEdition</class> <mandatory>false</mandatory> <many>false</many> <!– Les fiches d'éditions peuvent être associé uniquement a un unique ordre de paiement –> </target> </association> </associations> </type> <!– Création du modèle de propriété pour les factures –> <type name="bg:facture"> <title>Facture</title> <parent>cm:content</parent> <properties> <property name="bg:numeroEdition"> <title>Numero d'édition</title> <type>d:long</type> </property> <property name="bg:numeroPaiement"> <title>Numéro d'ordre de paiement</title> <type>d:text</type> </property> </properties> <!– Ajout de l'aspect bg:aspectFacture au type bg:facture –> <mandatory-aspects> <aspect>bg:aspectFacture</aspect> </mandatory-aspects> </type> <!– Définition des types (fenetre) du workflow bg:ApprobationFacture –> <!–Première fenetre : renseignement des metadonnees –> <type name="bg:start"> <title> Renseignement des metadonnées </title> <parent>bpm:startTask</parent> <!– Tâche de workflow de bas niveau pour le démarrage de celui-ci –> <mandatory-aspects> <aspect>bg:aspectFacture</aspect> <aspect>bpm:assignees</aspect> <!– Aspect pour assigner les utilisateurs –> </mandatory-aspects> </type> <!–Deuxieme fenetre : Approbation –> <type name="bg:Approbation"> <title> Approbation de la facture </title> <parent>bpm:activitiOutcomeTask</parent> <!– Tâche de workflow de bas niveau pour avoir une sortie type "oui/non ou autre" –> <!– On definit une propriete pour definir une liste de status de validation –> <properties> <property name="bg:approbationFacture"> <title> Validation Facture </title> <type>d:text</type> <constraints> <constraint ref="bg:consApprobation" /> <!– Valider , Refuser, Erreur –> </constraints> </property> </properties> <!– On surcharge les boutons classiques de validation par la liste definit en contraintes –> <overrides> <property name="bpm:outcomePropertyName"> <default>(billabong.model)approbationFacture</default> </property> </overrides> <mandatory-aspects> <!– Toujours a la fin !!!!!!!!!! –> <aspect>bg:aspectFacture</aspect> <aspect>bpm:assignees</aspect> <!– Aspect pour assigner les utilisateurs –> </mandatory-aspects> </type> <!– Troisième fenetre : Document rejete (facture bien attribué, mais non validé par le chef) –> <type name="bg:DocRefuse"> <title> Facture rejeté </title> <parent>bpm:workflowTask</parent> <!– Tâche de workflow de bas niveau –> <mandatory-aspects> <aspect>bg:aspectFacture</aspect> </mandatory-aspects> </type> <!– Quatrième fenetre : Erreur d'approbation - reassignation –> <type name="bg:ChangeAppo"> <title> Facture rejeté </title> <parent>bpm:workflowTask</parent> <!– Tâche de workflow de bas niveau –> <mandatory-aspects> <aspect>bg:aspectFacture</aspect> <aspect>bpm:assignees</aspect> <!– Aspect pour assigner les utilisateurs –> </mandatory-aspects> </type> </types> <aspects> <!– Aspect Workflow –> <aspect name="bg:aspectFacture"> <title>Aspect Facture</title> <properties> <property name="bg:nomFournisseur"> <title>Nom Fournisseur</title> <type>d:text</type> <mandatory>true</mandatory> </property> <property name="bg:departement"> <title>Département</title> <type>d:text</type> <mandatory>true</mandatory> <constraints> <constraint ref="bg:consDepartement" /> </constraints> </property> <property name="bg:numFournisseur"> <title>Numero Fournisseur</title> <type>d:long</type> <mandatory>true</mandatory> </property> <property name="bg:anneeComptable"> <title>Annee comptable</title> <type>d:text</type> <mandatory>true</mandatory> </property> <property name="bg:montantFacture"> <title>Montant Facture</title> <type>d:double</type> <mandatory>true</mandatory> </property> </properties> </aspect> </aspects></model>
Code du workflow
<?xml version="1.0" encoding="UTF-8"?><definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://alfresco.org"> <process id="approbationFacture" name="Workflow Approbation de facture fournisseur" isExecutable="true"><!– Prise en compte du pourcentage d'acceptation –> <extensionElements> <activiti:executionListener event="start" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener"> <activiti:field name="script"> <activiti:string> execution.setVariable('wf_approveCount', 0); execution.setVariable('wf_rejectCount', 0); execution.setVariable('wf_actualPercent', 0); execution.setVariable('wf_actualRejectPercent', 0); execution.setVariable('wf_reviewerCount', bpm_assignees.size()); execution.setVariable('wf_requiredPercent', wf_requiredApprovePercent); </activiti:string> </activiti:field> </activiti:executionListener> </extensionElements> <!– Tache de demarrage du workflow –> <startEvent id="start" name="Workflow start" activiti:formKey="bg:start"></startEvent> <!– Tache utilisateur pour choix de la/les personnne(s) d'approbations –> <userTask id="chefApprobation" name="Approbation des chefs de service" activiti:formKey="bg:Approbation"> <extensionElements> <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener"> <activiti:field name="script"> <activiti:string> if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority; </activiti:string> </activiti:field> </activiti:taskListener> <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener"> <activiti:field name="script"> <activiti:string> if(task.getVariableLocal('wf_reviewOutcome') == 'Approve') { var newApprovedCount = wf_approveCount + 1; var newApprovedPercentage = (newApprovedCount / wf_reviewerCount) * 100; execution.setVariable('wf_approveCount', newApprovedCount); execution.setVariable('wf_actualPercent', newApprovedPercentage); } else { var newRejectCount = wf_rejectCount + 1; var newRejectPercentage = (newRejectCount / wf_reviewerCount) * 100; execution.setVariable('wf_rejectCount', newRejectCount); execution.setVariable('wf_actualRejectPercent', newRejectPercentage); } </activiti:string> </activiti:field> </activiti:taskListener> </extensionElements> <humanPerformer> <resourceAssignmentExpression> <formalExpression>${reviewAssignee.properties.userName}</formalExpression> </resourceAssignmentExpression> </humanPerformer> <!– For each assignee, task is created –> <multiInstanceLoopCharacteristics isSequential="false"> <loopDataInputRef>bpm_assignees</loopDataInputRef> <inputDataItem name="reviewAssignee" /> <completionCondition>${wf_actualPercent >= wf_requiredApprovePercent || wf_requiredApprovePercent > (100 - wf_actualRejectPercent)}</completionCondition> </multiInstanceLoopCharacteristics> </userTask> <!– Gateway de decision –> <exclusiveGateway id="ApproDecision" name="Decision de Approbations"></exclusiveGateway> <!– Tache utilisateur pour le changement d'approbation –> <userTask id="ChangeAppo" name="Mauvaise personne" activiti:formKey="bg:wrongperson"></userTask> <!– Tache utilisateur pour le refus du document –> <userTask id="DocRefuse" name="Refus de signature" activiti:formKey="bg:refusappro"> <extensionElements> <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener"> <activiti:field name="script"> <activiti:string> if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority; // Set parallel review params on task, to be kept in history task.setVariableLocal('wf_reviewerCount', wf_reviewerCount); task.setVariableLocal('wf_requiredPercent', wf_requiredPercent); task.setVariableLocal('wf_actualPercent', wf_actualPercent); task.setVariableLocal('wf_approveCount', wf_approveCount); </activiti:string> </activiti:field> </activiti:taskListener> </extensionElements> <humanPerformer> <resourceAssignmentExpression> <formalExpression>${initiator.exists() ? initiator.properties.userName : 'admin'}</formalExpression> </resourceAssignmentExpression> </humanPerformer> </userTask> <!– Tache de fin du workflow –> <endEvent id="End" name="End"></endEvent> <!– Tache utilisateur apres acceptation de la facture par le chef de service –> <userTask id="Approuve" name="Facture Approuve" activiti:formKey="bg:approuve"> <extensionElements> <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener"> <activiti:field name="script"> <activiti:string> if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority; // Set parallel review params on task, to be kept in history task.setVariableLocal('wf_reviewerCount', wf_reviewerCount); task.setVariableLocal('wf_requiredPercent', wf_requiredPercent); task.setVariableLocal('wf_actualPercent', wf_actualPercent); task.setVariableLocal('wf_approveCount', wf_approveCount); </activiti:string> </activiti:field> </activiti:taskListener> </extensionElements> <humanPerformer> <resourceAssignmentExpression> <formalExpression>${initiator.exists() ? initiator.properties.userName : 'admin'}</formalExpression> </resourceAssignmentExpression> </humanPerformer> </userTask> <!– Flow de demarrage vers le module de choix d'approbation –> <sequenceFlow id="FlowStart" name="Flow vers choix chef de service" sourceRef="start" targetRef="chefApprobation"></sequenceFlow> <!– Flow du module de choix d'approbation vers la gateway de decisions–> <sequenceFlow id="FlowDecision" name="Flow vers Gateway de decision" sourceRef="chefApprobation" targetRef="ApproDecision"></sequenceFlow> <!– Flow Gateway vers Erreur Personne –> <sequenceFlow id="FlowErreurPersonne" name="Flow vers erreur de personne" sourceRef="ApproDecision" targetRef="ChangeAppo"></sequenceFlow> <!– Flow Gateway vers approbation accepte –> <sequenceFlow id="FlowApprouver" name="Flow decision OK" sourceRef="ApproDecision" targetRef="Approuve"> <!– Conditions d'acceptation par le pourcentage definit –> <conditionExpression xsi:type="tFormalExpression">${wf_actualPercent >= wf_requiredApprovePercent}</conditionExpression> </sequenceFlow> <!– Flow Gateway vers approbation refuse –> <sequenceFlow id="FlowRefus" name="Flow vers refus de signature" sourceRef="ApproDecision" targetRef="DocRefuse"></sequenceFlow> <!– Flow de fin du workflow apres acceptation –> <sequenceFlow id="FlowEnd" name="Flow vers fin de workflow" sourceRef="Approuve" targetRef="End"></sequenceFlow> <!– Flow de fin du workflow apres refus de signer –> <sequenceFlow id="FlowRefusEnd" name="Flow vers fin de workflow apres refus" sourceRef="DocRefuse" targetRef="End"></sequenceFlow> <!– Flow de Erreur de personne vers Nouvelle Approbation –> <sequenceFlow id="FlowNewAppro" name="Flow vers un changement d'approbation" sourceRef="ChangeAppo" targetRef="chefApprobation"></sequenceFlow> </process> <bpmndi:BPMNDiagram id="BPMNDiagram_approbationFacture"> <bpmndi:BPMNPlane bpmnElement="approbationFacture" id="BPMNPlane_myProcess"> <bpmndi:BPMNShape bpmnElement="start" id="BPMNShape_start"> <omgdc:Bounds height="35.0" width="35.0" x="120.0" y="170.0"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="chefApprobation" id="BPMNShape_chefApprobation"> <omgdc:Bounds height="55.0" width="105.0" x="250.0" y="160.0"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="ApproDecision" id="BPMNShape_ApproDecision"> <omgdc:Bounds height="40.0" width="40.0" x="470.0" y="167.0"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="ChangeAppo" id="BPMNShape_ChangeAppo"> <omgdc:Bounds height="55.0" width="105.0" x="438.0" y="60.0"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="DocRefuse" id="BPMNShape_DocRefuse"> <omgdc:Bounds height="55.0" width="105.0" x="438.0" y="250.0"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="End" id="BPMNShape_End"> <omgdc:Bounds height="35.0" width="35.0" x="790.0" y="170.0"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="Approuve" id="BPMNShape_Approuve"> <omgdc:Bounds height="55.0" width="105.0" x="620.0" y="160.0"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNEdge bpmnElement="FlowStart" id="BPMNEdge_FlowStart"> <omgdi:waypoint x="155.0" y="187.0"></omgdi:waypoint> <omgdi:waypoint x="250.0" y="187.0"></omgdi:waypoint> <bpmndi:BPMNLabel> <omgdc:Bounds height="42.0" width="100.0" x="-48.0" y="0.0"></omgdc:Bounds> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="FlowDecision" id="BPMNEdge_FlowDecision"> <omgdi:waypoint x="355.0" y="187.0"></omgdi:waypoint> <omgdi:waypoint x="470.0" y="187.0"></omgdi:waypoint> <bpmndi:BPMNLabel> <omgdc:Bounds height="42.0" width="100.0" x="-52.0" y="3.0"></omgdc:Bounds> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="FlowErreurPersonne" id="BPMNEdge_FlowErreurPersonne"> <omgdi:waypoint x="490.0" y="167.0"></omgdi:waypoint> <omgdi:waypoint x="490.0" y="115.0"></omgdi:waypoint> <bpmndi:BPMNLabel> <omgdc:Bounds height="42.0" width="100.0" x="10.0" y="-16.0"></omgdc:Bounds> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="FlowApprouver" id="BPMNEdge_FlowApprouver"> <omgdi:waypoint x="510.0" y="187.0"></omgdi:waypoint> <omgdi:waypoint x="620.0" y="187.0"></omgdi:waypoint> <bpmndi:BPMNLabel> <omgdc:Bounds height="14.0" width="100.0" x="-55.0" y="-17.0"></omgdc:Bounds> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="FlowRefus" id="BPMNEdge_FlowRefus"> <omgdi:waypoint x="490.0" y="207.0"></omgdi:waypoint> <omgdi:waypoint x="490.0" y="250.0"></omgdi:waypoint> <bpmndi:BPMNLabel> <omgdc:Bounds height="42.0" width="100.0" x="10.0" y="-21.0"></omgdc:Bounds> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="FlowEnd" id="BPMNEdge_FlowEnd"> <omgdi:waypoint x="725.0" y="187.0"></omgdi:waypoint> <omgdi:waypoint x="790.0" y="187.0"></omgdi:waypoint> <bpmndi:BPMNLabel> <omgdc:Bounds height="42.0" width="100.0" x="-33.0" y="-45.0"></omgdc:Bounds> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="FlowRefusEnd" id="BPMNEdge_FlowRefusEnd"> <omgdi:waypoint x="543.0" y="277.0"></omgdi:waypoint> <omgdi:waypoint x="807.0" y="277.0"></omgdi:waypoint> <omgdi:waypoint x="807.0" y="205.0"></omgdi:waypoint> <bpmndi:BPMNLabel> <omgdc:Bounds height="42.0" width="100.0" x="-71.0" y="3.0"></omgdc:Bounds> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="FlowNewAppro" id="BPMNEdge_FlowNewAppro"> <omgdi:waypoint x="490.0" y="115.0"></omgdi:waypoint> <omgdi:waypoint x="302.0" y="160.0"></omgdi:waypoint> <bpmndi:BPMNLabel> <omgdc:Bounds height="56.0" width="100.0" x="-85.0" y="-67.0"></omgdc:Bounds> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram></definitions>
Le workflow n'est par terminé, mais j'ai déjà une erreur lors du démarrage du workflow …
Aussi, comment faire passer la variable des boutons "Valider, Refuser, Erreur" pour rediriger vers la bonne UserTask ?
En vous remerciant !
Labels:
- Labels:
-
Archive
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2013 04:42 AM
J'ai finit par trouver d'où venait le problème. L'erreur était pourtant clair ! Je n'avais pas afficher le champ bpm_assignees dans le form du workflow dans le fichier share-config-custom.xml.
Cette erreur est résolue, cependant, je ne sais pas comment récupérer certaines valeurs, notamment la réponse de l'approbation "Valider, Refuser, Erreur" pour l'utiliser dans les flow pour poursuivre le workflow … si quelqu'un peut me guider là dessus !
merci
Cette erreur est résolue, cependant, je ne sais pas comment récupérer certaines valeurs, notamment la réponse de l'approbation "Valider, Refuser, Erreur" pour l'utiliser dans les flow pour poursuivre le workflow … si quelqu'un peut me guider là dessus !
merci
