0 Replies Latest reply on Feb 15, 2010 12:18 PM by ciccio ciccio

    New Instance and Setters : All in one task

    ciccio ciccio Newbie

      Hi guys,

      I'm using jBPM 4.3.

      I instantiate an object using a factory and then I need to set its properties and pass it as an argument to another method. The problem is that i can do this in 2 steps:

       

      I Get the class instance with:

      <java class="jbpm.demo.MyClassFactory" method="getMyClass" name="init" var="myInstance">
                <arg>
                     <string value="MyClassName"/>
                </arg>
            <transition name="to execute" to="execute"/>
      </java>
      

       

      and then I set the properties and call the method with:

       

      <custom class="jbpm.demo.Executor" name="execute">
                <field name ="classToExecute">
                     <object expr="#{myInstance}">
                          <property name="name"><string value="John Smith"/></property>
                          <property name="City"><string value="New York"/></property>
                     </object>
                </field>
                <transition name="to end" to="end"/>
      </custom >
      

       

      I'd like to merge <java> and <custom> task in one step, but i don't know if it's possible and how to.

      <object class="..."> is not possible to use because I instantiate the class with reflection and the class name can differ from case to case.

      Any suggestions?

      Thanks in advance.