Converting NameValue data to business objects

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:

NameValue string requirements

The NameValue data handler makes the following assumptions about serialized data:

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:

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:

Serialized-data processing

The NameValue data handler converts strings or streams formatted in name-value pairs to a business object as follows:

  1. The data handler creates a business object to contain the data in the string or stream.
  2. 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.
  3. 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.
  4. The data handler parses the serialized data.

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.

Copyright IBM Corp. 2003