Try OpenEdge Now
skip to main content
Application Developer's Guide
Using custom dataslots : Defining custom dataslots with complex objects : Defining custom dataslots : Initializing custom dataslots
 
Initializing custom dataslots
For most cases involving custom dataslots, the default DsPrototypeFactory is sufficient to initialize dataslots. In cases where an object requires a complex initialization which cannot be performed by ordinary set methods, you must provide a custom factory to create and initialize the dataslot. We have provided the DsPrototypeFactory class as the default factory class for all custom dataslots so that users are not required to write a factory class for every custom dataslot. The factory can only create one object at a time. Define an input for every property of the customized object to be created.
The following sample code provides an implementation of the MyTableFactory Adapter that can be used to initialize the MyTable custom dataslot.
Note: The MyTableFactory class (a subclass of GenericAction) includes the attributes Query and borderThickness, and the commit() method for initializing the MyTable custom dataslot. Any number of attributes can be defined as long as the commit() method is modified to include the code to initialize them.
import com.savvion.BPM Workflow.beans.*;
public class MyTableFactory
    extends GenericAction
{    public static String QUERY = "Query";
    public static String BORDERTHICKNESS = "borderThickness";
    public MyTableFactory()
    {
    }
    
    public int commit()
    {
        String query = getPropString(QUERY);
        String borderThickness = getPropString(BORDERTHICKNESS);
        MyTable dbtable = new MyTable();
        dbtable.setQuery(query);
        dbtable.setBorderThickness(borderThickness);
        
        setPropBSObject("MyTable",dbtable);
        
        return 1;
    }
}