This section provides the following information on how the NameValue data
handler converts strings or streams formatted in name-value pairs to a
business object:
The NameValue data handler makes the following assumptions about serialized
data:
- The business object name appears in the first name-value pair.
- The verb appears in the second name-value pair.
- The data contains a token that represents the number of instances of child
objects for each child that is contained in a business object.
- The ObjectEventId attribute is present in each business
object.
A token representing the attribute count is optional. If the child
meta-object attribute
ValidateAttrCount is true, the data handler looks for a token
that contains a count of the attributes in the business object. If the
attribute count is specified, it must accurately reflect the number of
attributes in the business object definition.
When the NameValue data handler reads a file in name-value format, it takes
the following special processing steps to assign to a business
object attribute the CxIgnore or CxBlank attribute
value:
- The data handler assigns the
CxIgnore constant (null) as the corresponding attribute
value whenever it encounters any of the following conditions in the NameValue
data:
- The value of the
CxIgnore meta-object attribute (the value configured for its Default
Value property)
- The value of an empty string (" ")
- No corresponding value in the NameValue data for the business object
attribute.
- The data handler assigns the
CxBlank constant as the attribute value only when the
CxBlank meta-object attribute is configured and it encounters this
configured value in the corresponding NameValue data.
Figure 34 shows an
example of serialized data in NameValue format.
Figure 34. Example of NameValue data
BusinessObject=Customer
Verb=Update
AttributeCount=7
CustomerID=103
CustomerName=Thai Inc.
Cust_Phone_Number=CxIgnore
ProductName=GoodProduct
Address=2
BusinessObject=Address
Verb=Update
AttributeCount=3
AddressID=105
AddressLine=CxIgnore
ObjectEventID=12345
BusinessObject=Address
Verb=Delete
AttributeCount=3
AddressID=106
AddressLine=2758 Forest Avenue
ObjectEventID=CxIgnore
Item=1
BusinessObject=Item
Verb=Update
ItemID=107
ItemName=CxIgnore
ObjectEventID=Obj_201
ObjectEventID=SampleConnector_894927711_2
In this example, entries indicate the following:
- BusinessObject is the name of the parent or child business
object being processed.
- Verb is the type of request (for example, Create or Update)
with which the parent or child business object is being sent.
- AttributeCount is the total number of attributes for the parent
or child business object at that level.
- CustomerID, CustomerName,
Cust_Phone_Number, and ProductName are the names of the
attributes for the parent business object. Values for each parent
business object attribute follow the attribute name.
- Address = 2 indicates that there are two
instances of the Address child business object.
Address is the attribute name that refers to the Address
child business object in the parent object.
- Item = 1 indicates that the Item attribute contains
a single instance of the Item business object.
- AddressID and AddressLine are the names of the
attributes for the Address child business object. Values for
each child business object attribute follow the attribute name.
- ObjectEventID=Obj_201 is the system-generated ID for the child
business object, Item.
- ObjectEventID=SampleConnector_894927711_2 is the
system-generated ID for the parent business object,
Customer.
The NameValue data handler converts strings or streams formatted in
name-value pairs to a business object as follows:
- The data handler creates a business object to contain the data in the
string or stream.
- The data handler sets the verb in the business object. The data
handler assumes that the verb for the top-level business object is in the
second name-value pair in the data. Note that child business objects
may not have verbs set.
- If the
ValidateAttrCount child meta-object attribute is set to true,
the data handler validates that the number of attributes in the file matches
the number of attributes in the business object definition.
- The data handler parses the serialized data.
- It first determines 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
perform the processing to populate these attributes of the business
object. For more information about the cw_mo_ tag, see Implementing conversion from a business object.
- It populates the values of the remaining simple attributes in the business
object. The data handler processes container attributes as
follows:
If the attribute is single cardinality, the data handler recursively parses
the attributes in the attribute list and adds the child business object
container to the parent business object.
If the attribute is multiple cardinality, the data handler recursively
parses the attributes in each child attribute list, and adds the child
business object container to the parent business object.
You can specify the attributes in the serialized data in any order for the
string-to-business object conversion because the data handler does a name and
value association.
