@Test public void testHKIModel() throws Exception { PxwebIndicatorsParser parser = getParser("config2folderstruct_hki.json"); String json = ResourceHelper.readStringResource("px-table-hki.json", PxwebIndicatorsParserTest.class); PxTableItem table = new ObjectMapper().readValue(json, PxTableItem.class); StatisticalIndicatorDataModel model = parser.getModel(table); assertEquals("Should have 6 params", 6, model.getDimensions().size()); }
protected StatisticalIndicatorDataModel getModel(PxTableItem table) { final StatisticalIndicatorDataModel selectors = new StatisticalIndicatorDataModel(); selectors.setTimeVariable(config.getTimeVariableId()); for (VariablesItem item: table.getSelectors()) { if(item.getCode().equals(config.getRegionKey())) { selectors.setHasRegionInfo(true); } if(config.getIgnoredVariables().contains(item.getCode())) { continue; } StatisticalIndicatorDataDimension selector = new StatisticalIndicatorDataDimension(item.getCode()); selector.setName(item.getLabel()); selector.setAllowedValues(item.getLabels()); selectors.addDimension(selector); if (item.isTimeVariable()) { selectors.setTimeVariable(selector.getId()); } } return selectors; }
PxwebIndicatorsParser { protected StatisticalIndicatorDataModel getModel(PxTableItem table) { final StatisticalIndicatorDataModel selectors = new StatisticalIndicatorDataModel(); selectors.setTimeVariable(config.getTimeVariableId()); for (VariablesItem item: table.getSelectors()) { if(item.getCode().equals(config.getRegionKey())) { selectors.setHasRegionInfo(true); } if(config.getIgnoredVariables().contains(item.getCode())) { continue; } StatisticalIndicatorDataDimension selector = new StatisticalIndicatorDataDimension(item.getCode()); selector.setName(item.getLabel()); selector.setAllowedValues(item.getLabels()); selectors.addDimension(selector); if (item.isTimeVariable()) { selectors.setTimeVariable(selector.getId()); } } return selectors; } }
PxwebIndicatorsParser { protected StatisticalIndicatorDataModel getModel(PxTableItem table) { final StatisticalIndicatorDataModel selectors = new StatisticalIndicatorDataModel(); selectors.setTimeVariable(config.getTimeVariableId()); for (VariablesItem item: table.getSelectors()) { if(item.getCode().equals(config.getRegionKey())) { selectors.setHasRegionInfo(true); } if(config.getIgnoredVariables().contains(item.getCode())) { continue; } StatisticalIndicatorDataDimension selector = new StatisticalIndicatorDataDimension(item.getCode()); selector.setName(item.getLabel()); selector.setAllowedValues(item.getLabels()); selectors.addDimension(selector); if (item.isTimeVariable()) { selectors.setTimeVariable(selector.getId()); } } return selectors; } PxwebIndicatorsParser(PxwebConfig config); }
PxwebIndicatorsParser { protected StatisticalIndicatorDataModel getModel(PxTableItem table) { final StatisticalIndicatorDataModel selectors = new StatisticalIndicatorDataModel(); selectors.setTimeVariable(config.getTimeVariableId()); for (VariablesItem item: table.getSelectors()) { if(item.getCode().equals(config.getRegionKey())) { selectors.setHasRegionInfo(true); } if(config.getIgnoredVariables().contains(item.getCode())) { continue; } StatisticalIndicatorDataDimension selector = new StatisticalIndicatorDataDimension(item.getCode()); selector.setName(item.getLabel()); selector.setAllowedValues(item.getLabels()); selectors.addDimension(selector); if (item.isTimeVariable()) { selectors.setTimeVariable(selector.getId()); } } return selectors; } PxwebIndicatorsParser(PxwebConfig config); List<StatisticalIndicator> parse(List<DatasourceLayer> layers); }
PxwebIndicatorsParser { protected StatisticalIndicatorDataModel getModel(PxTableItem table) { final StatisticalIndicatorDataModel selectors = new StatisticalIndicatorDataModel(); selectors.setTimeVariable(config.getTimeVariableId()); for (VariablesItem item: table.getSelectors()) { if(item.getCode().equals(config.getRegionKey())) { selectors.setHasRegionInfo(true); } if(config.getIgnoredVariables().contains(item.getCode())) { continue; } StatisticalIndicatorDataDimension selector = new StatisticalIndicatorDataDimension(item.getCode()); selector.setName(item.getLabel()); selector.setAllowedValues(item.getLabels()); selectors.addDimension(selector); if (item.isTimeVariable()) { selectors.setTimeVariable(selector.getId()); } } return selectors; } PxwebIndicatorsParser(PxwebConfig config); List<StatisticalIndicator> parse(List<DatasourceLayer> layers);  }