beautypg.com

IBM WebSphere Adapters User Manual

Page 162

background image

FunctionDescription[] funcArray =

new FunctionDescription[functionDescriptions.size()];

functionDescriptions.toArray(funcArray);
super.setFunctionDescriptions(funcArray);

}

WBIOutboundServiceDescriptionImpl samples:

WBIOutboundServiceDescriptionImpl

represents the object that populates function

descriptions for outbound service descriptions.

Implement the method shown in the section below.

setFunctionDescriptions

The setFunctionDescriptions() method populates the function descriptions based
on objects and properties selected in MetadataSelection.

public void setFunctionDescriptions(MetadataSelection selection)

throws MetadataException {

WBIMetadataDiscoveryImpl.getLogUtils().traceMethodEntrance

(CLASSNAME,SETFUNCTIONDESCRIPTIONS);

ArrayList functionDescriptions = new ArrayList();
MetadataImportConfiguration[] supportedObjects = selection.getSelection();
PropertyGroup selectionProperties =

((WBIMetadataSelectionImpl) selection).getAppliedSelectionProperties();

WBIMultiValuedPropertyImpl operationProperty =

(WBIMultiValuedPropertyImpl) selectionProperties.getProperty("Operations");

String[] supportedOperations = operationProperty.getValuesAsStrings();
traceFiner("supportedOperations=" + supportedOperations);
String location = TwineBallConfigurationProperties.getLocation(selectionProperties);

for (int i = 0; i < supportedObjects.length; i++) {

WBIMetadataImportConfigurationImpl importConfiguration =

(WBIMetadataImportConfigurationImpl) supportedObjects[i];

WBIOutboundFunctionDescriptionImpl outboundFunctionDescription;
WBIInteractionSpec interactionSpec;
TwineBallMetadataObject metadataObj = (TwineBallMetadataObject)

importConfiguration.getMetadataObject();

traceFiner("Object name is " + metadataObj.getBOName());
for (int j = 0; j < supportedOperations.length; j++) {

String operation = (String) supportedOperations[j];
traceFiner("generating function for the " + operation

+ " operation on " + metadataObj.getBOName());

outboundFunctionDescription = new WBIOutboundFunctionDescriptionImpl();
outboundFunctionDescription.setName(operation.toLowerCase()

+ metadataObj.getDisplayName());

TwineBallDataDescription dataDescription = new TwineBallDataDescription();
dataDescription.setMetadataObject(metadataObj);
dataDescription.setName(getNameSpace(), metadataObj.getDisplayName());
dataDescription.populateSchemaDefinitions();
dataDescription.setRelativePath(location);
outboundFunctionDescription.setInputDataDescription(dataDescription);
dataDescription.setName(getNameSpace() +

"/" + metadataObj.getBOName().toLowerCase() +

"bg", metadataObj.getBOName() + "BG");

traceFiner("type of input object" +

dataDescription.getName().getNamespaceURI() +

"\\" + dataDescription.getName().getLocalPart());
if (operation != WBIInteractionSpec.RETRIEVE_ALL_OP)

outboundFunctionDescription.setOutputDataDescription(dataDescription);

else {

dataDescription = new TwineBallDataDescription();
dataDescription.setName(getNameSpace(),

metadataObj.getDisplayName() + "Container");

156

WebSphere Adapters: WebSphere Adapter Toolkit User Guide