Use java object

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=sharing

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

 

 

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.

Thank you.

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

 

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

This is my script that set default value

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

 

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

https://www.youtube.com/watch?v=xJ5lVljCu3k

I hope to help you

Regards

Thank you ! that’s it !