Define methods that get the rate factor

Before you begin

Before you begin, you must complete Define a method to get the rate factor.

About this task

In this series of steps, you define a method that gets the rate factor. The rate factor is used to calculate rates for ratable objects such as coverables. Repeat these steps to define a method for each ratable object. This example gets the rate factor for a workers’ compensation class code.

Procedure

  1. If you must get the jurisdiction from a policy location, add a uses statement at the top of the file after the package name.

    The method that gets the jurisdiction for a particular ratable object uses methods in this class.

    uses gw.api.util.JurisdictionMappingUtil
  2. In the public method for the class, add a private variable for storing the code of the rate table. The code is passed to the getFactor method in the tableCode parameter.
    class WCRateFactorSearch {
    
       private var WC7_CLASS_CODE_TABLE = "WorkersComp_ClassCode_Rate" 

    The private variable is not strictly necessary. Instead of using this private variable, you could pass the tableCode parameter directly in the call to the getFactor method.

  3. Add a method that gets the rate factor for a particular ratable object. This method calls the getFactor method. Name the method appropriately for the type of ratable object.

    In this example, the method is getClassCodeRate. This method gets the rate for a covered employee’s class code from the rate table.

      function getClassCodeRate(covEmp : WCCoveredEmployee, ratingDate : Date) : BigDecimal {
        var jurisdiction
        JurisdictionMappingUtil.getJurisdictionMappingForPolicyLocation(covEmp.LocationWM)
        var params = {
          new RateQueryParam<String>("CLASSCODE", covEmp.ClassCode.Code)
        }
      return getFactor(jurisdiction, params, WC7_CLASS_CODE_TABLE, ratingDate)
    } 

    The input parameters to this method vary depending upon the ratable object. The input parameters to the getClassCodeRate method are:

    • covEmp – The WCCoveredEmployee object from which to get the class code.
    • ratingDate – The date for which to get the rate.

    This method returns the rate factor as a BigDecimal.