1 2 3 Previous Next 33 Replies Latest reply on Feb 28, 2007 4:52 AM by avbentem Go to original post
      • 15. Re: jpdl-3.2.Beta2: how to access variable from task form in

         

        "kukeltje" wrote:
        You do not seem to have any variables declared in the tasks and yes you need a controller there. afaik, the variables are transient if not declared on the task.

        "kukeltje" wrote:
        I'm referring to the task nodes. not specificially the task forms


        Allright, but as far as I can tell a decision within processdefinition.xml cannot hold a task, nor can be part of a task...?

        If the task nodes that use forms should in fact also explicitly have a controller (in processdefinition.xml) to allow the values to propagate to non-form nodes (such as the decision), then I think the values should also not be propagated from one form to another form without such explicit controller?

        Regards,
        Arjan.

        • 16. Re: jpdl-3.2.Beta2: how to access variable from task form in
          kukeltje

           

          Allright, but as far as I can tell a decision within processdefinition.xml cannot hold a task, nor can be part of a task...?


          Correct...decisions do not need controllers, only tasks do

          then I think the values should also not be propagated from one form to another form without such explicit controller?


          If the behaviour you see is indeed related to this, I agree.

          • 17. Re: jpdl-3.2.Beta2: how to access variable from task form in

            Another question: how to write the expression "true" if the following is not considered true...?

            <condition expression="#{true}"/>

            (http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSPIntro7.html#wp77280 defines the literal true)

            Read on for yet another problem in my quest to extend the websales sample for a demo:

            If I understand correctly then
            <decision name="Fits in mailbox">
             <transition name="Yes" to="ship item">
             <condition expression="#{false}"/>
             </transition>
             <transition name="No" to="Inform customer"/>
            </decision>

            should execute the second transition, which has no condition and thus is the 'otherwise' branch. However, again I get
            [Decision] decision didn't select transition, taking default Transition(Yes)

            But... I get the very same message using
            <condition expression="#{true}"/>

            ...so the above might just be caused by my trouble with decisions in the workflow. If not, then maybe I'll investigate the cause later on, or repost this in a thread of its own.

            Documentation: http://docs.jboss.org/jbpm/v3/userguide/jpdl.html#condition.element states
            The contents of the condition element is a jPDL expression that should evaluate to a boolean. A decision takes the first transition (as ordered in the processdefinition.xml) for which the expression resolves to true. If none of the conditions resolve to true, the default leaving transition (== the first one) will be taken.

            Another section of the same page at http://docs.jboss.org/jbpm/v3/userguide/jpdl.html#decision.element claims
            The leaving transitions of a decision can be extended with a condition. The decision will look for the first transition for which the condition evaluates to true. A transition without a condition is considered to evaluate to true (to model the 'otherwise' branch).

            Arjan.

            • 18. Re: jpdl-3.2.Beta2: how to access variable from task form in

              OK, getting a bit tired of re-deploying my process every time, I decided to peek into the database. Guess what ;-)

              select length(condition_)
              from jbpm_transition
              where condition_ is not null

              only yields a single non-zero value. All other expressions I've set in processdefinition.xml did not make it into the database...?! So: there's many process definitions in my database, most of them with some decision node, for which the conditions have been set to some zero-length string -- except for one...

              Some more tests seem to indicate that, for 3.2.Beta2 Suite,
              <condition>#{true}</condition>

              gets me "#{true}" in the database after deployment using GPD, while
              <condition expression="#{true}"/>

              gives me a zero-length (non-NULL) string.

              OK, that's a start!

              However, even when the simple "#{true}" is in the database, I still keep getting the same old
              decision didn't select transition, taking default Transition


              There's more, but this might be as expected, as I set the decisions on transitions:
              select * from jbpm_decisionconditions

              yields zero rows.
              select * from jbpm_node where class_ = 'D'

              shows NULLs for column decisionexpression_ .

              Maybe I should deploy without GPD, just to see what that gets me in the database.

              • 19. Re: jpdl-3.2.Beta2: how to access variable from task form in

                 

                "avbentem" wrote:
                If I understand correctly then
                <decision name="Fits in mailbox">
                 <transition name="Yes" to="ship item">
                 <condition expression="#{false}"/>
                 </transition>
                 <transition name="No" to="Inform customer"/>
                </decision>

                should execute the second transition, which has no condition and thus is the 'otherwise' branch. However, again I get
                [Decision] decision didn't select transition, taking default Transition(Yes)

                Just for the archives: after deploying, the database table jbpm_transitions showed a zero-length value in column decision_ for the 'otherwise' branch. Changing it to a NULL value did not change the behavior, not even when I restarted JBoss.


                • 20. Re: jpdl-3.2.Beta2: how to access variable from task form in

                   

                  "avbentem" wrote:
                  Just for the archives: after deploying, the database table jbpm_transitions showed a zero-length value in column decision_ for the 'otherwise' branch.

                  Errr, that is not true. It was in fact a true NULL value, not some zero-length string (the "#{false}" expression was, however, inserted in the database as a zero-length string; see a previous post in this very thread).

                  • 21. Re: jpdl-3.2.Beta2: how to access variable from task form in
                    kukeltje

                     

                    "avbentem" wrote:

                    Documentation: http://docs.jboss.org/jbpm/v3/userguide/jpdl.html#condition.element states
                    The contents of the condition element is a jPDL expression that should evaluate to a boolean. A decision takes the first transition (as ordered in the processdefinition.xml) for which the expression resolves to true. If none of the conditions resolve to true, the default leaving transition (== the first one) will be taken.

                    Another section of the same page at http://docs.jboss.org/jbpm/v3/userguide/jpdl.html#decision.element claims
                    The leaving transitions of a decision can be extended with a condition. The decision will look for the first transition for which the condition evaluates to true. A transition without a condition is considered to evaluate to true (to model the 'otherwise' branch).

                    Arjan.


                    For 3.2 you should use the docs from cvs. Especially the part for conditions in decisions has been clarified.

                    • 22. Re: jpdl-3.2.Beta2: how to access variable from task form in
                      kukeltje

                       

                      "avbentem" wrote:
                      "avbentem" wrote:
                      If I understand correctly then
                      <decision name="Fits in mailbox">
                       <transition name="Yes" to="ship item">
                       <condition expression="#{false}"/>
                       </transition>
                       <transition name="No" to="Inform customer"/>
                      </decision>

                      should execute the second transition, which has no condition and thus is the 'otherwise' branch. However, again I get
                      [Decision] decision didn't select transition, taking default Transition(Yes)

                      Just for the archives: after deploying, the database table jbpm_transitions showed a zero-length value in column decision_ for the 'otherwise' branch. Changing it to a NULL value did not change the behavior, not even when I restarted JBoss.


                      Again, read the 3.2 cvs docs... there has been clarification on the expected behavior.

                      • 23. Re: jpdl-3.2.Beta2: how to access variable from task form in

                         

                        "kukeltje" wrote:
                        For 3.2 you should use the docs from cvs. Especially the part for conditions in decisions has been clarified.

                        Ok, it took me some time to figger out that the repository at SourceForge.net is no longer used. Using :pserver:anonymous:@anoncvs.forge.jboss.com:/cvsroot/jbpm instead of :pserver:anonymous@cvs.sourceforge.net:/cvsroot/jbpm did give me some new insight:

                        http://fisheye.jboss.com/browse/JBPM/jbpm.3/jpdl/userguide/en/modules/jpdl.xml
                        Each leaving transitions of a node can have a condition. The decision will use these conditions to look for the first transition for which the condition evaluates to true.

                        The first transition represents the otherwise branch. So first, all transitions with a condition are evaluated. If one of those evaluate to true, that transition is taken. If no transition with a condition resolves to true, the default transition (=the first one) is taken.


                        ...and...
                        <!-- OOPS i wich this were true, but i think i never implemented it that way :-(
                         A transition without a condition is considered to evaluate to true (to
                         model the 'otherwise' branch).
                        -->


                        Given the comment above I guess this does not apply to the 3.1 branch either.

                        Anyway: the above has been in CVS quite some time, so is also present in the documentation in the downloadable distributions. Don't know why I was reading them at jboss.org instead of from my local harddisk...

                        Thanks, one mistery less (still my problems with variables needs to be solved).

                        Arjan.



                        • 24. Re: jpdl-3.2.Beta2: how to access variable from task form in
                          kukeltje

                          did you try with taskcontrollers? I've not had access to a jbpm installation, so have not tried yet.

                          • 25. Re: jpdl-3.2.Beta2: how to access variable from task form in

                             

                            "avbentem" wrote:
                            select * from jbpm_decisionconditions

                            yields zero rows.

                            This is to be expected; the release notes state:
                            Since, 3.2, the table JBPM_DECISIONCONDITION is not used any more. But it is still in the default generated schema because of backwards compatibility reasons. Newly deployed processes (even if they have decision conditions) will not use that table any more. So if your old processes don't have decision conditions or if you only deploy new processes to your db, you can safely drop the JBPM_DECISIONCONDITION table. If you do that, don't forget to remove the line that refers to the decision condition class in your hibernate.cfg.xml and also remove the decisionConditions list entry in the org/jbpm/graph/node/Decision.hbm.xml file.


                            • 26. Re: jpdl-3.2.Beta2: how to access variable from task form in

                              ...solved!

                              This may be caused by using a more recent version of the Hibernate libraries (though I doubt the older version would not create an empty List), or maybe is simply a bug that everyone would suffer. I did not yet investigate; I will submit a bug report later, if I did not cause this myself...

                              http://fisheye.jboss.com/browse/JBPM/jbpm.3/jpdl/jar/src/main/java/org/jbpm/graph/node/Decision.java?r=1.3

                              48 List decisionConditions = null;
                               :
                              105 } else if (decisionConditions!=null) {
                              106 // backwards compatible mode based on separate DecisionCondition

                              In my setup, database table JBPM_DECISIONCONDITION is empty, but for this Hibernate still creates an empty List. Changing into:
                              105 } else if (decisionConditions!=null && !decisionConditions.isEmpty()) {

                              solved my problems. Now both
                              <decision name="Large quantity?">
                               <!-- First transition is also the default ("otherwise") branch -->
                               <transition name="No" to="ship item"/>
                               <transition name="Yes" to="Make appointment">
                               <condition><![CDATA[#{quantity > 2}]]></condition>
                               </transition>
                              </decision>

                              and
                              <condition><![CDATA[#{contextInstance.variables['quantity'] > 2}]]></condition>

                              work as expected (as noted earlier in this thread, using the 'expression' attribute somehow does not get the condition into the database to start with).

                              Arjan.

                              • 27. Re: jpdl-3.2.Beta2: how to access variable from task form in
                                kukeltje

                                hhmmm.... I somehow in the back of my mind knew about this table not being used anymore. Thanks for finding this.

                                We still have to be sure that your change does not affect backwardscompatibility, but that is for Tom to find out.

                                • 28. Re: jpdl-3.2.Beta2: how to access variable from task form in

                                   

                                  "kukeltje" wrote:
                                  I somehow in the back of my mind knew about this table not being used anymore.

                                  Well, in fact this is documented in the release notes, which even state that one could remove that table altogether when also cleaning up the Hibernate definitions. However, the lines of code to allow for this table NOT to be empty (for processes that were created prior to 3.2.x) just don't work in my setup.

                                  Arjan.

                                  • 29. Re: jpdl-3.2.Beta2: how to access variable from task form in
                                    cdart_rrr

                                    Hi Arjan, having battled with Conditions recently I'd like to add my 2 cents' worth that the reason why your original transition/condition@expression wasn't evaluated looks to be a bug in org.jbpm.jpdl.xml.JpdlXmlReader in resolveTransitionDestination() (l 805 of my version of 3.2beta2). It tries to get the expression from the text of element - if null it then goes to try to get it from the expression attribute. Only trouble is the text is returned from getTextTrim() as "" rather than null so you never get to look at the attribute. This is of course what you found (by putting the expression as the text of rather than as an attribute). But changing l 805 to test for "" as well as null then allows either format...

                                    if ( null == condition || condition.length() == 0) {
                                     //....
                                    

                                    It ought to be a bug but I can't currently get the src from cvs to see if it's been corrected. Is cvs still there? (I noted your comment above about wrong cvs details).
                                    brgds
                                    \rr