AnsweredAssumed Answered

Invalid pooled actor value.

Question asked by nowhere on Apr 26, 2009
Latest reply on Aug 13, 2009 by nowhere
Hi all,
I wrote some code for workflow management against Alfresco API but I'm facing with an annoying problem.

My workflows, really simple, appear so:

<start-state name="start">
      <task name="wf:fittizio" swimlane="initiator"/>
      <transition name="" to="startActivity">
      </transition>
   </start-state>
    <swimlane name="responsabili">
        <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
            <pooledactors>#{bpm_groupAssignee}</pooledactors>
        </assignment>   
    </swimlane>

   <task-node name="startActivity">
      <task name="wf:start" swimlane="initiator"/>
     
      <transition name="Start" to="test">
   
      </transition>
     
   </task-node> …..

Suppose I'm in "fittizio" task…I want to advance in "start" task…. so I wrote some code:


                               WorkflowTaskQuery query = new WorkflowTaskQuery();
         query.setActive(wi.active);
         query.setTaskState(null);
         query.setProcessId(wi.id);
         List<WorkflowTask> tasks = this.workflowService.queryTasks(query);
         
         for (WorkflowTask w : tasks){
                       
            Map<QName, Serializable> props = w.properties;
                        
         if (w.name.equals("wf:start")){
           
            
            props.put(QName.createQName("http://www.my.org/model/workflow/1.0", "mail"), mail);
            props.put(QName.createQName("http://www.my.org/model/workflow/1.0", "subject"), oggetto);
            props.put(QName.createQName("http://www.alfresco.org/model/bpm/1.0", "groupAssignee"), group);
            props.put(WorkflowModel.ASSOC_POOLED_ACTORS,  (Serializable)pooledNodeRefs);
            
            
         
                                       w =workflowService.updateTask(w.id, props, null, null);
                       }
         if (w.name.equals("wf:fittizio")){
            
            props.put(WorkflowModel.ASSOC_POOLED_ACTORS, (Serializable)pooledNodeRefs);
            props.put(QName.createQName("http://www.alfresco.org/model/bpm/1.0", "groupAssignee"), group);
            w = workflowService.updateTask(w.id, props, null, null);
            wfittizio = w;
         }
                            }


Where pooledNodeRefs in props.put(WorkflowModel.ASSOC_POOLED_ACTORS,  (Serializable)pooledNodeRefs); is List<NodeRef> pooledNodeRefs = new ArrayList<NodeRef>(); and I fill it with person node as follows:


       List groupMembers = new ArrayList();
         
         groupMembers = (List)nodeService.getProperty(group, QName.createQName("http://www.alfresco.org/model/user/1.0", "members"));
         Iterator itActors = groupMembers.iterator();
         while (itActors.hasNext()) {
                                         String pairs = (String)itActors.next();
      
                                        NodeRef user = personService.getPerson(pairs);
                                   pooledNodeRefs.add(user);
         }

But I get following error on UpdateTask:


Wrapped Exception (with status template): Pooled actors value '[Node Type: {http://www.alfresco.org/model/content/1.0}person, Node Aspects: [{http://www.alfresco.org/model/system/1.0}referenceable, {http://www.alfresco.org/model/application/1.0}configurable], Node Type: {http://www.alfresco.org/model/content/1.0}person, Node Aspects: [{http://www.alfresco.org/model/system/1.0}referenceable, {http://www.alfresco.org/model/application/1.0}configurable]]' is invalid

I also tried to fill it whit group nodeRef:


                    NodeRef pooledNodeRef = null;
       if (authorityDAO.authorityExists(authorityDAO.getAuthorityName(group)))
                                 {         
         pooledNodeRef = authorityDAO.getAuthorityNodeRefOrNull(authorityDAO.getAuthorityName(group));
       }
       if (pooledNodeRef != null)
                                 {
         pooledNodeRefs.add(pooledNodeRef );
       }

And I get another similar error:

Wrapped Exception (with status template): Pooled actors value '[Node Type: {http://www.alfresco.org/model/user/1.0}authorityContainer, Node Aspects: [{http://www.alfresco.org/model/system/1.0}referenceable]]' is invalid

I inspected WorkflowService and JBPMEngine code, I saw it must be a list of nodeRef…but I don't know the right type of it. Can anyone help me? It's very important!
Excuse me for not clear and confused code…it's my first approach to this Alfresco workflow api.
Thanks for any suggestion!

Outcomes