Constructors for PersonalAutoCovCostData

The standard constructor initializes the class properties by calling the superclass constructor and the private init method. The init method ensures that the fixed ID Key objects passed to the constructor have the proper type. This check avoids errors such as switching the order of the arguments.

construct(effDate : Date, expDate : Date, vehicleIDArg : Key, covIDArg : Key) {
  super(effDate, expDate)
  init(vehicleIDArg, covIDArg)
}

private function init(vehicleIDArg : Key, covIDArg : Key) {
  assertKeyType(vehicleIDArg, PersonalVehicle)
  assertKeyType(covIDArg, PersonalAutoCov)
  _vehicleID = vehicleIDArg
  _covID = covIDArg
}

The class has an alternative constructor that populates a cost data object based on an existing Cost row. The superclass constructor does most of the work. This version just needs to extract out subtype-specific properties, in this case the vehicle and coverage fixed ID Key objects.

construct(c : PersonalAutoCovCost) {
  super(c)
  _vehicleID = c.PersonalVehicle.FixedId
  _covID = c.PersonalAutoCov.FixedId 
}