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

nowhere
Champ in-the-making
Champ in-the-making
No one can help me?
I know I was not so clear in explanation, so ask me more details if needed!
Thanks 🙂

nowhere
Champ in-the-making
Champ in-the-making
I solved this problem modifying JBPMEngine class…but I don't know if this is the correct way so it's better I don't post my changes.
Anyway, if someone is facing this issue also, let me know and we'll discuss about this!

Greetings!

mrogers
Star Contributor
Star Contributor
Can you post your contribution into JIRA.   At least then your suggested solution can be studied and possibly added into Alfresco.

sselvaraj10
Champ in-the-making
Champ in-the-making
Shall I know what changes you made in JBPMEngine class, or the details of jira issue raised for this problem?
I need to write an workflow using pooledactors

nowhere
Champ in-the-making
Champ in-the-making
Hi sselvaraj10,
I submit my changes to mrogers just now…I forgot it, I'm sorry for this. As soon as possible I'll let you know if they are right.
Anyway I modified JBPMClass only to interact with workflow via API. But if you need to creat a workflow with pooledactors and interact with it by alfresco client, It works perfectly without changes.
Hope I can help you in some way…
Greetings.

nowhere
Champ in-the-making
Champ in-the-making
If it can still help you:

In jbpmclass at line 2207 we had:



if (value instanceof JBPMNodeList[])

and I have corrected it with


if (value instanceof JBPMNodeList)



otherwise it got always the next else:


else
                        {
                            throw new WorkflowException("Pooled actors value '" + value + "' is invalid");
                        }


Have a nice day!

mrogers
Star Contributor
Star Contributor
Raised this issue as https://issues.alfresco.com/jira/browse/ALFCOM-2848 which is fixed on HEAD.

Thanks Nowhere Smiley Happy

vinkk
Champ in-the-making
Champ in-the-making
Hi can you please write what is the value of NodeRef group ?

thanks
vin

nowhere
Champ in-the-making
Champ in-the-making
Hi,
I haven't correct code on hand now, but hope I can give you any hint: you should use AuthorityService to your issue:

Example:

if (authorityService.authorityExists("GROUP_NAME")) {
         Set<String> users = authorityService.getContainedAuthorities(AuthorityType.USER, "GROUP_NAME", false);
      }

Please check if you need group name or uuid, I'm not sure about it.

Maybe this hint can help you, I don't know exactly what you are going to do…let me know! I can have a look at code as soon as possible!