1 2 Previous Next 15 Replies Latest reply on Apr 26, 2010 3:27 AM by rebody

    How to do automatic transition from one state node to any other node

    felixkjose

      Hi All,

       

      I am having a process definition as follows:

       

      <?xml version="1.0" encoding="UTF-8"?>

      <process name="ReserchPage" xmlns="http://jbpm.org/4.3/jpdl">
         <start name="start" g="38,19,48,48">
            <transition name="to Research" to="research" g="-54,-18"/>
         </start>
         <state name="research" g="207,17,141,52">
            <transition name="to check number of Entities present in WebPage" to="checknumOfEntities" g="-55,-21"/>
         </state>
         <java g="230,327,138,40" method="checkNumOfEntities" name="checknumOfEntities">
        <transition name="to end" to="end" g="-81,-18"/>
      </java>
         .... 

      </process>

       

      Can anybody please let me know how the automatic transition can make from <state name="research"...> to <java....name="checknumOfEntities> without using an external signaling using executionService.signalExecutionIn() method.

      In the older versions of JBPM we were having the option of using an ActionHandler and from its execute method we were abot to signal to the next transition. But using JBPM-4.3 even a single tansition is not able to done a auto transition?

       

      Please help me on this.

      And one more question why the ActionHandler is got removed in this version?

       

      I am expecting a quick reply from anyone of you.

       

      Thank You very much,

      With Regards,

      Felix K Jose

        • 1. Re: How to do automatic transition from one state node to any other node
          rebody

          Hi Felix,

            If you want to make execution go through next actvity automaticly, why not use a automaticActivity like JavaScript or ScriptActivity.  The StateActivity is used to wait a external message from outside of the process engine.  What are you waiting for in this scenario?

          • 2. Re: How to do automatic transition from one state node to any other node
            felixkjose

            Hi Huisheng,

             

            I have to maintain the different states(open, being review, research, reviewed, completed,rejected, closed) in my workflow. Without state nodes how can I maintain the states? That is the reason behind using state nodes.

             

            If you have any clues on this please let me know.

             

            Thank you very much,

            With Regards,

            Felix K Jose

            • 3. Re: How to do automatic transition from one state node to any other node
              rebody

              Hi Felix,

                OK, I know you want to use jBPM as a FSM.  But the StateActivity is not a place to change the state of business information.  You should understand the usage of StateActivity, it is used to wait for a external message from outside the process engine.

               

                If you want to maintain the state of business information, you could use the JavaActivity or ScriptActivity, both of them can do what you want, and they can go on execute.

              1 of 1 people found this helpful
              • 4. Re: How to do automatic transition from one state node to any other node
                rebody

                Hi Felix,

                  I guess the key of problem is What you really want to do?  You never tell us that, just ask where is the ActionHandler, how could we use ActionHandler to let process go on execute.  If we still focus on how to implement a operation, I am afraid we could never find a solution.

                 

                  From your description, I think you would better use TaskActivity to replace StateActivity.  Because in fact, what you want to do is let a document or a contract or something else to be reviewed, to be researched, to be completed or to be closed. There must have someone to do these jobs.  So we could use TaskActivity to create a task to these people and let process waiting for people operations.  When the people complete  his task, related process will be signal to the next step.

                • 5. Re: How to do automatic transition from one state node to any other node
                  felixkjose

                  Hi Huisheng,

                   

                  Whatever you have told is correct. My requirement is to verify a form(web page) And I am having 3 actors 1. User(who creates this form) , 2. Analyst (who analysing the page), 3. Reviwer( who reviews the page)

                   

                  So when a User submits a page then it should assign to an Analyst and the Analyst should do the analysis (some business logic)and he can send it to either review or reject. When Analyst send it to Review then the page should assign to a Reviewer. And the reviewer should start review the page (some business logic) and the if he needs more information again send it to Analyst who can give the additional information andf then again it should send to Reviewer.In the other hand the Reviewer can either close(end) or reject the review.

                   

                  So as you told I have to maintain the states also here( like open, being reviewed, reviewed, completed, etc..). So for doing this which node we can use either state, task or java or custom.

                   

                  I think now you got my requiremnt and so please lhelp me on the solution.

                   

                  Thank you Huisheng for your patience. And I am expecting some more help from you .

                   

                  With Regads,

                  Felix K Jose

                  • 6. Re: How to do automatic transition from one state node to any other node
                    rebody

                    Hi Felix,

                      It is clearly enough.  I make a process definition to demostrate your requirement.  You can see it in the attach.

                    1 of 1 people found this helpful
                    • 7. Re: How to do automatic transition from one state node to any other node
                      felixkjose

                      Hi Huisheng,

                       

                      Thank you for the reply.Very sorry to disturb you. As I mentioned how can the states maintain? And also for transition from one task node to another we need some signaling,right? How can we obtain that?

                       

                      Thank you and Regards,

                      Felix Jose

                      • 8. Re: How to do automatic transition from one state node to any other node
                        swiderski.maciej

                        Hi,

                         

                        in general when we are talking about task nodes, transition will be taken as soon as user (assigned to it) will complete the task.

                         

                        To keep state information you can use task/process variables.

                         

                        To make automatic transition from wait state to any other you can user timer transition.

                         

                        HTH

                        Maciej

                        • 9. Re: How to do automatic transition from one state node to any other node
                          rebody

                          Hi Felix,

                            Here is the TestCase for you to understand how  TaskActivity work.

                           

                            And I suggest you to watch this demo video, to understand how a process work.

                           

                            http://www.family168.com/jbpm4/demo/workspace-swf.html

                          • 10. Re: How to do automatic transition from one state node to any other node
                            felixkjose

                            Hi Huisheng,

                             

                            Thank you so much for your answer. My requirement almost got answered. But I am having one more doubt, how can we have the business logic (that should be in java classes) with task nodes? My doubt is how we have business logic in task nodes?

                            I really worried to ask so much questions but I think with you peoples help only I can understan JBPM in depth and complete my project successfully.

                            Once again thank you,

                             

                            Thank you very much ,

                             

                            WithRegards,

                            Felix K Jose

                            • 11. Re: How to do automatic transition from one state node to any other node
                              felixkjose

                              Hi Maceij,

                               

                              Thanks alot for you reply. And please send some links if available regarding the task nodes. And some tough samples that using task nodes.

                               

                              Thank you and Regards,

                              Felix K Jose

                              • 12. Re: How to do automatic transition from one state node to any other node
                                rebody

                                Hi Felix,

                                  You shouldn't put business logic into process engine.  You could handle business logic in your class, then invoke the process engine to continue the process.  Also you should handle the state of document in your class, not process engine.  The only job of process engine is running through the graphic, when it arrived a TaskActivity, it will create a task, then you could do some related operation.  Show these tasks to end users, when end users complete a task, you could do some business logic, like save data into database, then invoke the api of process engine, let process engine know which next step we will take.

                                • 13. Re: How to do automatic transition from one state node to any other node
                                  felixkjose

                                  Hi Huisheng,

                                   

                                  Thanks alot. One thing can you please send me a sample application that is having atleast one task node which is having the end user assinged(swimlane) and the java classes which are doing some business logic (as you mentioned). A simple standalone program. Please help me.

                                   

                                  Thank you and Regards,

                                  Felix K Jose

                                  • 14. Re: How to do automatic transition from one state node to any other node
                                    felixkjose

                                    Hi Huisheng,

                                    When the control comes in the task node "analyse" from "create form" how come the business logic(eg.: Analyser.java) get executed?
                                    For example:
                                    <task g='93,93,90,50' name='create form' assignee="publisher">
                                        <transition to='analyse'/>
                                      </task>
                                      <task g='213,93,90,50' name='analyse' assignee="analyzer">
                                        <transition name='review' g='-21,-22' to='review'/>
                                        <transition name='reject' g='258,42:56,-2' to='end 2'/>
                                      </task>
                                      when the control flow comes in the analyse task we need execute some business logic (eg.: Analyser.java)to analyse the form.
                                      How can I do that. Which will call Analyser.java class? Once the execution of that class gets over how the transition occurs to the next task?
                                     
                                      Analyser.java
                                     
                                      public class Analyser{
                                     
                                      public String analyse()
                                      {
                                      String country = form.getCountry();
                                      if(null!=country||""!=country)
                                      {
                                      return "review"
                                      }
                                      else
                                      {
                                      return "reject"
                                      }
                                      }
                                      Can you please give a reply an answer to the same as soon as possible? Please..
                                     
                                      Thank You very much,
                                      With Regards,
                                      Felix K Jose

                                    1 2 Previous Next