Inference data
The important method for creating inference data is the abstract method populateInferenceData. It is
called by the forms inference engine to populate this instance with the appropriate data from the policy graph.
The method is called immediately after the instance of the FormData is created.
abstract function populateInferenceData(context : FormInferenceContext, availableStates : Set<Jurisdiction>)
The context argument contains information, such as the PolicyPeriod, the set of forms in the group, and the differences between periods.
The availableStates argument contains all the states in which the form was found to be available. Any state-specific form that replaces the national version is not included in the set.
The recommended approach to implement the method is to generate and then store inference data in a private variable
so it can be read by other methods in your class. The Form_Example class shown below assumes a
built-in personal auto form that can create towing labor coverage data like that referenced in the sample
populateInferenceData method.
@Export
class Form_Example extends FormData {
var _towingInfo : List<towingInfoSet>
override function populateInferenceData(context : FormInferenceContext, availableStates : Set<Jurisdiction>) {
var towingInfoSet = mapVehicles(context, \v -> v.PATowingLaborCovExists, \v -> createTowingInfo(v))
_towingInfo = towingInfoSet.toList().sortBy(\info -> info.Vin)
}
}
In the example, mapVehicles uses a mapVehicles method implemented in
PAFormData. It uses the helper method mapArrayToSet. The result of
mapVehicles is a Map object mapping vehicles to towing information data
created by another helper method. Finally, the result is converted to a java.util.List object and
sorted by the vehicle identification number. This result must be stored in a private variable defined in your
FormData subclass. Note that the final result is a List and not an XMLNode or
XML-formatted text.
The subclassed FormData class must also implement the abstract getter method
InferredByCurrentData. The method indicates whether the form is part of the policy.
abstract property get InferredByCurrentData() : boolean
The method returns true if the form is part of the policy. Even if the method returns
true, however, does not guarantee that the form will be added to the policy. The final
determination depends on the processing type specified in the FormPattern and whether the data on
the form matches the data on any previous version of the form.
The following code continues implementing the sample Form_Example class. The implemented
InferredByCurrentData method references the class's _towingInfo list
initialized in the sample populateInferenceData. The method returns true if
the list contains any data.
override property get InferredByCurrentData() : boolean {
return !_towingInfo.Empty
}
