5 Replies Latest reply on Mar 23, 2010 10:15 AM by r 0

    JBPM & WebApplication (for replace jbpm console)

    John Sawyer Novice

      Hello!

      I have the feeling (probably wrong) that the process should be running under JBPM Console.

      Samples i saw always redirect to jbpm console, creates instances, and show forms if the state requires it.

      Ok, perfect.

      I think that develop a web application, that calls jbpm for some interaction is easy too (for example i saw junit test that creates&move the instances).

       

      But, my problem is... ok, now, I would develop a web application that start a process and in some states i have a form associate with the state.

      How can i do this? Show a form because one state needs some information, and obviously all control of wich form must be show i need that be gobernate by process (and jbpm)

       

      I think that is possible, because JPBM Console do this.. but i don't know what is the most easy path for doing this.

       

      I suppose that i need to read the form from state, and invoke to ftl file.. but i don't know how.

       

      I suppose that this case is very common, but i don't find any tutorial that guides me.

       

      Thank you!
        • 1. Re: JBPM & WebApplication (for replace jbpm console)
          Maciej Swiderski Master

          Hi,

           

          I don't know how are you planning to interact with jBPM runtime but one way could be to you gwt-console-server application that exposes REST interface to interact with jBPM engine.

          If that is of any interest for you there is already a method to render a form of a given task. BTW, only tasks and start node can have a form associated with it.

          Just go to gtw-console-server url (http://localhost:8080/gwt-console-server) and browse all available methods, there you will find  render method for tasks.

           

          HTH

          Maciej

          • 2. Re: JBPM & WebApplication (for replace jbpm console)
            John Sawyer Novice

            Thank you very much!!

             

            I saw this morning gwt-console-server and its list of resources, but I try /gwt-console-server/rs/form/task/{id}/render , but with bad {id}...

            I use   VacationRequest.40001 (instance details-instance id) when i must use 40001.

             

            I think that the number of samples about jbpm in web is very small, and for a begginer is hard to learn all... (and documentation is very general for a rookie)

             

            I found Joram Barrez blog, and his samples are very useful, but I think that use JBPM from a Web Application is not explained anywhere.

             

            Thank you for your help.

             

             


            • 3. Re: JBPM & WebApplication (for replace jbpm console)
              r 0 Newbie

              Hello John,

               

              I am in the exact same position as you are.

              I have to develop a web application which interacts with jBPM4.3 like the gwt-conole. (For my Bachelor thesis…)

               

              I trying and testing…

              Now I can start a process (with an hardcoded assignee). This assignee can see that there is a task for him and complete this task, so that the workflow is completed

               

              But one point that makes me a little bit nervous is the thing with the forms that are needed for data input from the user. The user has to input data because this is the only way that he can influence the workflow.

               

              One idea is, that I work with eventhandlers, at the end of a human task, that are taking data from a bean.

              The user has to put in the data in a JSF-form which stores the data in the bean.

               

              But I think this is a very static way of doing data input from a custom web application…

              Do you or everyone else here have a better idea of solving this problem?

               

              Greetings from Germany

              Sandro

              • 4. Re: JBPM & WebApplication (for replace jbpm console)
                Ronald van Kuijk Master
                Store the date via xxxService.setVariable(....) in the process. No need for eventlisteners at all....
                • 5. Re: JBPM & WebApplication (for replace jbpm console)
                  r 0 Newbie

                  Hello John,

                   

                  I have solved some of my problems and I think this could interest you too.

                  I’m using JSF2.0 for my web application and solved the user input problem the following way.

                   

                  I put a relative path to the input form for the task in the form flied of the task:

                   

                  <task assignee="alex" form="../forms/userTaskForm1.jsf" g="220,16,92,52" name="task1">
                  

                   

                  This page contains the following code:

                   

                  <h:inputText id="input1" value="#{processVariables.hashMap['Zahl1']}">
                                          <f:converter converterId="javax.faces.Long" />
                                    </h:inputText>
                                    <h:inputText id="input2" value="#{processVariables.hashMap['Zahl2']}">
                                          <f:converter converterId="javax.faces.Long" />
                                    </h:inputText>
                                    <h:inputText id="imput3" value="#{processVariables.hashMap['Zahl3']}">
                                          <f:converter converterId="javax.faces.Long" />
                                    </h:inputText>
                                    <h:commandButton value="Setze Variable"
                                          actionListener="#{taskController.setVariables}" />
                  

                   

                  This stores the data from the input flieds in a HashMap. When the user clicks on the commandButton this HashMap is set as variables for the task.

                   

                  This works fine but is has two problems.

                  The first one is that I have to declare the type of the variables in the frontend with the help of converters. If I don’t do this, every variable is stored as a string.

                   

                  The second one is that I have to set the names for the variables in the frontend “value="#{processVariables.hashMap['Zahl3']}">” So Zahl3 is the name/key of the variable.

                   

                  Is there a possibility to predefine variables of a process in the procesdefinition.jpdl.xml?

                  So that I can readout the names and variables just have to fill a HashMap which already exists?

                   

                  And Ronald thanks for your advice!

                   

                  Greetings

                  Sandro