7 Replies Latest reply on Jun 18, 2012 4:52 AM by swiderski.maciej

    Defining variables

    shulito

      Hi. I'm starting with jbpm 5 and I've managed to create a simple process that prints out "Hello, world!!". Now I'm trying to create a more complicated process but I can't figure out how to define the variables. I now you can use 'globals' and that those variables are accessible from all the processes, but I wan't to define variables that are only accessible from within one process. I'm using 'BPMN2 - Modeler' to create the processes wich is the modeler that installs the demo.

       

      Thanks

        • 1. Re: Defining variables
          salaboy21

          You mean, the BPMN2 modeler for Eclipse? or the Web Process Designer?

          Process variables as you mention are defined at process level, so usually you need to click on the background (not any activity) and then define the types of your variables. Then at runtime you will provide the real instances using for example ksession.startProcess(<process id>, <Map with process variables>);

          Cheers

          • 2. Re: Defining variables
            shulito

            Yes, the eclipse modeler. But where do I define them?? I'm looking at 'Properties view (eclipse) -> Data Items' and there's a lot of types of items: property, item, resource, message, etc.

            • 3. Re: Defining variables
              shulito

              Si me ayudas te prometo que te compro el libro 'jBPM 5 Developer Guide' cuando salga en agosto (sólo porque sos argentino como yo jaja)

              • 4. Re: Defining variables
                swiderski.maciej

                Define them in property section as variables are named properties in BPMN2

                 

                HTH

                • 5. Re: Defining variables
                  salaboy21

                  +1 to Maciej answer

                  I'm not sure if buying the book is a good idea, it will get stuck in customs for a long time

                  • 6. Re: Defining variables
                    shulito

                    Mauricio Salatino escribió:

                     

                    +1 to Maciej answer

                    I'm not sure if buying the book is a good idea, it will get stuck in customs for a long time

                     

                    jaja I'll take that under consideration

                     

                    I've managed to get it to work, but I had to modify the xml directly to change this:

                    <bpmn2:property id="Property_1" itemSubjectRef="ItemDefinition_1" name="userName"/>

                     

                    to this:

                    <bpmn2:property id="userName" itemSubjectRef="ItemDefinition_1" name="userName"/>

                     

                    so I can do this in the action of a Script Task:

                    System.out.println(userName);

                     

                    otherwise, I would have to do this in the Script Taks:

                    System.out.println(Property_1);

                     

                    is there a way to change the id of the property using the modeler or do you always have to modify it using the xml editor??

                    • 7. Re: Defining variables
                      swiderski.maciej

                      Looks like something that needs to be fixed, could you please open a jira for this?

                       

                      Cheers