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:
- The data handler creates a string to contain the data in the business
object.
- To specify the business object name, the data handler adds
BusinessObject=Name to the string.
- To specify the verb, the data handler adds
Verb=Verb to the string.
- 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.
- 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.
- 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:
- If the attribute is a cardinality 1 container, the data handler adds the
attribute name and a count of 1 to the string, and then recursively processes
the child business object to add name-value pairs for each attribute to the
string.
- If the attribute is a cardinality n container, the data handler adds the
attribute name and the number of child objects in the container to the string,
and then recursively processes each child business object, adding name-value
pairs for each attribute to the string.
- 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.
