Defaulting component

This component applies defaulting based on configured properties and invokes a class to apply additional overrides. It can also be used to localize data in the XML.

The input to this component is an XML and the output is the same XML with the defaults applied. The properties of this component define the XML attributes to which the defaults are applied. The attributes themselves are defined through the notation used in other service components.

For example, in the createOrder() API assume the unit of measure on the <Item> element in the <OrderLine> node needs to be defaulted. The component property is defined as:

Default Value = "EACH"
Overrride = Y

If the input XML is:

      <Item ItemID="" />

A UnitOfMeasure attribute is added with a value of EACH to the Item element. The override property indicates if the attribute in the input XML needs to be overridden irrespective of the existence of the attribute.

The configuration properties for the defaulting component defined in the following table are optional.

Table 1. Defaulting component configuration properties
Property Description
General Tab
Defaulting Template Enter the path for the defaulting template. This template consists of a set of attributes and their default values. For example:

m/@UnitOfMeasure" AttributeValue="EACH" 
Override="Y" />

Note that the attribute path is an XPath variable.

Custom Class Enter the custom class that provides the defaulting attributes. This class gets the original input to the component, modified XML by the defaulting template and apply any additional overrides and return the modified output XML. This class implements the YIFXXMLAttrOverride interface. For more information about this interface, see the Javadoc.

This class can also verify the existence of order and apply or override the defaults applied previously. This class is primarily used to default based on lookup of data from the database or to reverse the defaulting, in the case of a modification.

LocaleCode Path Enter the locale code path within the input document as an XPath expression.

You can specify the Localize Attribute in the custom overrides rather than specifying a static attribute value. For example the XML file can contain the type as:

e" Type="LOCALIZE" />
Custom Overrides Tab
Element Path Specifies the path of the element for the custom overrides. This is an Xpath expression.
Attribute Specifies the name of the attribute.
Value Specifies the value of the attribute.
Adding a Custom Override
Element Path Enter the Xpath of the element for the custom overrides.
Attribute Name Enter the name of the XML attribute that you wish to override.
Localize Attribute Select this option if the attribute value is localized. The path for localization is specified in the LocaleCode.
Use Static Attribute Value Select this option if you want to use a static attribute value.

Once this option is selected you can enter the value and check the override for an existing value.

Attribute Value Enter the value for the attribute.
Always override Existing value Check this box if you want to always override the existing value with the new value entered above.