Methods and properties of the abstract rating engine class

The following tables summarize the methods in the abstract rating engine class to override or use. The rightmost column indicates whether a new rating engine typically overrides this method.

The methods in this table are methods that a new rating engine would typically override.

AbstractRatingEngine method (or property as noted)

Description

Override it?

createCostDataForCost

Given the specified Cost entity instance, creates the appropriate CostData subclass and returns it. The extractCostDatasFromExistingCosts method calls this class. The implementation of the createCostDataForCost method must prepare for any Cost subtype that the existingSliceModeCosts method could return.

Yes, for typical rating lines. If you completely override the rateOnly method or you override shouldRateThisSliceForward to return false, this method is unused.

existingSliceModeCosts

When rating only from the change date forward, this method finds any existing slice-mode costs and returns cost data objects to represent them. Typically, you would omit some costs such as taxes, which PolicyCenter treats as costs that the rating creates in window mode not on a per-slice basis. This method must return costs currently on the period that correspond to costs that are generated during the rateSlice method.

Yes, for typical rating lines. If you completely override the rateOnly method or you override shouldRateThisSliceForward to return false, this method is unused.

getStateTaxRate

Returns the tax rate for the given state. The postal code can affect local sales taxes, but the built-in logic does not use it. The default rating engine returns varying numbers based on the state, but it is only a default implementation. Override this method to encode your own rates.

Yes

NumDaysInCoverageRatedTerm property

This property get function returns the number of days that in the standard term, not minor variations of it. This number is important so that your rating calculations can use the proper value for a table lookup. Your subclass of AbstractRatingEngine must implement this method. It is abstract in the superclass.

Required

rateOnly

The core rating loop, with the following actions.

  • Rate slices. If the rating line requests rating only from the change date forward, respect that request if possible.
  • Merge cost data objects
  • Prorate cost data objects
  • Rate window costs

Only if you want to bypass the general logic of the rating engine

rateSlice

Rates a given slice of the policy for this rating line. The method has a policy line (PolicyLine) argument that already has its slice date set for this slice. The default logic calls this function once for every slice date in the policy.

Yes, for typical rating lines. If you completely override the rateOnly method, this method is unused.

rateWindow

Rates the policy in window mode. This is where you would create costs that meet either of the following conditions.

  • Depend on the sum of the previous slice costs
  • Span the entire period and you must rate them just once instead of once for each slice date

The argument is the version of the policy line that is earliest in effective time.

Yes, for typical rating lines. If you completely override the rateOnly method, this method is unused.

ShortRatePenaltyRate property

This property get function returns the rate to apply to the penalty for a short rate cancellation. Most built-in rating lines call this method. In contrast, workers’ compensation does not use this because it uses a more complicated lookup based on the associated rating context (WCRatingContext). The default rating engine always returns 10% but you can override this.

Yes

shouldRateThisSliceForward

Determines whether to rate only from the effective date of the job forward. If this returns true, the rating engine tries to rate only from the current slice forward in effective time.

Choosing to rate from the change date forward is a performance optimization compared to rating the whole policy from the period start date. Even if you choose to use this optimization, PolicyCenter in some cases still rates the whole policy from the period start date, for example for a cancellation. Design your code to ensure that if PolicyCenter rates the entire period or from the change date, the rating engine always returns the same consistent cost values.

Only if you want to change the default logic. See the topics mentioned earlier in this table row.

The methods in the following table are utility methods, helper methods for the default rating engine, or internal methods that you override only if you significantly change the logic.

Utility methods perform the following types of functions.

  • Merge and prorate CostData objects
  • Calculate the number of days in the rated term based on the default policy term for the product
  • Calculate a demo tax rate
  • Calculate a short rate penalty rate

AbstractRatingEngine method

Description

Override it?

addCost

Adds a cost data object to the internal list of cost data objects for this rating line. You probably do not need to use this API unless you greatly change the logic of the class.

No

assertSliceMode

Asserts that the specified revisioned entity instance is in slice mode. This is a general utility function you can use.

No. It is a general utility function you can use.

assertWindowMode

Asserts that the specified revisioned entity instance is in window mode.

No. It is a general utility function you can use.

attachCostEntities

Performs the following operations.

  • Converts the cost data objects to actual Cost entities
  • Removes any old Cost entities for this policy line that were untouched by the rateOnly method.

No

attemptToMerge

If possible, merges two costs. It returns true if the merge succeeded, otherwise returns false. This method merges the costs either as basis scalable or not, as the costs specify in the cost.MergeAsBasisScalable property.

No

extractCostDatasFromExistingCosts

This method take a list of costs and a cut-off date and performs the following actions.

  • Extracts cost data objects from any existing slice-mode costs on the line.
  • Adds cost data objects to the internal list for any cost that is effective prior to the given cut-off date.
  • Prorates any costs that fall across the cut-off date boundary. In the case of normal non-basis-scalable costs, the method prorates by removing the actual amount (the ActualAmount property) so that the cost potentially can merge with another slice. After merging, the code re-prorates the cost after slice rating is complete.

The built-in rating engine only calls this if the method shouldRateThisSliceForward returns true.

You probably do not need to use this API unless you greatly change the logic of the class.

No

getNextSliceDateAfter

Given a particular date, finds the next effective date following this date. The built-in rating logic uses this method when rating in slice mode to determine the next change date. This allows the rating logic to determine how many days long the current slice is.

Use this method to set the effective and expiration dates of the cost.

No

mergeCosts

Merge any equal costs that are attributed to the same elements (they have matching cost keys) and adjacent in effective time. This method returns a new list of costs rather than modifying the existing list of costs in place.

No

prorateToCutOffDate

Takes a cost, a cut-off date, an amount, and a rounding level. This method prorates the specified amount from the effective date of the cost to the given cut-off date. If the amount is null, this method returns null. You probably do not need to use this API unless you greatly change the logic of the class.

No

rate

This is the entry point for the rating request. The rating plugin calls this method for each rating line. It performs the following operations.

  • Calls the rateOnly method on this object, which generates cost data objects.
  • Calls the attachCostEntities method to convert the cost data objects to actual Cost entities.
  • As part if the attachCostEntities method, removes any old Cost entities for this policy line that were untouched by the rateOnly method.

No. Typically do not override this. For typical rating lines, just override rateSlice and rateWindow. If you must bypass or rewrite the built-in rating control structure, generally speaking, override the rateOnly method, not the rate method.

updateAmount

Prorates any costs that do not yet have an ActualAmount property set. To do the main task of this method, this method calls each cost’s updateAmountFields method.

No

validate

Ensures that for any given period of time, there is only one Cost entity instance with a given cost key (CostKey). If this method fails, it indicates that the rating logic failed. The rating logic, either produced duplicate costs or incorrectly defined the cost data model such that expected operations could produce duplicate costs.

No