Effective and expiration dates
All the built-in rating engines set the effective and expiration dates explicitly. They do this in a centralized place and a consistent fashion.
When rating a slice, the built-in code sets the cost’s effective date to the start of that slice. The code then sets the expiration date to the start of the next slice it will rate.
When at later time when adjacent costs merge, the code adjusts the effective and expirations dates accordingly.
If your core rating logic is in an external
system rather than using our rating engine classes, remember to set the
effective and expiration dates on new cost data objects. Pass the effective
and expiration dates as constructor parameters to all CostData objects that you create.
The process is demonstrated in the following code taken from PASysTableRatingEngine.
private function rateVehicleCoverage_impl(cov : PersonalVehicleCov,
baseRate : BigDecimal, adjRate : BigDecimal) : PersonalVehicleCovCostData {
var start = cov.SliceDate
var end = getNextSliceDateAfter(start)
var cost = new PersonalVehicleCovCostData(start, end, cov.Currency, RateCache, cov.FixedId)
populateCostData(cost, baseRate, adjRate)
return cost
}
protected function populateCostData(cost : CostData, baseRate : BigDecimal, adjRate : BigDecimal) {
cost.NumDaysInRatedTerm = this.NumDaysInCoverageRatedTerm
cost.StandardBaseRate = baseRate
cost.StandardAdjRate = adjRate
cost.Basis = 1 // Assumes 1 vehicle year
cost.StandardTermAmount = adjRate.setScale(RoundingLevel, this.RoundingMode)
cost.copyStandardColumnsToActualColumns()
}
The NumDaysInCoverageRatedTerm
is a method that you must implement in your rating engine. It is abstract
in the superclass AbstractRatingEngine.
It returns the number of days in a standard coverage term.
