262 WebSphere Business Integration Adapters
16.3 Performing the verb operation
Most verb operations involve obtaining information from the request business
object. This section provides information about the steps that our doVerbFor()
method takes to process the request business object for each active verb.
16.3.1 Accessing the business object
As part of the Java connector, the doVerbFor() method receives the request
business object as an instance of the CWConnectorBusObj class. To begin verb
processing, the doVerbFor() method needs information from the business object
definition. The CWConnectorBusObj class provides access to the business
object, its business object definition, and attributes. Therefore, a Java
doVerbFor() method does not need to instantiate a separate object for the
business object definition. It can obtain information about the business object
definition directly from the CWConnectorBusObj object passed into doVerbFor().
A business object handler typically uses the business object definition to get
information about its attributes or to get the application-specific information from
the business object definition, attribute, or verb.
Note: For metadata-driven verb processing, the application-specific
information for the verb contains metadata, which provides processing
instructions for the request business object when that particular verb is active.
The getVerbAppText() method is provided by the CWConnectorBusObj class
to obtain application-specific information for the verb of a business object.
Tip: The verb application-specific information can contain the name of the
method to call to process the request business object for that particular verb.
In this case, the doVerbFor() method does not need to branch off the value of
the active verb because the processing information resides in the
application-specific information.
Important: These steps assume that your connector is designed to be
metadata-driven. That is, they describe how to extract application-specific
information from the business object definition and attributes to obtain the
location within the application associated with each attribute. If your connector
is not metadata-driven, you do not need to perform any steps that extract
application-specific information.
Chapter 16. Implementing a business object handler 263
Extracting business object application-specific information
Business objects for metadata-driven connectors are usually designed to have
application-specific information about the application structure. For such
connectors, the first step in a typical verb operation is to retrieve the
application-specific information from the business object definition associated
with the request business object. The Java connector library provides the
following methods to retrieve application-specific information from the business
object definition:
The getAppText() method, with no arguments, returns the
application-specific information as a Java string. It can also retrieve the value
of a specified name-value pair within the business object level
application-specific information.
The getBusObjASIHashtable() method returns the application-specific
information as a Java hash table of name-value pairs.
Accessing the attributes
The connector can use attribute methods in the CWConnectorBusObj class to
obtain information about an attribute, such as its cardinality or maximum length.
Methods that access attribute properties provide the ability to access an attribute
in the following ways:
Attribute name
You can identify the attribute by its Name property to obtain its attribute
object.
Integer index
To obtain the attribute index (its ordinal position), you can:
Obtain a count of all attributes in the business object definition with
getAttrCount() and loop through them one at a time, passing each index
value to one of its attribute-access methods
Obtain the index for a particular attribute by specifying its name to
getAttrIndex().
Note: Both the getAttrCount() and getAttrIndex() methods are defined
in the CWConnectorBusObj class.

Get WebSphere Business Integration Adapters: An Adapter Development and WebSphere Business Integration Solution now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.