Guidelines for modularizing line-of-business code

Guidewire recommends that you define line-of-business code in the policy-line-methods classes. Avoid putting line-of-business code in generic locations such as the rule sets, plugins, and non-line-of-business PCF files and Gosu classes. This recommendation is intended to make upgrade easier by grouping line-of-business changes in the gw.lob package.

Example

The policy period plugin implementation (gw.plugin.policyperiod.impl.PolicyPeriodPlugin) implements the postApplyChangesFromBranch method. Rather than putting code for each line of business directly in the plugin implementation, this method calls postApplyChangesFromBranch for each line in the policy period:

override function postApplyChangesFromBranch(policyPeriod : PolicyPeriod, sourcePeriod : PolicyPeriod)
{
  for (line in policyPeriod.Lines) {
    line.postApplyChangesFromBranch(sourcePeriod)
  }
...
}

To implement functionality for the workers’ compensation line of business, the gw.lob.wc.WCPolicyLineMethods class implements the postApplyChangesFromBranch method:

override function postApplyChangesFromBranch(sourcePeriod : PolicyPeriod) {
     ...
}