Adapters must provide implementations for DataBinding interface in order to work with IBM® Business Process Manager. The marshalling of data from SDO to CCI record and from CCI record to SDO occurs through DataBinding implementation.
The following sections describe the methods that need implementation.
public void setDataObject(DataObject arg0) throws DataBindingException
public void setDataObject(DataObject arg0) throws DataBindingException {
try {
record = new EISSAStructuredRecord();
inputBG = arg0;
DEFactorySDO binding = new DEFactorySDO();
boolean isBG = WPSServiceHelper.isBusinessGraph(arg0);
DataObject dataObject = null;
if (isBG) {
dataObject = WPSServiceHelper.getRootBusinessObjectInstance(arg0);
String verb = arg0.getString(EISSAConstants.VERB);
if(verb != null){
record.setOperationName(verb);
record.setBGVerb(verb);
}
record.setIsBG(true);
} else
dataObject = arg0;
binding.setBoundObject(dataObject);
Object[] array = new Object[1];
array[0] = dataObject;
record.initializeInput(binding, array);
record.setNamespace(inputBG.getType().getURI());
record.setRecordName(inputBG.getType().getName());
} catch (Exception e) {
throw new DataBindingException("Failed to initialize cursor", e);
}
}
public DataObject getDataObject() throws DataBindingException
This method builds an instance of SDO with the data that is returned from the backend application. For example, when an adapter executes a Retrieve operation, the data returned from the backend application is held in the adapter structured record implementation. In this method the adapter reads data from the backend application and builds and SDO instance.
To perform this task the adapter should use DESPI APIs. Initialize the record with initializeOutput(), then call getNext() to build data in SDO.
This method should take care of building an instance of BG is the methods getNamespaceURI()and getBusinessObjectName() return a type BG.
For operations where getNext() should be invoked multiple times like RetrieveAll, the databinding should call getNext() multiple times add the built BusinessObject to the list of BusinessObjects within the Container BO.
public Record getRecord() throws DataBindingException
This method should return the instance of record being build in setDataObject() call or passed through setRecord() call.
public void setRecord(Record arg0) throws DataBindingException
This method should hold the instance of the record passed to this method as a record instance for the binding implementation. This record instance is used in method getDataObject().
public abstract String getNamespaceURI();
public abstract String getBusinessObjectName();
DataBinding implementation uses these two methods in getDataObject() call to determine the SDO type that the binding should instantiate.
The generated databinding classes described the section DataBinding generator provide the implementation for the abstract methods.
To enable the right business object type being made available to DataBinding implementations adapters should implement DataBindingGenerator interface.
Adapters should implement com.ibm.j2ca.extension.databinding, WBIDataBindingGenerator and implement provide a default constructor implementation.
Call the super class constructor and pass in the name of the adapter and the absolute classname of the base DataBinding implementation.
public EISSADataBindingGenerator() {
super(null, "com.ibm.j2ca.eissa.emd.runtime.EISSADataBinding");
}
EMD implementations should set the absolute name of the class for DataBindingGenerator as the generator classname in DataDescription instance. Set the DataBinding Classname to null.