Adding line-specific cost properties and methods

Each line of business defines its root cost entity type. Every root Cost entity type must implement the CostAdapter interface and delegate it to a separate class that you create. This cost adapter interface has a single method called createTransaction. This method must create a Transaction object appropriate for that Cost type. Typically, the root Cost entity for a given line, such as PACost or BOPCost, implements this interface, so you do not need to reimplement it in any subtypes.

package gw.lob.ba.financials
uses gw.api.domain.financials.CostAdapter

@Export
class BACostAdapter implements CostAdapter {
  var _owner : BACost
  construct(owner : BACost) { _owner = owner }

  override function createTransaction( branch : PolicyPeriod ) : Transaction {
    var transaction = new BATransaction( branch, branch.PeriodStart, branch.PeriodEnd )
    transaction.BACost = _owner.Unsliced
    return transaction
  }
}

Most line-specific costs (subtypes of the root cost entity) must also implement a set of methods and properties specific to the line. The line encapsulates these required methods and properties in a line-specific interface with the name of the line followed by the suffix CostMethods.

For example, personal auto cost entities must implement all the methods and properties in the interface PACostMethods. Each subtype must override (implement) these methods.

The line-specific methods typically include methods that the user interface requires to display the cost or to collate entities for display in the Quote page.

For example, for the personal auto line of business, all costs must contain Coverage and Vehicle properties, which are links to the relevant coverage and vehicle entity instances.

package gw.lob.pa.financials

/**
 * Additional methods and properties provided by the costs that supply this interface.
 */
@Export
interface PACostMethods {
  property get Coverage() : Coverage
  property get Vehicle() : PersonalVehicle
}

These line-specific properties on a cost from these adapters also appear on the corresponding cost data object.