AnsweredAssumed Answered

[Résolu]Récupérer des infos sur le swimlane dans un tâche

Question asked by fred_pack on Jan 26, 2009
Latest reply on Jan 30, 2009 by fred_pack
Bonjour à tous,

JE vous expose mon problème, si une ame charitable peut me donner un coup de main…

Je veux créer un workflow avec plusieurs intervenants. J' ai donc créé dans le Model ci-dessous des références cm:person pour chaque intervenant.

<?xml version="1.0" encoding="UTF-8"?>
<model name="pac:qua-01" xmlns="http://www.alfresco.org/model/dictionary/1.0">

        <!– Infos. –>
        <description>Validation 1 Qualite</description>
        <author>Fred</author>
        <version>1.0</version>

  <imports>
        <!– Import dictionnaire de definitions –>
        <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
        <!– Import modeles de definitions –>
        <import uri="http://www.alfresco.org/model/workflow/1.0" prefix="wf"/>
        <import uri="http://www.alfresco.org/model/bpm/1.0" prefix="bpm"/>
        <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
  </imports>
  <namespaces>
        <!– Import nouveau namespace defini par ce modele –>
        <namespace uri="qua-01.pac" prefix="pac"/>
  </namespaces>

  <types>

        <type name="pac:debutCircuit">
                <parent>bpm:startTask</parent>
                <properties>
                        <property name="wf:notifyMe">
                                <type>d:boolean</type>
                                <default>false</default>
                        </property>
                </properties>

                <mandatory-aspects>
                        <aspect>pac:persRedac</aspect>
                        <aspect>pac:persVerif</aspect>
                        <aspect>pac:persAprouv</aspect>
                </mandatory-aspects>
        </type>

        <type name="pac:redaction">
                <parent>bpm:workflowTask</parent>

        <mandatory-aspects>
                <aspect>pac:persRedac</aspect>
        </mandatory-aspects>
        </type>


        <type name="pac:verification">
                <parent>bpm:workflowTask</parent>
        </type>

        <type name="pac:docRefuse">
                <parent>bpm:workflowTask</parent>
        </type>

        <type name="pac:versAppro">
                <parent>bpm:workflowTask</parent>
        </type>

  </types>

   <aspects>

        <aspect name="pac:persRedac">
           <associations>
                <association name="pac:persRedac">
                        <source>
                        <mandatory>false</mandatory>
                        <many>false</many>
                        </source>
                        <target>
                        <class>cm:person</class>
                        <mandatory>true</mandatory>
                        <many>false</many>
                        </target>
                </association>
           </associations>
        </aspect>

        <aspect name="pac:persVerif">
           <associations>
                <association name="pac:persVerif">
                        <source>
                        <mandatory>false</mandatory>
                        <many>false</many>
                        </source>
                        <target>
                        <class>cm:person</class>
                        <mandatory>true</mandatory>
                        <many>false</many>
                        </target>
                </association>
           </associations>
        </aspect>

        <aspect name="pac:persAprouv">
           <associations>
                <association name="pac:persAprouv">
                        <source>
                        <mandatory>false</mandatory>
                        <many>false</many>
                        </source>
                        <target>
                        <class>cm:person</class>
                        <mandatory>true</mandatory>
                        <many>false</many>
                        </target>
                </association>
           </associations>
        </aspect>

   </aspects>

</model>


Et bien sur des tâches dans le processdefinition que voici


<?xml version="1.0" encoding="UTF-8"?>
<process-definition xmlns="urn:jbpm.org:jpdl-3.1"  name="pac:qua-01">

   <swimlane name="initiator"></swimlane>

   <swimlane name="redacteur">
        <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
                <actor>#{pac_persRedac}</actor>
        </assignment>
   </swimlane>

   <swimlane name="verificateur">
        <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
                <actor>#{pac_persVerif}</actor>
        </assignment>
   </swimlane>

   <swimlane name="approbateur">
        <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
                <actor>#{pac_persAprouv}</actor>
        </assignment>
   </swimlane>


   <start-state name="debut">
        <task name="pac:debutCircuit" swimlane="initiator"/>

        <transition name="deb" to="redac">
        <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                <script>
                </script>
        </action>
        </transition>

   </start-state>

   <task-node name="redac">

        <task name="pac:redaction" swimlane="redacteur">
                <event type="task-create">
                        <script>
                                System.out.println("VAR1 :"+pac_persRedac.properties.email);
                        </script>
                </event>
        </task>
        <transition name="red" to="verif"></transition>
   </task-node>

        <task name="pac:verification" swimlane="verificateur"/>
        <transition name="rejette" to="redac"></transition>
        <transition name="accepte" to="aprob"></transition>
   </task-node>


   <task-node name="aprob">
        <task name="pac:approbation" swimlane="approbateur"/>
        <transition name="rejette" to="redac"></transition>
        <transition name="accepte" to="fin"></transition>
   </task-node>

    <end-state name="fin"></end-state>
</process-definition>


Dans une tâche , je voudrais récupérer des informations (firstName, lastName, email, . . . ) du swimlane en cours. J'ai fait des essais en éditant dans le log le résultat avec diverses syntaxes EX: System.out.println("VAR1 :"+pac_persRedac.properties.email);
mais rien ne marche avec les syntaxes que j'utilise, et je commence à tourner en rond   :cry:
Ma question est : quelle est la bonne syntaxe pour récupérer ces informations.
Merci de votre aide.

Outcomes