3 Replies Latest reply on May 11, 2006 6:11 PM by kukeltje

    Task Reassign after Timer

    hosierdm

      I've been searching for an aswer with no luck. I am trying to implement escalations using timers and reassignment. I have a Task that I've applied a timer to. When the timer expires, I want to reassign the Task to another group or user. I've created an ActionHandler for the timer, but I don't seem to be able to get at the task instance in order to reassign it. I don't want to leave the node, I just want to stay put and reassign. I tried calling

      context.getTimer().getTaskInstance().setActorId("michael");

      but I get a NullPointerException. Could anyone help me figure out how to get the task instance to which the timer is associated? Thanks.

        • 1. Re: Task Reassign after Timer
          aguizar

          Perhaps your timer is in the taskNode rather than the task.

          What object is null in your expression (timer, task instance?)? Can you post the jPDL for the task node?

          • 2. Re: Task Reassign after Timer
            hosierdm

            So it turns out that the Timer itself was null for some reason. Maybe because it had already expired? Anyway, I have my timer setup in the task, not the task-node. So it dawned on me that I could probably get the task instance directly from the execution context. Basically I was trying to make it harder that it needed to be. That all worked and I was able to re-assign the task. Just for reference, my process definition follows:

            <process-definition
             xmlns="" name="TimerTest">
             <start-state name="start">
             <task name="StartTimerTest">
             <assignment expression="user(david)"></assignment>
             <controller>
             <variable name="Name" access="read,write,required"></variable>
             </controller>
             </task>
             <transition name="" to="task1"></transition>
             </start-state>
             <task-node name="task1">
             <task name="GetAge" duedate="2 business minutes">
             <assignment expression="user(david)"></assignment>
             <timer name='escalate'
             duedate='2 business minutes'>
             <action class='com.lsft.jbpm.action.EscalationActionHandler' />
             </timer>
             <controller>
             <variable name="Age" access="read,write,required"></variable>
             </controller>
             </task>
             <transition name="" to="end1"></transition>
             </task-node>
             <end-state name="end1"></end-state>
            </process-definition>


            • 3. Re: Task Reassign after Timer
              kukeltje

              Yeeehaaah.... great.... I appreciate your question, your seach, comments (on posts by others), examples etc... thanks... seriously.

              Making things more difficult than they need to be is what many people do. So many are in a certain 'world' or think they know how to solve thing with knowledge of other completely different frameworks that they forget to think simple and learn the basics a little.

              Maybe I should get certified by JBoss and start giving training in the Netherlands and Caribean