cancel
Showing results for 
Search instead for 
Did you mean: 

How to assignee a workflow to pooledactors in JAVA?

raarm
Champ in-the-making
Champ in-the-making
Hi everyone,

I need to assignee the worflow that I created….to a group of users(pooledactors)!

It is the code:

……..
StartWorkflowActionExecuter executer = (StartWorkflowActionExecuter)ctx.getBean("start-workflow");
ActionImpl action = new ActionImpl(null, GUID.generate() , StartWorkflowActionExecuter.NAME, null);
action.setParameterValue(StartWorkflowActionExecuter.PARAM_WORKFLOW_NAME, "jbpm$wf:apdprocess");
action.setParameterValue(WorkflowModel.PROP_WORKFLOW_DUE_DATE.toPrefixString(namespaceService), new Date());
       
NodeRef reviewer = personService.getPerson("admin");
action.setParameterValue(WorkflowModel.PROP_COMMENT.toPrefixString(namespaceService),"User: "+reviewer+" Date: "+new Date());
action.setParameterValue(WorkflowModel.PROP_PRIORITY.toPrefixString(namespaceService),1);
action.setParameterValue(WorkflowModel.ASSOC_ASSIGNEE.toPrefixString(namespaceService), reviewer);
       
executer.execute(action, nodeRef);
……
       

I tryed to create a parameters Map and after to start the workflow but is not right……..The GROUP_CONSTRUCAP is in ALfresco:

Map<QName, Serializable> parameters = new HashMap<QName, Serializable>(); 
            parameters.put(WorkflowModel.ASSOC_PACKAGE, nodeRef);
            parameters.put(WorkflowModel.ASSOC_ASSIGNEE, "GROUP_CONSTRUCAP");
            parameters.put(WorkflowModel.PROP_WORKFLOW_DUE_DATE, new Date());
            parameters.put(WorkflowModel.PROP_WORKFLOW_DESCRIPTION, "Name of task");
            WorkflowPath path = workflowService.startWorkflow(def.id, parameters);

I tryed too:

action.setParameterValue(WorkflowModel.ASSOC_POOLED_ACTORS.toPrefixString(namespaceService), "GROUP_CONSTRUCAP");

My process-definition:

<?xml version="1.0" encoding="UTF-8"?>

<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="wf:apdprocess">

    <swimlane name="initiator" />

    <start-state name="startApd">
        <task name="wf:submitApd" swimlane="initiator">
        
      </task>
        <transition name="" to="fase1" />
    </start-state>

    <swimlane name="reviewer">
        <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
            <pooledactors>#{people.getGroup('GROUP_CONSTRUCAP')}</pooledactors>
           </assignment>   
    </swimlane>

    <task-node name="fase1">
        <task name="wf:processApd" swimlane="reviewer">
            <event type="task-create">
                <script>
                    if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate;
                    if (bpm_workflowPriority != void) taskInstance.priority = bpm_workflowPriority;
                </script>
            </event>
            <event type="task-end">
               <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                  <script>
                     <variable name="bpm_assignee" access="write"/>
                     <expression>
                        if (taskInstance.actorId != null)
                           people.getPerson(taskInstance.actorId);
                        else
                           person;
                     </expression>
                  </script>
               </action>
            </event>
           
        </task>
        <transition name="aprova" to="aprovado" />
        <transition name="rejeita" to="rejeitado" />
    </task-node>

    <task-node name="rejeitado">
        <task name="wf:rejectedApd" swimlane="initiator" />
        <transition name="" to="endApd" />
    </task-node>

    <task-node name="aprovado">
        <task name="wf:approvedApd" swimlane="initiator" />
        <transition name="" to="endApd" />
    </task-node>

    <end-state name="endApd" />

</process-definition>


My web-client-config-custom:




………..
<config evaluator="node-type" condition="bpm:workflowTask" replace="true">
      <property-sheet>
         <separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
         <show-property name="bpm:taskId" />
         <show-property name="bpm:description" component-generator="TextAreaGenerator" read-only="true"/>
         <show-property name="bpm:dueDate" read-only="true" />
         <show-property name="bpm:priority" read-only="true" />
         <show-property name="bpm:status" />
      </property-sheet>
   </config>

   <config evaluator="node-type" condition="bpm:startTask" replace="true">
      <property-sheet>
         <separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
         <show-property name="bpm:workflowDescription" component-generator="TextAreaGenerator" />
         <show-property name="bpm:workflowPriority" />
         <show-property name="bpm:workflowDueDate" />
         <separator name="sep2" display-label-id="users_and_roles" component-generator="HeaderSeparatorGenerator" />
        
      <show-association name="bpm:groupAssignee" />
      </property-sheet>
   </config>


<config evaluator="aspect-name" condition="apd:DocumentDetails">
        <property-sheet>
             <separator name="sepCust1" display-label="Atributos Documento" component-generator="HeaderSeparatorGenerator" />

             <show-property name="apd:DocumentFormato"/>
         <show-property name="apd:DocumentTotal"/>
                    <show-property name="apd:DocumentTipo"/>
         

           </property-sheet>
</config>


<config evaluator="node-type" condition="wf:submitApd" replace="true">
      <property-sheet>
         <separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
         <show-property name="bpm:workflowDescription" component-generator="TextAreaGenerator" />
         <show-property name="bpm:workflowPriority" display-label-id="wf_review_priority" />
         <show-property name="bpm:workflowDueDate" display-label-id="wf_review_due_date" />
      <separator name="sep2" display-label-id="users_and_roles" component-generator="HeaderSeparatorGenerator" />
          <show-association name="bpm:groupAssignee" />
         

      </property-sheet>
   </config>

  
   <config evaluator="node-type" condition="wf:processApd" replace="true">
      <property-sheet>
         <separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
         <show-property name="bpm:taskId" />
         <show-property name="bpm:description" component-generator="TextAreaGenerator" read-only="true"/>
         <show-property name="bpm:dueDate" read-only="true" />
         <show-property name="bpm:priority" read-only="true" />
         <show-property name="bpm:status" />
         <show-property name="bpm:comment" component-generator="TextAreaGenerator" />
      </property-sheet>
   </config>

   <config evaluator="node-type" condition="wf:rejectedApd" replace="true">
      <property-sheet>
         <separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
         <show-property name="bpm:taskId" />
         <show-property name="bpm:description" component-generator="TextAreaGenerator" read-only="true"/>
         <show-property name="bpm:dueDate" read-only="true" />
         <show-property name="bpm:priority" read-only="true" />
         <show-property name="bpm:status" />
         <show-property name="bpm:comment" component-generator="TextAreaGenerator" />
         <separator name="sep2" display-label-id="users_and_roles" component-generator="HeaderSeparatorGenerator" />
       <show-association name="bpm:groupAssignee" read-only="true" />

           
      </property-sheet>
   </config>

   <config evaluator="node-type" condition="wf:approvedApd" replace="true">
      <property-sheet>
         <separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
         <show-property name="bpm:taskId" />
         <show-property name="bpm:description" component-generator="TextAreaGenerator" read-only="true"/>
         <show-property name="bpm:dueDate" read-only="true" />
         <show-property name="bpm:priority" read-only="true" />
         <show-property name="bpm:status" />
         <show-property name="bpm:comment" component-generator="TextAreaGenerator" />
         <separator name="sep2" display-label-id="users_and_roles" component-generator="HeaderSeparatorGenerator" />
          <show-association name="bpm:groupAssignee" read-only="true" />
……..

My workflowModel:



………
<type name="wf:submitApd">
         <parent>bpm:startTask</parent>
         <mandatory-aspects>
           <aspect>bpm:groupAssignee</aspect>
</mandatory-aspects>
</type>

  

      <type name="wf:processApd">
         <parent>bpm:workflowTask</parent>
         <overrides>
            <property name="bpm:packageItemActionGroup">
               <default>edit_package_item_actions</default>
            </property>
         </overrides>
      </type>

      <type name="wf:approvedApd">
         <parent>bpm:workflowTask</parent>
         <mandatory-aspects>
            <aspect>bpm:groupAssignee</aspect>

         </mandatory-aspects>
      </type>

      <type name="wf:rejectedApd">
         <parent>bpm:workflowTask</parent>
         <mandatory-aspects>
            <aspect>bpm:groupAssignee</aspect>

         </mandatory-aspects>
      </type>
……


Somebody help me……Thanks!! :roll:
1 REPLY 1

jimcornmell
Champ in-the-making
Champ in-the-making
Hi,

I've solved this issue for myself:

See: http://forums.alfresco.com/viewtopic.php?f=34&t=10182

Jim