1 2 Previous Next 15 Replies Latest reply on Mar 8, 2010 3:47 AM by kukeltje

    getting name of leaving transition from decision node (jbpm 4.0)

    praneet

      hi everyone

        i want to know the name of all the transitions leaving the decision node ,so that i can show

        all the value to the user on the form so that if he select the particular value in combo box

        respective transition will take place.

        • 1. Re: getting name of leaving transition from decision node (jbpm 4.0)
          swiderski.maciej

          on ftl forms you can use something like this to create buttons for each available transition:

          <#list outcome.values as transition>
              <input type="submit" name="outcome" value="${transition}">
          </#list>
          

          /Maciej

          • 2. Re: getting name of leaving transition from decision node (jbpm 4.0)
            praneet

            thanks for replying swider

              what am using is combobox which will contain value which is select or reject,

            for each student there is combobox which i will select and finally i have submit button.

              and am using my own jsp page.

                if i will select  'select' then it will refer to select transition and then it move on corresponding node

            • 3. Re: getting name of leaving transition from decision node (jbpm 4.0)
              swiderski.maciej

              so it means that you have only one transition that follows the submit button and combo boxes are just variables that will be submitted as variables - isn't that true?


              Unless you have a separate form for each student...

              • 4. Re: getting name of leaving transition from decision node (jbpm 4.0)
                praneet

                ya form submission is in task node and there after is decision node

                what i want is value in combobox should cm from the transitions taking from decision node

                 

                 

                <task assignee="#{hrname}" g="104,114,155,52" name="Select-Student">

                      <transition g="-42,-18" name="to Selected?" to="Selected?"/>

                   </task>

                 

                   <decision name="Selected?" g="96,102,48,48" >

                    <handler class="jbpm.MyHandler" />

                    <transition name="Select" to="send-interview-email" g="120,60:-36,23" />

                    <transition name="Reject"  to="end1" g=":-15,-21" />

                  </decision>

                so i want Select and Reject in combobox.
                    meaning is that suppose after some day i also want
                   one transition like pending, so i can dynamically include this in
                   my combobox
                • 5. Re: getting name of leaving transition from decision node (jbpm 4.0)
                  swiderski.maciej

                  ok, so what you are trying to do is to create a combo box based on values from a node's transitions and make them available on task form.

                   

                  One value from the list can be selected and default transition from task node is taken to move to decision point. Decision point takes the correct transition based on process variable set with value of the combo box selected on task form.

                   

                  The reason why you want to do that is that you have an external JSP page that acts as task form.

                   

                  Did I follow your case correctly?

                   

                  If so, to me it seems like mixing to nodes into one. As far as I understand it is that you do not want to change your JSP page when changing process?!

                   

                  Perhaps you could use process variable that keeps information about possible values for combo box that can be easily mapped to decision point transitions - does it make sense to you?

                  • 6. Re: getting name of leaving transition from decision node (jbpm 4.0)
                    praneet


                    Did I follow your case correctly?

                      ya u are

                     

                    does it make sense to you?

                    no ,i dont want to use process variable

                     

                    i want some api or workaround such that

                     

                    node.getallleavingtransitionsname

                    and then i want to store it in process variable so that

                    i can extract these values in combobox while displaying my jsp page.

                    • 7. Re: getting name of leaving transition from decision node (jbpm 4.0)
                      swiderski.maciej

                      where do you want to place this method call (node.getAllLeavingTransitionName)? Afaik there is no such method available in public API. Most likely you could achieve that using internal classes but that is not recommended.

                       

                      And since at the end you will put the values (transition names) as process variables why not doing that directly?! From JSP page point of view it's transparent either you will use dynamic query of node's transitions or set it manually as process variable in the model.

                      • 8. Re: getting name of leaving transition from decision node (jbpm 4.0)
                        praneet

                        there is no such method available in public API

                           i know this there is no such method like this ,but i am expecting if there such

                         

                         

                        From JSP page point of view it's transparent either you will use dynamic query of node's transitions or set it manually as process variable in the model.

                        suppose if tomorrow i have to include two more transition then i need to set these two also using processvariable which is not good as i have to modify this code.so i want solution like this so that if new transition come there is no need to change the code.

                        • 9. Re: getting name of leaving transition from decision node (jbpm 4.0)
                          swiderski.maciej

                          I completely understand your goals but I think it can be achieved differently than querying for outgoing transition of a given node. Since you have to modify the diagram I would try something like this:

                           

                          Add event listener to the start node on event end that will set required variables:

                          <on event="end">
                              <event-listener class="com.company.process.StartupEventListener">
                                    <field name="taskOptionsAsVariable"><string value="selected,rejected"/></field>
                              </event-listener>
                          </on>
                          

                           

                          Create class for that event listener:

                          public class StartupEventListener implements EventListener {
                          
                            private String taskOptionsAsVariable; 
                            
                            @Override
                            public void notify(EventListenerExecution execution) throws Exception {
                              
                              if (taskOptionsAsVariable != null) {
                                String[] options = taskOptionsAsVariable.split(",");
                               
                                execution.createVariable("selectionOptions", Arrays.asList(options));
                               
                              }
                              
                            }
                          
                          }
                          

                          Since there is no support (afaik) for collections and arrays use comma separated values for possible options to choose in the task form later in the process - same as outgoing transitions for decision point.

                           

                          So after first release you don't need to change anything in the code, just the diagram.

                           

                          Hope that can give you an alternative.

                           

                          Cheers,

                          Maciej

                          • 11. Re: getting name of leaving transition from decision node (jbpm 4.0)
                            kukeltje
                            In addition to this, decisions are NOT STATES. So it really feels like a putting a conceptually wrong solution in a kind of hacky way in jBPM. Using variables from a task is what needs to be used or even just a task with transitions (that you can query) and call that task 'decide'
                            • 12. Re: getting name of leaving transition from decision node (jbpm 4.0)
                              praneet

                              hi ronald

                                thanks for replying

                               

                                 but am unable to get what u are saying ,can u put some more light on this .

                                   what am getting is u waana say is instead of using decision we should use

                                task node.

                              • 13. Re: getting name of leaving transition from decision node (jbpm 4.0)
                                swiderski.maciej

                                Ronald, what do you mean by decisions are NOT STATES - did I suggested something like that?

                                 

                                My intention was to suggest a way to setup variables that can be used as input to task node instead of querying for outgoing transitions of a node that is after task node.

                                 

                                Apologies if I made myself unclear or put irrelevant content.

                                 

                                /Maciej

                                • 14. Re: getting name of leaving transition from decision node (jbpm 4.0)
                                  kukeltje
                                  No, you did not suggest this. It was my impression that the original poster wants to use it like this.
                                  1 2 Previous Next