14 Replies Latest reply on Oct 29, 2009 5:25 PM by sebastian.s

    JBPM4: How to find leaving transitions of an execution

    mbelow

      Hello,

      I'm quite new to JBM4... I would like to fetch a list of all transitions leaving the current activity of an execution. I thought that this would actually be a quite common thing to do, but I was only able to archive this with an ugly cast (from Execution to ExecutionImpl).

      Is there a cleaner way of doing this using the API?

      Thanks in advance,
      Martin

        • 1. Re: JBPM4: How to find leaving transitions of an execution
          sebastian.s

          Till now I haven't been in the situation where would have been need of this but I would consider this a common thing, too. I don't know if this is just a thing left out in the API or if there are reasons. Let's see what the dev's and Ronald say:

          Take a look at this post:

          http://www.jboss.org/index.html?module=bb&op=viewtopic&t=162690

          It's a bit hard to find because the title is somehow misleading. It's about listing outgoing transititions and not about acitivities.

          • 2. Re: JBPM4: How to find leaving transitions of an execution
            kukeltje

            File a Jira issue, gather votes and let's see what comes out of that. Personally I think it would be an interesting addition.

            • 3. Re: JBPM4: How to find leaving transitions of an execution
              sebastian.s

              You could count on my vote. I consider you to point out the use case in the feature request.

              • 4. Re: JBPM4: How to find leaving transitions of an execution
                mbelow

                Thank your for the response! After reading your replies, it came to my mind that I might be going to the wrong direction of implementing my app.

                From my point of view, it is absolutely neccessary to get information on the outgoing transition of the current activity. (Unless you create your own views for each state of the process).

                This was actually very easy to do in JBPM3 (because you always had the hibernate pojos at hand).

                What do you think, am I hadding torwards the wrong direction?

                Thanks,
                Martin Below

                • 5. Re: JBPM4: How to find leaving transitions of an execution
                  sebastian.s

                  From what I can say with my limited knowledge and experience of implementing an application with jBPM I would say no. It should be possible to retrieve the outgoing transitions of an activity and the approach seems clean to me.

                  But why not let us know a bit more about the use case? Let's see what Ronald or any other more experienced user than me can say about it.

                  What do you mean by "Unless you create your own views for each state of the process" ?

                  P.S.: Have you filled the JIRA issue already?

                  • 6. Re: JBPM4: How to find leaving transitions of an execution

                    Pardon my jumping in, but here's one use case for this:

                    In our application, it is possible for a user to send an invalid transition to jBPM. When this occurs, there is a requirement for the server to display an error message that lists the valid transitions.

                    • 7. Re: JBPM4: How to find leaving transitions of an execution
                      sebastian.s
                      • 8. Re: JBPM4: How to find leaving transitions of an execution
                        mbelow

                        Sebastian,

                        when the process arrives at a certaion point where a node has more than one outgoing transition, the user actually needs to make a choise which transition to take. So I need to display all possible transitions to the user.

                        I'm still not sure if I'm running in the wrong direction, because this seems to obvious to me...

                        Thanks for the help again,
                        Martin

                        • 9. Re: JBPM4: How to find leaving transitions of an execution
                          sebastian.s

                          If you want the user to make this decision you need this information and since it is supplied by the process definition it should be accessible trough the API. Have you voted yet? If not go ahead and do so and post your use case in the comments of the issue.

                          • 10. Re: JBPM4: How to find leaving transitions of an execution
                            nilspreusker

                            Hi, I just voted:)

                            Regarding your doubts:

                            when the process arrives at a certaion point where a node has more than one outgoing transition, the user actually needs to make a choise which transition to take. So I need to display all possible transitions to the user.

                            I'm still not sure if I'm running in the wrong direction, because this seems to obvious to me...


                            I think you are going in exactly the right direction. As I understand it (correct me if I'm wrong!), information about how the user can interact with the process instance in jBPM 4 is currently meant to be provided with task forms. A reference implementation exists for the GWT console. However, I totally agree with what Sebastian stated earlier:

                            If you want the user to make this decision you need this information and since it is supplied by the process definition it should be accessible trough the API.


                            For use cases where no user input - other than a decision - is required, this would provide a very nice way to create dynamic user interfaces without the need for a custom task form implementation.

                            And while we're at it, wouldn't it also be nice to be able to query the process instance for the process variables that will be required after a transition? ...but now I'm getting ahead of myself:)

                            Anyway, I'm glad to see this discussion here!

                            Cheers, Nils

                            • 11. Re: JBPM4: How to find leaving transitions of an execution
                              sebastian.s

                               

                              "nilspreusker" wrote:
                              Hi, I just voted:)

                              Great. :)

                              "nilspreusker" wrote:

                              I think you are going in exactly the right direction. As I understand it (correct me if I'm wrong!), information about how the user can interact with the process instance in jBPM 4 is currently meant to be provided with task forms. A reference implementation exists for the GWT console. However, I totally agree with what Sebastian stated earlier:

                              If you want the user to make this decision you need this information and since it is supplied by the process definition it should be accessible trough the API.


                              For use cases where no user input - other than a decision - is required, this would provide a very nice way to create dynamic user interfaces without the need for a custom task form implementation.


                              I might even face similar use cases right now. My thoughts right now are pretty much related to dynamic user interfaces. I especially don't like the idea of creating task specific forms for simple things like decisions where just want to the user to decide between "yes" and "no", "A" and "B" etc.

                              "nilspreusker" wrote:
                              And while we're at it, wouldn't it also be nice to be able to query the process instance for the process variables that will be required after a transition? ...but now I'm getting ahead of myself:)


                              I am not sure if this possible and if this would really make sense. Maybe you can explain your thoughts a bit more here.

                              "nilspreusker" wrote:

                              Anyway, I'm glad to see this discussion here!


                              Yes, me too. This might turn out be a discussion for the developers' forum. I'd love to hear one of the dev's on this. To me at first sight it seems as if this is a "quite simple" API extension which shouldn't break anything.


                              • 12. Re: JBPM4: How to find leaving transitions of an execution
                                nilspreusker

                                Hi Sebastian,

                                Me: wouldn't it also be nice to be able to query the process instance for the process variables that will be required after a transition?

                                Sebastian: Maybe you can explain your thoughts a bit more here.


                                My basic though is that the more details we can get about the process through the API at run-time, the closer we get to creating or generating a default user interface for processes.

                                If it was possible to retrieve information about the process variables that are required in the resulting task/state/activity node of a transition, one could think of a user interface that shows a default form when a transition is invoked (i.e. default task forms), based on the type and name of the variables. These could be customized by providing task forms along with the process deployment as it is shown in the task form example.

                                I suppose this is really turning more into a development forum discussion... Please let me know what you think!

                                Cheers, Nils

                                • 13. Re: JBPM4: How to find leaving transitions of an execution
                                  mbelow

                                  Hello Nils,

                                  "nilspreusker" wrote:
                                  If it was possible to retrieve information about the process variables that are required in the resulting task/state/activity node of a transition, one could think of a user interface that shows a default form when a transition is invoked (i.e. default task forms), based on the type and name of the variables. These could be customized by providing task forms along with the process deployment as it is shown in the task form example.


                                  Makes perfect sense to me! Most information stored along with the activities are also relevant for the UI. Supplying a separate view for each activity is necessary when there is a lot of user-interaction going on, but in simple cases, one should be able to rendered the UI directly from the process.

                                  Martin


                                  • 14. Re: JBPM4: How to find leaving transitions of an execution
                                    sebastian.s

                                    I think the first requirement is a minor change since this shouldn't be much more than an extension of the API. I am saying this with my limited knowledge and of course I welcome any corrections.

                                    The second thing that Nils and Martin are proposing means a bigger change because before you can offer such an interface first of all you need to have declared process variables and you need to declare somehow that they are necessary. So this would have to be considered in connection with this issue:

                                    https://jira.jboss.org/jira/browse/JBPM-2506