package gw.exportimport.resolver uses gw.api.locale.DisplayKey uses gw.api.database.IQueryBeanResult uses gw.api.util.StateJurisdictionMappingUtil uses gw.exportimport.CellData uses gw.exportimport.ColumnInfo uses gw.exportimport.ImportMetaData uses java.util.Map uses gw.api.extension.ExtensionInterfaces /** * Resolves the leaf of a {@link ColumnDataResolver} path as a * {@link TaxLocation}. */ @ReadOnly class TaxLocationColumnDataResolver extends AbstractColumnDataResolver { construct(aColumnInfo : ColumnInfo) { super(aColumnInfo) } override function calculateCellValue(bean : KeyableBean, cellData : CellData, metaData : ImportMetaData, dependentData : Map) : TaxLocation { var period = (bean as EffDated).BranchUntyped as PolicyPeriod if (cellData.Data.NotBlank) { var state = dependentData["State"] as State if (state == null) { createIssue(bean, cellData, metaData, DisplayKey.get("Import.Validation.Errors.MissingDependentDataState")) } var foundTaxLocations = ExtensionInterfaces.ITaxLocationQueryBuilderFactory.newInstance() .withCode(cellData.Data) .withState(StateJurisdictionMappingUtil.getJurisdictionMappingForState(state)) .withEffectiveOnDate(period.EditEffectiveDate) .build().select() as IQueryBeanResult if (foundTaxLocations.Empty) { createIssue(bean, cellData, metaData, DisplayKey.get("Import.Validation.Errors.NoTaxLocationsFound", cellData.Data, state.DisplayName)) } return foundTaxLocations.first() } return null } }