XML of inference data
The important method for exporting the inference data is the abstract method addDataForComparisonOrExport.
abstract function addDataForComparisonOrExport(contentNode : XMLNode)
The contentNode argument contains an XML node to add data to.
The method has no return value.
The implemented method must take the inference data stored in private variables and add child XML nodes to the contentNode object. The resulting node will be used to compare two forms to discover any changes that may have occurred, such as if a form uses the "reissued" policy form. Any discovered changes will be persisted to the database.
The sample Form_Example class could use the following code to generate XML data from the
_towingInfo list variable.
override function addDataForComparisonOrExport(contentNode: XMLNode) {
var node = createScheduleNode("Vehicles",
"Vehicle",
_towingInfo.map(\info -> info.Vin + " - " + info.Premium))
contentNode.Children.add(node)
}
The XML output of your inference exports to text and persists to the database with the form. This persisted version of the XML data has a special purpose. It determines whether a change to a policy triggers printing of a new form.
The XML data contains only the data that changes and is unique to this policy on the form. If the policy changes but your forms inference class generates the same XML for it, by definition the form did not change. If the XML exported is different after a policy change or if it is newly available, PolicyCenter knows that this is a new form.
In addition to the PolicyPeriod.Forms property that
contains all forms for the policy, PolicyCenter tracks new forms specially
from the complete list of forms in the PolicyPeriod.NewlyAddedForms
property. Some of these forms may be new forms and some may be forms
to reprint because of recent policy changes.
You might need one form to be duplicated for a series of items, such as separate duplicate forms for each vehicle rather than one form that lists all vehicles.
Because PolicyCenter uses the XML output to determine whether forms need to be reprinted, in general your XML contains only the critical variable data for this form. Be careful not to include extra data that might falsely tell PolicyCenter that this form must be reprinted. However, in some cases you might want to include XML data that might be useful metadata for your message to the external system but not to compare forms for changes.
You can omit certain nodes or information
in the node by adding special attributes to the XML nodes. Additionally,
the FormData data class
has methods on it you can use to conveniently add these attributes to
an existing XMLNode. If
you call the methods, they return the original node back to make it easier
to wrap or chain method calls to multiple methods or other APIs.
For example, you can store data in attributes
and use important codes or IDs for comparisons. You can, however, ignore
attributes such as class code descriptions that can change without requiring
forms to be reprinted. Use the ignoreAttributes
attribute for this feature.
Alternatively, if you package your data
as text content on a child node, set child nodes for package names to
ignoreAll so PolicyCenter
ignores them during comparison.
The following table lists the purpose,
the attribute on an XMLNode
that you can set to have this behavior, and the method name you can use
to add this attribute.
|
Attribute name and method name |
Description |
|---|---|
|
|
Indicates a node to ignore during comparison. If comparing children of two XML nodes, PolicyCenter
strips out and ignores all child nodes if its |
|
|
Indicates to ignore all attributes on a node during comparison. Set this attribute value to
|
|
|
Indicates that a node with a list of attributes to ignore during comparison. For the method version of
|
|
|
Indicates to ignore the children of a node during comparison. Set this attribute value to
|
|
|
Indicates to ignore the text of a node during comparison. Set this attribute value to
|
The most important attributes and methods
are ignoreAll and ignoreAttributes. The other methods
exist primarily for completeness.
