cancel
Showing results for 
Search instead for 
Did you mean: 

Java Object and process variable

cidmiranda
Champ in-the-making
Champ in-the-making
Hi,
Is possible define a java object as a process variable?

Thanks
4 REPLIES 4

frederikherema1
Star Contributor
Star Contributor
You can use any "serializable" Java-object as process-variable. It's serialized state will be stored in the database.

cidmiranda
Champ in-the-making
Champ in-the-making
I will set the java-object in form?
<extensionElements>
   <activiti:formProperty id="order" name="order" type="orderObject" required="true"></activiti:formProperty>
</extensionElements>

========activiti.cfg.xml===========
<property name="customFormTypes">
<list>
  <ref bean="orderObject"/>
</list>
</property>

cidmiranda
Champ in-the-making
Champ in-the-making
Hi,
i can pass a java-object in
<serviceTask id="serviceTask1" name="Validate order" activiti:expression="#{validateService.validate(java-object)}" activiti:resultVariableName="validatetime"/>

Thanks

frederikherema1
Star Contributor
Star Contributor
If you want to use form-properties to create a java-object, based on the incoming string (since posted form-property values are all strings), you'll have to create a custom form-type. See UserFormType as example (search forum for this).

Answering the second question: yes, you can pass a java-object (variable or result of another expression) as a method-argument of an expression with a method-call. Creating new instances, however, is not supported in JUEL (hence, you can't do ${bean.doStuff(new MyPojo())}).