Converting business objects to NameValue data

To convert a business object to a string or stream, the NameValue data handler loops through the attributes of a business object in sequential order. It generates name-value pairs recursively in the order in which attributes appear in the business object and its children. The name of the business object is passed as an argument to the conversion method.

The NameValue data handler processes business objects into NameValue data as follows:

  1. The data handler creates a string to contain the data in the business object.
  2. To specify the business object name, the data handler adds BusinessObject=Name to the string.
  3. To specify the verb, the data handler adds Verb=Verb to the string.
  4. If the meta-object attribute ValidateAttrCount is set to true, the data handler adds AttributeCount=Count to the string. This name-value pair specifies the number of the attributes in the business object data.
  5. The data handler examines the application-specific information in the business object definition to determine if there are any child meta-objects (those whose names are listed in the cw_mo_ tag of the business object application-specific information). The data handler does not include these attributes in the NameValue data. For more information about the cw_mo_ tag, see Implementing conversion from a business object.
  6. The data handler loops through the remaining business object attributes in order, adding name-value pairs for each simple attribute to the string. For container attributes, the data handler does the following:
  7. When the data handler completes the conversion, it returns the serialized data to the caller. The data handler returns the data in the form (String or InputStream) requested by the caller.

If the child meta-object attribute ValidateAttrCount is true, the data handler adds a token that contains a count of the attributes in the business object to the output data. The data handler adds carriage returns to output data; the end result looks like Figure 34 on Figure 34.

Copyright IBM Corp. 1997, 2003