Form data helper functions

The FormData class that you extend your class from includes some helper methods for common tasks.

Method

Description

createScheduleNode

Creates a parent XML node and a list of child nodes. You specify a container name, a child element name, and a list of children elements. Specify the list of children elements as an iterable collection of String values for the text value for each child node.

createTextNode

Creates an XML node with the specified name and text content.

mapArrayToSet

Given an array, a filter (a Gosu block) and a mapping operation (a Gosu block), this method produces a set as the output. The set contains the result of the mapping applied to every element in the array for which filter returns true. If that filter argument is null instead of a block, PolicyCenter processes all elements. If you pass an array workers’ compensation exposures, you can use this method to produce a set of states that have exposure for a given class code. To do this, use the filter argument to accept only exposures with the given class code and write a mapping block to extract the state from the exposure.

Additionally, several useful generic inference classes are defined in the package gw.forms.generic that might help in your form design. The following table lists helper classes in this package.

Class

Description

AbstractMultipleCopiesForm

Abstract class that you can subclass to easily deal with forms with multiple instances of the same form attached to the policy. This class assumes that the forms have a one-to-one relationship with some entity on the policy. The class also assumes there is a corresponding FormAssociation entity subtype that tracks which form points to which entity.

AbstractSimpleAvailabilityForm

Base class for any form that does not need any data to be gathered and packaged, but needs a simple availability script. Subclassing classes must implement the isAvailable method to indicate whether or not to add the form.

GenericAlwaysAddedForm

Base class for any form to always add to a policy whenever the form is available. Using this class with no further subclassing directly leads to a form with no data populated. However, you can extend this class and override the addDataForComparisonOrExport method to output your data.

GenericRemovalAndReplacementEndorsementForm

Base class for removal and replacement endorsement form. It checks if any forms were completely invalidated or replaced and that also set this form as their removal endorsement form number. If such a form is found, PolicyCenter creates a form that contains a parent RemovedForms node with a child RemovedForm node for each form completely invalidated. Underneath that node are nodes for Description, EndorsementNumber, and FormNumber nodes that describe the removed form. This class creates a comparable structure for forms replaced by a new copy of the same form.

GenericRemovalEndorsementForm

Base class for a generic removal endorsement form. It checks if any forms were completely invalidated and that also set this form as their removal endorsement form number. If such a form is found, it creates a form that contains a parent RemovedForms node with a child RemovedForm node for each form that became completely invalidated. Underneath each of those nodes are Description, EndorsementNumber, and FormNumber nodes with the actual data about the form that became invalidated.

The usage of the term “generic” in the package and class naming of the preceding classes means the classes include common functionality that you can subclass as desired. They do not necessarily use Gosu generics features. However, the AbstractMultipleCopiesForm class does use Gosu generics.