3 Replies Latest reply on Oct 6, 2008 5:34 AM by Ronald van Kuijk

    create-task="false" does not wok

    adel ahmadyan Newbie

      Hi,
      I wanted to dynamically create my tasks, hence I put this task-node:

      <task-node create-task="false" name="task-node-1" >

      <assignment class="MyRoleAssignmentHandler" config-type="bean">
      RoleName



      <action class="CreateMultiTask"
      config-type="bean"
      name="createMultiplyRepairTask"
      create-task="false">



      </task-node>

      with the following actionHandler:


      public class CreateMultiTask implements ActionHandler {
      public void execute(ExecutionContext executionContext) throws Exception {
      Token token = executionContext.getToken();
      TaskMgmtInstance tmi = executionContext.getTaskMgmtInstance();
      TaskNode taskNode = (TaskNode) executionContext.getNode();

      // Assignee:
      Vector roleInstanceSet = (Vector) tmi.getProcessInstance().getContextInstance().getVariable("__assignee");
      if ( roleInstanceSet == null ) throw new Exception("Role instance set is null . ..");
      // Task
      Task task = taskNode.getTask( tmi.getProcessInstance().getContextInstance().getVariable("__task").toString());
      for( Long ri : roleInstanceSet ){
      TaskInstance ti = tmi.createTaskInstance(task, executionContext);
      ti.setActorId("$RI_" + ri.toString());
      }
      }
      }

      it does as it supposed to do, it creates some task based myActionHandler but also it create one additional task than expected ( the default task for task-node, which is defined in the task tag. ) it seems that create-task="false" does not work.

      any comments or suggestion are welcome.

        • 1. Re: create-task=
          adel ahmadyan Newbie

           

          "ahmadyan" wrote:
          Hi,
          <task-node create-task="false" name="task-node-1" >
          <task name="task1" description="t">
          <assignment class="MyRoleAssignmentHandler"
          config-type="bean">
          <roleName>RoleName</roleName>
          </assignment>
          </task>
          <event type="node-enter">
          <action class="CreateMultiTask"
          config-type="bean"
          name="createMultiplyRepairTask"
          create-task="false">
          </action>
          </event>
          <transition to="serviceFinished"></transition>
          </task-node>


          there was a typo error in post, Correction:
          <task-node create-task="false" name="task-node-1" >
           <task name="task1" description="t">
           <assignment class="MyRoleAssignmentHandler"
           config-type="bean">
           <roleName>rolename </roleName>
           </assignment>
           </task>
           <event type="node-enter">
           <action class="CreateMultiTask"
           config-type="bean"
           name="createMultiplyRepairTask"
           create-task="false">
           </action>
           </event>
           <transition to="serviceFinished"></transition>
           </task-node>


          • 2. Re: create-task=
            adel ahmadyan Newbie

             

            "ahmadyan" wrote:
            Hi,
            <task-node create-task="false" name="task-node-1" >
            <task name="task1" description="t">
            <assignment class="MyRoleAssignmentHandler"
            config-type="bean">
            <roleName>RoleName</roleName>
            </assignment>
            </task>
            <event type="node-enter">
            <action class="CreateMultiTask"
            config-type="bean"
            name="createMultiplyRepairTask"
            create-task="false">
            </action>
            </event>
            <transition to="serviceFinished"></transition>
            </task-node>


            there was a typo error in post, Correction:
            <task-node create-task="false" name="task-node-1" >
             <task name="task1" description="t">
             <assignment class="MyRoleAssignmentHandler"
             config-type="bean">
             <roleName>rolename </roleName>
             </assignment>
             </task>
             <event type="node-enter">
             <action class="CreateMultiTask"
             config-type="bean"
             name="createMultiplyRepairTask"
             create-task="false">
             </action>
             </event>
             <transition to="serviceFinished"></transition>
             </task-node>


            • 3. Re: create-task=
              Ronald van Kuijk Master

              correct... create-task is no valid attribute, it should be create-tasks as in the docs, schema etc...