Filtering difference items
To support filtering difference items from database-generated difference items, such as those used by the policy change job, perform the following tasks.
- In your new Gosu class LOBDiffHelper, create a method that
overrides
filterDiffItems. - In
filterDiffItems, remove all difference items you do not want to display. Depending on what you are doing, you might be able to use simple logic using blocks. - Call the filterDiffItems method from
filterDiffItemsinPolicyPeriodDiffPlugin, as shown in the bold line in the example below.// Filter diffs by LOB if this is not for integration or out of sequence jobs if ( reason != DiffReason.TC_INTEGRATION and reason != DiffReason.TC_APPLYCHANGES) { // Add diffs for PolicyPeriod attributes if (currentPeriod.Renewal == null and reason != null) { diffItems = addPolicyPeriodDiffItems(currentPeriod, currentPeriod.BasedOn, diffItems) } // Filter diffs by LOB for (line1 in currentPeriod.BasedOn.Lines){ var line2 = currentPeriod.Lines.firstWhere( \ p -> p.Subtype.Code == line1.Subtype.Code ) if (line2 != null) { diffHelper = line1.createPolicyLineDiffHelper(reason, line2) if (diffHelper != null) { diffItems = diffHelper.filterDiffItems(diffItems) } } } // Remove PolicyPeriod attribute diffs if this is a rewrite job if (currentPeriod.Rewrite != null) { diffItems.removeWhere( \ d -> d.Bean typeis PolicyPeriod ) } }
Because there are several reasons for calculating
differences, you can vary your application logic based on the difference
reason. The difference reason is a DiffReason
enumeration passed to the PolicyPeriodDiffPlugin
plugin method compareBranches.
Choices are defined in the DiffReason
typelist and include TC_INTEGRATION,
TC_MULTIVERSIONJOB, TC_PREEMPTION, TC_POLICYREVIEW, TC_COMPAREJOBS.
