cancel
Showing results for 
Search instead for 
Did you mean: 

Invalid pooled actor value.

nowhere
Champ in-the-making
Champ in-the-making
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!
11 REPLIES 11

vinkk
Champ in-the-making
Champ in-the-making
Hi iam trying to reassign to a group,

i try this code i get the following errors

        List nl = new LinkedList();
        nl.add( new NodeRef("workspace://SpacesStore/66de7880-e25c-4820-8dc6-0d843fbe0aae"));
        Map<QName, Serializable> mp = new HashMap<QName, Serializable>();
        mp.put(WorkflowModel.ASSOC_POOLED_ACTORS, (Serializable)nl);
        mp.put(ContentModel.PROP_OWNER, null);
           serviceRegistry.getWorkflowService().updateTask(taskid, mp, null, null);

  <tr><td></td><td> </td></tr>
   <tr><td><b>Exception:</b></td><td>org.alfresco.web.scripts.WebScriptException - 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/content/1.0}ownable, {http://www.alfresco.org/model/application/1.0}configurable, {http://www.alfresco.org/model/system/1.0}referenceable]]' is invalid</td></tr>
   <tr><td></td><td> </td></tr>
      <tr><td></td><td>org.alfresco.web.scripts.AbstractWebScript.createStatusException(AbstractWebScript.java:622)</td></tr>
   <tr><td></td><td> </td></tr>

i get error in this line jbpmengine.java

             else if (value instanceof JBPMNode)
                        {
                            JBPMNode node = (JBPMNode)value;
                            pooledActors = new String[] {mapAuthorityToName(node.getNodeRef())};
                        }
                        else
                        {
                            throw new WorkflowException("Pooled actors value '" + value + "' is invalid");
                        }


————————————————————————————-
After that i modified and tried this
   
        JBPMNodeList nodeList = new JBPMNodeList();
        nodeList.add(new JBPMNode(user2, serviceRegistry));
                               params.put(WorkflowModel.ASSOC_POOLED_ACTORS, (Serializable)nodeList );
                               serviceRegistry.getWorkflowService().updateTask(taskid, mp, null, null);

here user2 is nodeRef,

here  i get following errrors

cannot cast JBPMNode TO nodeRef
—————————————————————————————————–

if you have some code working for this please help me
thanks
vinkk

nowhere
Champ in-the-making
Champ in-the-making
I sent you a PM for not dirting this post with wrong code 🙂