Use java object

1
0
-1

Hi all,

I'm trying to set member of a Java Object like this

---

package pro.bonita;

import java.io.Serializable;

public class OpSum implements Serializable {

private static final long serialVersionUID = -7285183091396405846L;

private int a;

private int b;

public int getA() {

return a;

}

public void setA(int a) {

this.a = a;

}

public int getB() {

return b;

}

public void setB(int b) {

this.b = b;

}

}

---

in my simple test Process App.

I followed the steps described at http://harx.nl/create-complex-data-objects-for-bonitasoft-bpms/

In BOS 5.6 works.

Now, I'm trying to do the same thing with BOS 6.1like in figure

https://drive.google.com/file/d/0BwiZdFAlfhs3V2t4NUlvSUo3U28/edit?usp=sh...

Don't work because (Bonita BPM engine log)

at .Caused By:(data opSum does not exist in the context 7 ACTIVITY_INSTANCE

I understand that I have to instantiate it. But where and how?

Sorry for my bad english & thanks in advance.

Regards

Alessandro

4 answers

1
0
-1

This is my script that set default value

import pro.bonita.*;
def opSum = new OpSum();
opSum.a=0;
opSum.b=0;
return opSum;

1
0
-1

I tried to do it but during evaluation I get error like unable to resolve class or Unable to deserialize object

Comments

Submitted by paul33 on Fri, 04/18/2014 - 14:00

I've got the same issue, does anyone has a clue on where this might come from ?

Submitted by box on Sat, 04/19/2014 - 07:27
Submitted by paul33 on Mon, 04/28/2014 - 18:06

Thank you ! that's it !

1
0
-1

Thank you.

PS. This is a difference with the version 5.x or am I wrong?

1
0
-1

You can instantiate the java object when you define the process variable (usually in the pool). Use a groovy script for the default value. In that script create and return a new object.

Notifications