AnsweredAssumed Answered

Preconfigured Workflow

Question asked by lgilles on Jun 23, 2008
Latest reply on Sep 22, 2008 by stevewickii
Hi everyone,

I'm faced with a strange behavior of the persons/groups multiple association UI selector (I think org.alfresco.web.ui.repo.component.property.UIAssociationEditor).

I have a workflow task model that defines a multiple association with person type content model :


        <type name="mywf:publicationTask">
             <parent>bpm:workflowTask</parent>
              […]
              <associations>
                <association name="wf:personsPublication">
                    <source>
                        <mandatory>false</mandatory>
                        <many>true</many>
                    </source>
                    <target>
                        <class>cm:person</class>
                        <mandatory>false</mandatory>
                        <many>true</many>
                    </target>
                  </association>
                </associations>
                […]
         </type>

I catch the create-task event on the given task, and via JavaScript, put in it pre-defined datas as task variables :


   var predefinedAssocList = …; // arraylist of persons nodeRef
   var task = …; // my task node
   var JBPMNode = new JavaImporter(Packages.org.alfresco.repo.workflow.jbpm).JBPMNode;
   var JBPMNodeList = new JavaImporter(Packages.org.alfresco.repo.workflow.jbpm).JBPMNodeList;
   var Commons = {
     getServiceRegistry:function(){
            // Code to retrieve ServiceRegistry Bean
     }
   };

   var nodeList = new JBPMNodeList();
   for(var i = 0; i < predefinedAssocList.size(); i++)
     nodeList.add(new JBPMNode(assocList.get(i), Commons.getServiceRegistry()));
  
   task.setVariable("mywf_personsPublication", nodeList);

So "dgacwf_personsPublication" task variable points to a JBPMNodeList of JBPMNode of persons node ref.

On the UI side, I have the following configuration :


<config evaluator="node-type" condition="mywf:publicationTask">
  <property-sheet>
     […]
     <show-association name="mywf:personsPublication" display-label-id="mywf_publicationWF.persons"/>
     […]
  <property-sheet>
</config>

So here is the problem:

When the workflow is started, and the "mywf:publicationTask" started, the screen management of this task shows the person selector/editor with the predefined values in it.


Here's an use case:
A predefined list containing "Bob" and "Alfred".

Use case 1 :
       The user leaves the list unchanged and submit.
       ==> On the server side, transition event, the "mywf_personsPublication" task variable contains "Bob" and "Alfred"
Use case 2 :
         The user decides to add Max to the list, and remove Bob, so the Web UI is currently showing a person list containg "Alfred" and "Max".
         The user submit.
         ==> On the server side, transition event, the "mywf_personsPublication" task variable only contains "Max"

After doing other test I'm thinking that when the user changes the list, the workflow engine retrieve only the newly added items, ignoring the previously existing ones.

I've done some debbugging on "org.alfresco.web.ui.repo.component.property.UIAssociationEditor" and founded out that it contains at least two lists :
- originalAssocs
  which seems to contains the predefined datas
- added
  which seems to contains the users added datas.

Am I doing something wrong here ? I'm faced with this issue only with this kind of multiple noderef associations, I'm also pre-defining other type of data (boolean, text etc..) which I retrieve with no problems.

Thanks I advance, hoping to get some answers !

Laurent

Outcomes