1 2 Previous Next 18 Replies Latest reply on Oct 4, 2010 2:57 PM by uesker Go to original post
      • 15. Re: HOW: jBPM context propagate to the current Conversation
        lvdberg

        Hi,


        It is really not that complex, but jBPM (and Drools for that matter) need nother approach. Although the jBPM-Seam integration works, its basically for human tasks and at the moment you want to do some system processing, it gets more complex. Therfor I try to use jBPM directly without much use of annotations or including it in all king of tags. I added log-lines for almost every step which helps you to get a clear picture how everything works (and when).


        Try to get back to the basics and put everything in standard beans and do not start things through page elements. It make thing fuzzy and uncontrollable.


        The taskId can be accesed with a specific s:taskId tag, but only when the task is available in the context.


        Leo


        • 16. Re: HOW: jBPM context propagate to the current Conversation
          uesker

          Hi Leo,


          I followed your suggestion and tried to make things simple.
          It´s works but I have two last doubts:


          On pages.xml:


          <end-conversation/>
           <param name="taskId"/>
           <action execute="bean.action"



          and bean:


          @StartTask
           public void startFillIdentification() {
           //do something or nothing
           }
          
          @EndTask(transition="identification done")
          public String endFillIdentification(long taskI) {
               statusMessages.addFromResourceBundle("srprocess.fillidentification.page.sucess");
               return "/listActivities.xhtml";
          }



          If I try to start/end the task on same method, the exception commented above is thrown.
          Maybe it´s related that transition between s:link with taskInstance (on listActivities.xml) and tasks pages it´s not direct (pageDecisionHandler comes first), but I don´t have sure.


          Within the approach adopted above, the user can abandon the page after started the task. So, there is an approach to prevent that?


          Thanks for the help!

          • 17. Re: HOW: jBPM context propagate to the current Conversation
            lvdberg

            Hi,


            preventing a user from abandoning a Task is not what will happen in the real world. A User can stop, but there can also be a technical problem in the network or power-down. For all of these altarnative course cases, your application should be able to handle it. There are two different annotations to do the task. Use @StartTask for initial task and @beginTask when you've already started and want to resume.


            Leo


            • 18. Re: HOW: jBPM context propagate to the current Conversation
              uesker

              Hi, I was away for awhile...
              About system processing: I just want do simple things, like one of that I comment below:


              When I enter on a specific page, I have a button that a add a String to a data table. So, I do this operation with a ajax call. But when the method called its terminated, a exception is thrown with the message: java.lang.IllegalStateException: task/process id may not be null


              The page its quite simple




              <rich:panel>
                              <div align="center">
                          <f:facet name="header">#{messages['srprocess.fillsecondaryquestion.page.title']}</f:facet>
                                      <h:outputText value="#{messages['srprocess.fillsecondaryquestion.page.description']}"/><br/>
                          <h:inputText id="secondaryQ" value="#{secondaryQuestion.question}"/>
                          
                          <h:commandButton value="#{messages['command.add']}" actionListener="#{secondaryQuestionAction.addSecondaryQuestion}">
                              <a4j:support event="onclick" reRender="tableSecondaryQuestion, secondaryQ" ajaxSingle="true" />
                          </h:commandButton>
                          <div style="clear:both"/>
                          <h:outputText value="#{messages['srprocess.fillsecondaryquestion.questionstable.description']}"/>
                          <rich:dataTable id="tableSecondaryQuestion" value="#{secondaryQuestionAction.secondaryQuestionList}" var="q" rendered="#{not empty secondaryQuestionAction.secondaryQuestionList}">
                              <rich:column>
                                      #{q.question}
                              </rich:column>
                          </rich:dataTable>
                          </div>
                      </rich:panel>
              
                      <div class="actionButtons">
                              <h:commandButton value="#{messages['command.done']}" action="#{secondaryQuestionAction.endFillSecondaryQuestion}">
                              <f:param name="taskId" value="#{taskInstance.id}"/>
                          </h:commandButton>
                      </div>
              




              And the Bean with methods




              @Name("secondaryQuestionAction")
              @Scope(ScopeType.PAGE)
              public class SecondaryQuestionAction implements Serializable {
              
                      
                      private static final long serialVersionUID = 8394705048656015853L;
                      
                      @In
                      private StatusMessages statusMessages;
                      
                      @In(required=false)
                      @Out(scope=ScopeType.BUSINESS_PROCESS, required=false)
                      protected SRProtocol srProtocol;
                      
                      @In
                      private SecondaryQuestion secondaryQuestion;
                      
                      private List<SecondaryQuestion> secondaryQuestionList;
                      
                      public SRProtocol getSrProtocol() {
                              return srProtocol;
                      }
              
                      public void setSrProtocol(SRProtocol srProtocol) {
                              this.srProtocol = srProtocol;
                      }
              
                      public List<SecondaryQuestion> getSecondaryQuestionList() {
                              return secondaryQuestionList;
                      }
              
                      public void setSecondaryQuestionList(
                                      List<SecondaryQuestion> secondaryQuestionList) {
                              this.secondaryQuestionList = secondaryQuestionList;
                      }
              
                      @StartTask
                      public void startFillSecondaryQuestion() {
                              if (secondaryQuestionList == null) {
                                      secondaryQuestionList = new ArrayList<SecondaryQuestion>();
                              }
                              statusMessages.addFromResourceBundle("task.initiated.message");
                      }
                      
                      @EndTask(transition="questao secundaria adicionada")
                      public String endFillSecondaryQuestion() {
                              if (srProtocol != null) {
                                      srProtocol.setSecundaryQuestionList(secondaryQuestionList);
                              }
                              statusMessages.addFromResourceBundle("srprocess.fillsecondaryquestion.page.success");
                              return "/listarTarefas.xhtml";
                      }
                      
                      
                      public void addSecondaryQuestion(ActionEvent event) {
                              if (secondaryQuestion != null) {
                                      secondaryQuestionList.add(secondaryQuestion);
                                      secondaryQuestion = null;
                              }
                      }
              }
              





              I tried to put ResumeProcess annotation on addSecondaryQuestion method, but with that, I can´t even enter on method.
               
              Finnaly, the pages.xml




              <end-conversation/>
                      <param name="taskId"/>
                      <action execute="#{secondaryQuestionAction.startFillSecondaryQuestion}"/>





              With this approach, the TaskId parameter it´s persisted on url page, but I don´t understand why the task Id it´s null.


              Is there another solution for this problem?


              Thanks!






              1 2 Previous Next