Try OpenEdge Now
skip to main content
Application Developer's Guide
Developing Business Process Server adapters : Data mapping : Example of mapping an object dataslot
 

Example of mapping an object dataslot

Assume you have an Object dataslot called User. To initialize this dataslot, refer a class name to it. You can call it User as well. You can initialize an object dataslot when defining it in BPM Designer—enter "User" as the initial value. Now you need a Java class called User. To pass the dataslot to an adapter, you provide the set method setUser(Object o). Refer to the following sample code:
public class User{
private User myuser = null;
    public User(){
    }
    .
    .
    public void setUser(Object o){
        myuser=(User)o;
    .
    .
    }
    public void doWork{
    .
    }
}
class User has the property myuser which is of type User. The set method, setUser, sends a Java object. This is the method where the object is cast to User and then the perform by method, dowork, uses the properties and the methods of the class User.
The get method returns a Java object; however, this is not mandatory because the BP Server engine casts whatever it retrieves from the adapter to an object.
Note: BP Server automatically creates skeleton Java classes with the correct get/set methods.