0 Replies Latest reply on Apr 24, 2009 11:46 PM by Andre Fernando Salvati

    URL Access + Pageflow + task issue

    Andre Fernando Salvati Novice

      Seam 2.1.1 GA


      Hi,


      I've been trying to start a pageflow and a task with an URL (sent via e-mail). I've tried 2 approaches without success.



      Approach 1)


      Better, cause it is possible to choose the exception screen, but my screen couldn't find process variables at Business Process context.


      Approach 2)


      It's not possible to choose the exception screen but at least my process variables came in debug.seam page.



      Details (Approach 1)




      http://localhost:8080/menu/registroUsuario/UsuarioEdit.seam?codigo=teste&taskId=63



      UsuarioEdit.page.xml (UsuarioEdit.xhtml has fields from process variables):


       <?xml version="1.0" encoding="UTF-8"?>
      <page xmlns="http://jboss.com/products/seam/pages"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="
                http://jboss.com/products/seam/pages
                http://jboss.com/products/seam/pages-2.0.xsd"
           view-id="/registroUsuario/UsuarioEdit.xhtml" action="#{registroUsuario.confirmar}">
           <begin-conversation pageflow="newuser"/>
      </page> 



      registroUsuario.confirmar:


            @RequestParameter("taskId")
           private Long taskIdFornecida;      
      
              public String confirmar() {
                
                TaskInstance task = jbpmContext.getTaskInstance(taskIdFornecida);
                
                
                     try {
                          task.start();
                     } 
                     catch (IllegalStateException e) {
                          statusMessages.add(StatusMessage.Severity.ERROR,"Registro já foi concluído");
                          return "inicio";
                     }
                     catch (Exception e) {
                          statusMessages.add(StatusMessage.Severity.ERROR,e.getMessage());;
                          return "inicio";
                     }
                     
                     taskId = taskIdFornecida;
                     
                     return "usuario"; 




      newuser.jpdl.xml:


               <start-state>
                     <transition name="usuario" to="usuario"></transition>
                     <transition name="inicio" to="inicio"></transition>
              </start-state>
               
              <page name="usuario" view-id="/registroUsuario/UsuarioEdit.xhtml">
                     <transition name="inicio" to="inicio"></transition>
              </page>
               
               <page name="inicio" view-id="/outros/inicio.xhtml"></page>  





      This error brings the next approach...



      Details (approach 2)



      When I try to put @StartTask at confirmar method it gives a sequence of errors like this:


       17:06:31,615 WARN  [SeamPhaseListener] uncaught exception, passing to exception handler
      java.lang.IllegalStateException: pageflow is not currently at a <page> or <start-page> node (note that pageflows that begin during the RENDER_RESPONSE phase should use <start-page> instead of <start-state>)
           at org.jboss.seam.pageflow.Pageflow.getPage(Pageflow.java:232) 




      So, I changed the pageflow...


      newuser.jpdl.xml


               <start-page name="usuario" view-id="/registroUsuario/UsuarioEdit.xhtml">
                     <transition name="inicio" to="inicio"></transition>
                </start-page>
               
               <page name="inicio" view-id="/outros/inicio.xhtml"></page> 



      Get:


       Exception during request processing:
      Caused by javax.el.ELException with message: "java.lang.IllegalStateException: begin method invoked from a long-running conversation, try using @Begin(join=true) on method: confirmar" 



      @Begin(join true) doesn't change anything. Same error.


      Questions:



      - I was not able to solve errors on both approaches. Am I doing something wrong?


      - Is it the best way to direct a user from his mail box to a task inside my appication?