Quote clone plugin

The Quote Clone plugin provide methods for you to define and customize how PolicyCenter creates and processes cloned quotes. The plugin also provides a method for adding criteria to the query that selects cloned quotes for purging.

In the base configuration, the DefaultPolicyPeriodQuoteClonePlugin Gosu class is an example implementation of the PolicyPeriodQuoteClonePlugin plugin interface.

If the plugin is enabled, PolicyCenter calls the following methods in the order listed whenever it creates a policy period that can be cloned:

Method

See...

shouldCloneQuote

Determining whether to clone a quote

cleanupAfterCloningPolicyPeriod

Cleaning up after cloning policy period

processClonedPolicyPeriod

Processing the cloned policy period

The plugin has one method for modifying Purge Quote Clones batch processing:

Method

See...

addToPurgeClonedPeriodsQuery

Adding to the Purge Quote Clones query

Determining whether to clone a quote

PolicyCenter calls the shouldCloneQuote Boolean method after a policy period has finished quoting in a policy transaction.

In the shouldCloneQuote method, include code that returns true to flag the policy period for cloning. For example, the following implementation flags all submissions for cloning:

override function shouldCloneQuote (period: PolicyPeriod): boolean {
  return period.Job.Subtype == TC_SUBMISSION
}

When this method returns true, PolicyCenter creates a cloned policy period and sets its TemporaryClone property to TC_UNPROCESSED.

Cleaning up after cloning policy period

After creating the cloned policy period, PolicyCenter calls the cleanupAfterCloningPolicyPeriod method.

Important: If this method is not properly implemented for your data model, loss of data or functionality may occur.

The intent of this method is to fix up any problems caused by cloning. For example, the clone and the originating policy period may have foreign keys pointing to the same object. If PolicyCenter attempts to delete the originating policy period, PolicyCenter generates an error when it encounters the common object because the cloned policy period still points to it. To avoid this, you can do a deep copy of the common object and point the foreign key on the cloned policy period to the copy of the common object. If the common object has other relationships, you must duplicate those relationships in copy of the common object and the clone. For example, if the common object has a foreign key pointing back to the originating policy period, you must duplicate that relationship.

In the base configuration, if you have enabled and implemented a multicurrency system, this problem occurs with PolicyFXRate objects. After cloning, the original policy period’s PolicyFXRate objects are also linked to from the clone. In the example plugin implementation, the cleanupAfterCloningPolicyPeriod method provides code that fixes the links to the PolicyFXRate object. The method does a deep copy of the FXRate and links the cloned policy period to the PolicyFXRate copy.

Processing the cloned policy period

After cleaning up the cloned policy period, PolicyCenter calls the processClonedPolicyPeriod method. In this method, add code that processes the cloned policy period. Alternately, you can leave the processClonedPolicyPeriod method empty and create your own integration or plugin that processes the data and extracts it to an external BI system.

In either case, after processing, mark the cloned policy period as purgeable by setting the TemporaryCloneStatus property to Purgeable:

clonedPeriod.updateTemporaryCloneStatus(PolicyPeriodCloneStatus.TC_PURGEABLE)

Adding to the Purge Quote Clones query

Purge Quote Clones batch processing calls this method.

In the addToPurgeClonedPeriodsQuery method, you can add criteria to the query that Purge Quote Clones batch processing uses to select cloned quotes for purging. For example, you can specify that purgeable policy periods must be at least 2 hours old.

After returning from this method, the process uses the query to create the list of items to be purged.