Location plugin
You can customize how PolicyCenter treats account
locations and policy locations using the AccountLocationPlugin location
plugin. The base configuration of the plugin is implemented in the Gosu
AccountLocationPluginImpl
class.
The basic tasks you can customize are described below.
- Customize how two location records are compared to see if they represent the same location or two different locations.
- Customize how to copy your data model extension properties during cloning of a location entity.
If you want to add custom code after creating a primary
location or before deleting a location, modify each policy line’s methods
called onPrimaryLocationCreation
and preLocationDelete.
Similarly, to define whether a location is safe to delete, modify each
policy line’s canSafelyDeleteLocation
method.
Compare locations
Your areAccountLocationsEquivalent method must return
true if two AccountLocation entities passed as
parameters are effectively equal.
The behavior in the built-in implementation returns true if and only
if the following properties match: AddressLine1,
AddressLine2, AddressLine3,
City, State, and
PostalCode.
If you have data model extension properties on your locations that are important in the comparison, customize this logic as needed.
Location cloning
If you have data model extension properties or arrays on an
AccountLocation or one of its subtypes, copy them if an account
location entity clones to another account location. Implement this plugin’s
cloneExtensions method to copy these properties, including
any foreign keys or array information. The built-in implementation does nothing.
override function cloneExtensions(oldLocation: AccountLocation, newLocation: AccountLocation){
}
It is critical that you not make any changes to the related
PolicyPeriod entities, Account entities, or
any other entity within this method. PolicyCenter calls this method while binding a
PolicyPeriod entity. If you modify any entity other than the
new location contact, the policy could become out of sync and create serious
problems later on.
Only copy your data model extensions from the old account contact to the new one and
do nothing else in this method. In particular, this method must not make changes to
a related PolicyPeriod, Account, or other entity
or else serious problems can occur.
