4 Replies Latest reply on Aug 8, 2007 12:32 PM by rjack2

    declare variables

    stembol

      In jbpm2, it was possible to declare types and variables in processdefinition.xml.

      And what in jbpm3?

        • 1. Re: declare variables
          tom.baeyens

          the way that process variables are stored changed between 2 and 3.

          in jbpm 3, the way that a variable is stored completely depends on the java-type of the variable value. for more info, see the user guide.

          if you have a good usecase where you want to store the same java-type differently for different variables, let us know about it. cause that is the only situation that we dropped between 2 and 3.

          regards, tom.

          • 2. Re: declare variables
            kukeltje

            Tom,

            I'm enhancìng the GUI (and will send the fax for cvs access, shame on me;-) ) You can only show the right ui control if the variable has been created. If you cannot declare it one way or another, You have to write some code to create the variables in an actionhandler (e.g. on the process-start event) so you in fact still need to declare it if you want the ui to automagically show the right controls. I to would like it to be declared in the process even if it is just usable as a hint for the ui and not automagically creates them.

            Ronald

            • 3. Re: declare variables
              elem

              if what you want is building a GUI depending on a Tasknode, why you don't use your own TaskController with its own mapping between variables and GUI-View:

              <controller class='TestTaskController' config-type='constructor' >
              <variable name='a' access='read' mapped-name='x' type='String' renderas='viewtype1' />
              <variable name='b' access='read,write,required' mapped-name='y' type='Interger' renderas='viewtype2' />
              ...

              maybe it is also possible to put the variable with the right objecttype in the context

              For putting declaring variables in processdefinition look at: Delegation.java method:instantiate
              you will find the different instantiatorClasses under org.jbpm.instantiation

              see also:
              file://localhost/home/elem/develop/java/jbpm-starters-kit-3.0.1/jbpm/doc/userguide/en/html/jpdl.html#configurationofdelegations

              my be there is an error in this doc for config-type configuration-property the methodname in the instantiatorClass used by reflection is "setConfiguration(String)" and not like in jbpm 2 void configure(String);

              regards,
              Matthias

              • 4. Re: declare variables
                rjack2

                Folks,

                I ran across this problem with 3.1 recently. It seems to me you have to do the following to make this work:

                - Custom Task Controller (implementing TaskControllerHandler.java)
                - Modify VariableAcess, possibly VariableAccess.hbm.xml
                - Modify JpdlXMLReader

                I ended up just adding my types to the access attribute using
                Access->toString() for retrieval:



                Not ideal, but better in my mind than modifying JBPM.

                Robert Jackson