Support form multiplicity
You use a subtype of FormAssociation and an inference class that extends AbstractMultipleCopiesForm to provide form multiplicity on a policy.
Procedure
-
In the data model, create a subtype of FormAssociation.
For a personal auto form associated with single personal vehicle, create a new subtype of FormAssociation called PAVehicleFormAssociation.
-
On that entity, add property with a foreign key link to the desired type, such as
a personal vehicle.
Suppose the property is called
Vehicle. -
In your inference class, extend the AbstractMultipleCopiesForm
class instead of the extending the FormData class. This class uses Gosu generics features
to abstract this class for your linked-to type.
Use the following syntax to define the inference class.
class MyPAVehicleForm extends AbstractMultipleCopiesForm<PersonalVehicle> -
To support form multiplicity, add the getEntities method to
your inference class. This method must return a list containing one or more entities of your desired type. If
there is more than one entity returned, PolicyCenter knows that there are multiple instances of the form, each
linked to one of the items in this list.
getEntities returns a list of all personal vehicles on the policy.Do not implement the populateInferenceData method. That method is used only if you do not use form multiplicity.
-
Add to your inference class the FormAssociationPropertyName
method, which returns the name of the property in your
FormAssociationsubtype, as aString.Pass theStringvalue"Vehicle"because the property name isVehicle. -
In your inference class XML generation method
addDataForComparisonOrExport, export the data for only one entity in your generated list
of entities. Your code refers to the current entity by using the private variable called
_entity, which is set up by theAbstractMultipleCopiesForm.The_entityvariable contains onePersonalVehiclefrom the list returned in your getEntities method. Your addDataForComparisonOrExport would add child XML nodes for that vehicle only. -
In your inference class, create the createFormAssociation method to instantiate one
version of your form association subtype.
This method can use simple code, such as the following example.
override protected function createFormAssociation( form : Form) : FormAssociation { return new PAVehicleFormAssociation(form.Branch) }
What to do next
Form.FormAssociations to get form associations that
link to the associated entity. 