package gw.lob.cp.rating uses entity.windowed.CPBuildingCovVersionList uses gw.api.effdate.EffDatedUtil uses gw.financials.PolicyPeriodFXRateCache uses gw.pl.persistence.core.Key uses java.util.Date uses java.util.List @Export abstract class CPBuildingCovCostData extends CPCostData { private var _covID : Key private var _state : Jurisdiction as State construct(effDate : Date, expDate : Date, covID : Key, stateArg : Jurisdiction) { super(effDate, expDate) assertKeyType(covID, CPBuildingCov) init(covID, stateArg) } construct(effDate : Date, expDate : Date, c : Currency, rateCache : PolicyPeriodFXRateCache, covID : Key, stateArg : Jurisdiction) { super(effDate, expDate, c, rateCache) assertKeyType(covID, CPBuildingCov) init(covID, stateArg) } construct(cost : T) { super(cost) init(cost.CPBuildingCov.FixedId, cost.State) } construct(cost : T, rateCache : PolicyPeriodFXRateCache) { super(cost, rateCache) init(cost.CPBuildingCov.FixedId, cost.State) } private function init(covID : Key, stateArg : Jurisdiction) { _covID = covID _state = stateArg } override function setSpecificFieldsOnCost(line : CommercialPropertyLine, cost : T) { super.setSpecificFieldsOnCost(line, cost) cost.setFieldValue("CPBuildingCov", _covID) } override function getVersionedCosts(line : CommercialPropertyLine) : List { var covVL = EffDatedUtil.createVersionList( line.Branch, _covID ) as CPBuildingCovVersionList var costs = covVL.Costs.allVersions(true) // warm up the bundle and global cache return costs.Keys.where(\ VL -> costs[VL].first() typeis T) } protected override property get KeyValues() : List { return {_covID} } }