3 Replies Latest reply on Aug 27, 2008 7:19 AM by memius

    question regarding some 'dates' in task instance

    memius

      -What is the difference between the 'start' and the 'create' date of a task instance ?
      When a tasks gets created by the process, I think not both are set.
      When you dynamically create task instances none of both is set (unless you set them yourself) though it is possible to end that task (and the end task will be filled in)

      -Is there a concept like 'suspend until' ? I know you can suspend a task, but can you also suspend a task till some date ?

      - when the due date expires ? how can you neatly define the transitions (one transition for leaving the node in a regular way, another transition that should be taken if the due date is exceeded (expiration date ?) )

      Sincerely,
      Dieter D'haeyere.

        • 1. Re: question regarding some 'dates' in task instance
          kukeltje

           

          -Is there a concept like 'suspend until' ? I know you can suspend a task, but can you also suspend a task till some date ?


          No unless you implement some scheduling for this yourself

          - when the due date expires ? how can you neatly define the transitions (one transition for leaving the node in a regular way, another transition that should be taken if the due date is exceeded (expiration date ?) )


          You can't, at least not declarative. You have to define both in your processdefinition and e.g. in the UI filter one out

          • 2. Re: question regarding some 'dates' in task instance
            memius

            At this moment, I am trying to implement 'suspend until' like this (note, I will call this method in some kind of service class, so not in an ActionHandler) :

            public void suspendTaskInstanceUntil(final TaskInstance taskInstance, final String suspendUntilDate){
            
             taskInstance.suspend();
             CreateTimerAction cta = new CreateTimerAction();
             cta.setName("suspendUntilTimer");
             cta.setDueDate(suspendUntilDate);
             Action action = null;
             String actionName = "resume action";
             Delegation delegation = new Delegation("foo.bar.ResumeAction"); // will call taskInstance.resume()
            
             delegation.setProcessDefinition(taskInstance.getProcessInstance().getProcessDefinition());
             action= new Action(delegation);
             action.setName(actionName);
             cta.setTimerAction(action);
             try {
             cta.execute(ExecutionContext.currentExecutionContext());
            
             } catch (Exception e) {
             throw new RuntimeException(e);
            // e.printStackTrace();
             }
             jbpmContext.save(taskInstance);
            
             }


            I saw sth like this (as a poc) in an actionhandler and wanted a similar behaviour (but without the action handler )

            My problem is now : ExecutionContext.currentExecutionContext() returns null...
            So what I am trying to do does not work

            Could anyone suggest a fix / alternative / workaround for this ?

            (btw : the similar resume task method, would first kill the dynamic timer (if existing) and then resume the task
            Sincerely,
            Dieter D'haeyere.

            • 3. Re: question regarding some 'dates' in task instance
              memius

              I see that I left some errors in the code :
              you will find a jbpmContext (which is not declared in this piece of code), but normally I execute this code within a callback, so the jbpmContext is actually there...
              I thought to remove the callback code to make things simpler