0 Replies Latest reply on Mar 20, 2009 9:38 PM by Andy Conn

    Action @BeginTask fails after redirect.execute() from JBPM event

    Andy Conn Newbie

      I am getting this error:



      Caused by: java.lang.IllegalStateException: task/process id may not be null
      at org.jboss.seam.bpm.BusinessProcessInterceptor.getProcessOrTaskId(BusinessProcessInterceptor.java:159)
      



      When I post to an @BeginTask annotated action:


              @BeginTask @EndTask
              public String completeReject(){
                      return "success";
              }
      



      via:


      <h:commandButton  action="#{rfcJbpmTask.completeReject}" value="COMPLETE REJECT" >
              <f:param name="taskId" value="#{taskInstance.id}"  />
      </h:commandButton>
      



      The page is initially rendered via redirect after a task has been successfully completed and the graph token traverses to the next task.  The node-enter event fires this:


              public void doRedirectIfSameActor(String page){
                      // Conditional redirect if current actor is who it being assigned.  This is triggered on task-assign
                      String taskActorId = taskInstance.getActorId();
                      if (taskActorId.equalsIgnoreCase(actor.getId())){
                              redirect.setViewId(page);
                              redirect.setParameter("taskId",taskInstance.getId());
                              redirect.setParameter("id", taskInstance.getVariable("documentId"));
                              redirect.execute();
                      }
                      
              }
      



      The BusinessProcessInterceptor is firing this error:


       private Long getProcessOrTaskId(String paramName, String el)
         {
            Object id;
            if ( Strings.isEmpty(paramName) )
            {
               id = Expressions.instance().createValueExpression(el).getValue();
            }
            else
            {
      /////// FALLS INTO THIS CASE HERE:  values has only null values ////////////////
               String[] values = Parameters.instance().getRequestParameters().get(paramName);
               id = values!=null && values.length==1 ? values[0] : null;*
            }
            
            if (id==null)
            {
               throw new IllegalStateException("task/process id may not be null");
            }
            else if (id instanceof Long)
            {
               return (Long) id;
            }
            else if (id instanceof String)
            {
               return new Long( (String) id );
            }
            else
            {
               throw new IllegalArgumentException("task/process id must be a string or long");
            }
          }
      }
      



      Can any explain what is happening?  It appears to me that the initial rendering of my form is not working property in that the h:commandButton parameters hare not included.  But this is a guess.


      ----------------------------------------------------------------


      WHAT I AM TRYING TO ACCOMPLISH




      I would like to be able to associate a form with a JPDL task node so that when the user completes 1 task, the next task node's events handler can auto-render the next applicable form.


      I like the idea of associating the form with the jpdl <node>.  This way, the navigation is bound to the graph and is automatically updated when the graph is updated.  If I defined my navigation elsewhere, I have 2 things I need to keep in sync.  PageFlow definitions do not apply here because I am talking about a page flow that spans multiple tasks.


      I have seen this technique (navigating via the node-enter event) used by Exadel in their E7 product so I am guessing it can be done.


      Help appeciated!



      Thanks