Converting FixedWidth documents to business objects
This section provides the following information on how
the FixedWidth data handler converts FixedWidth documents to business
objects:
FixedWidth string requirements
When converting a string to an business object, the FixedWidth data
handler makes the following assumptions:
- The business object name appears as the first field in the data.
- The verb appears as the second field in the data.
- All attributes are given in the order that they appear in the
business object definition.
- The ObjectEventId attribute is present in each business object. An entry for ObjectEventId is always required for a business object, even when it has
the value CxIgnore, because the data handler uses it to distinguish between
instances of a business object at run time.
The format for a fixed-width string is as follows:
[Bus_Obj_Name<blank_space_padding_for_size>]
[Verb<blank_space_padding_for_size>]
[Attr1<blank_space_padding_for_size>]
[Attr2...<blank_space_padding_for_size>]
[Number-of-child-object_instances<blank_space_padding_for_size>]
[Child_Object_Name<blank_space_padding_for_size>]
[Child_Object_Verb<blank_space_padding_for_size>]
[Child_Object_Attr1<blank_space_padding_for_size>]
[Child_Object_Attr2...<blank_space_padding_for_size>]
<EndBO:Bus_Obj_Name>
In this format, the first two fields (Bus_Obj_Name and Verb) are padded to create fields of a length specified by the BONameSize and BOVerbSize attributes in the FixedWidth child meta-object. The subsequent
attributes are padded to create fields of a length specified in
the MaxLength property for each business object attribute.
A field used with the FixedWidth data handler must be at least
eight characters long if CxIgnore is a possible value for that attribute. If an attribute is
guaranteed not to have a CxIgnore value, MaxLength can be less than eight characters long.
When a connector reads a file in fixed-width format, the CxIgnore and CxBlank meta-object attributes must be configured to generate the
desired values. These strings affect the minimum MaxLength attributes. The minimum value for MaxLength must accommodate both.
Serialized-data processing
The FixedWidth data handler processes a FixedWidth document
into a business object as follows:
- The data handler creates a business object to contain the data.
The type of business object is either passed into the conversion
method by the connector, or the data handler extracts the name of
the business object from the first field of the string. If the type
parameter and the content in the data do not match, the data handler
generates an error.
- 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 field in the data.
- The data handler 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.
- The data handler looks for the meta-object attribute named OmitObjectEventId. If this is set to true, the data handler does not perform the processing to populate
the ObjectEventId attribute.
- To set the remaining business object attributes, the data handler
parses the data based on the MaxLength of each attribute as specified in the business object definition.
It extracts attribute values from the data and populates the values
of the simple attributes in the business object.
The data handler processes array attributes as follows:
- If the attribute is a single-cardinality attribute, the data
handler recursively parses the attribute list, sets the attribute
values, and adds the child business object to the parent business
object.
- If the attribute is a multiple cardinality array, the data handler
recursively parses the attributes in each child attribute list,
and adds the child business object to the parent business object.
