diff --git a/health-services/resource-generator/src/main/java/org/egov/processor/service/ExcelParser.java b/health-services/resource-generator/src/main/java/org/egov/processor/service/ExcelParser.java index 6f2326d628..899aced37f 100644 --- a/health-services/resource-generator/src/main/java/org/egov/processor/service/ExcelParser.java +++ b/health-services/resource-generator/src/main/java/org/egov/processor/service/ExcelParser.java @@ -203,7 +203,9 @@ private void processSheets(PlanConfigurationRequest request, String fileStoreId, Map attributeNameVsDataTypeMap = prepareAttributeVsIndexMap(request, fileStoreId, campaign, request.getPlanConfiguration(), mdmsData); + //TODO: remove boundaryCodeList not required List boundaryCodeList = getBoundaryCodeList(request, campaign); + //TODO: rename mappedValues, see whether to pass it as a func param in processRowsForCensusRecords Map mappedValues = request.getPlanConfiguration().getResourceMapping().stream() .filter(f -> f.getFilestoreId().equals(fileStoreId)) .collect(Collectors.toMap( @@ -214,6 +216,7 @@ private void processSheets(PlanConfigurationRequest request, String fileStoreId, )); excelWorkbook.forEach(excelWorkbookSheet -> { if (isSheetAllowedToProcess(request, excelWorkbookSheet.getSheetName(), localeResponse)) { + //TODO: arrange if conditions chronologically accordingly to workflow if (request.getPlanConfiguration().getStatus().equals(config.getPlanConfigTriggerPlanEstimatesStatus())) { enrichmentUtil.enrichsheetWithApprovedCensusRecords(excelWorkbookSheet, request, fileStoreId, mappedValues); processRows(request, excelWorkbookSheet, dataFormatter, fileStoreId, @@ -254,6 +257,7 @@ private void processRows(PlanConfigurationRequest planConfigurationRequest, Shee private void processRowsForCensusRecords(PlanConfigurationRequest planConfigurationRequest, Sheet sheet, String fileStoreId, Map attributeNameVsDataTypeMap, List boundaryCodeList, String hierarchyType) { PlanConfiguration planConfig = planConfigurationRequest.getPlanConfiguration(); + //TODO pass mappedValues in func param Map mappedValues = planConfig.getResourceMapping().stream() .filter(f -> f.getFilestoreId().equals(fileStoreId)) .collect(Collectors.toMap( @@ -277,6 +281,7 @@ private void processRowsForCensusRecords(PlanConfigurationRequest planConfigurat continue; } + //TODO: no need to pass firstrow validateRows(indexOfBoundaryCode, row, firstRow, attributeNameVsDataTypeMap, mappedValues, mapOfColumnNameAndIndex, planConfigurationRequest, boundaryCodeList, sheet); JsonNode currentRow = createFeatureNodeFromRow(row, mapOfColumnNameAndIndex); @@ -311,8 +316,6 @@ private List getBoundaryCodeList(PlanConfigurationRequest planConfigurat * @param planConfig The configuration details specific to the plan. * @return A map of attribute names to their corresponding indices or data types. */ - - //TODO: fetch from adminSchema master private Map prepareAttributeVsIndexMap(PlanConfigurationRequest planConfigurationRequest, String fileStoreId, CampaignResponse campaign, PlanConfiguration planConfig, Object mdmsData) { @@ -668,6 +671,8 @@ private void validateAttributes(Map attributeNameVsDataTypeMap, * @param row The row containing the data to be validated. * @param columnHeaderRow The row containing the column headers. */ + + private void validateTillBoundaryCode(Integer indexOfBoundaryCode, Row row, Row columnHeaderRow) { for (int j = 0; j <= indexOfBoundaryCode - 1; j++) { Cell cell = row.getCell(j); diff --git a/health-services/resource-generator/src/main/java/org/egov/processor/util/EnrichmentUtil.java b/health-services/resource-generator/src/main/java/org/egov/processor/util/EnrichmentUtil.java index 89f0a89511..2b83f21033 100644 --- a/health-services/resource-generator/src/main/java/org/egov/processor/util/EnrichmentUtil.java +++ b/health-services/resource-generator/src/main/java/org/egov/processor/util/EnrichmentUtil.java @@ -92,6 +92,7 @@ public void enrichResourceMapping(PlanConfigurationRequest request, LocaleRespon public void enrichsheetWithApprovedCensusRecords(Sheet sheet, PlanConfigurationRequest planConfigurationRequest, String fileStoreId, Map mappedValues) { List boundaryCodes = getBoundaryCodesFromTheSheet(sheet, planConfigurationRequest, fileStoreId); + //TODO: pass mapOfColumnNameAndIndex, indexOfBoundaryCode as func param in getBoundaryCodesFromTheSheet Map mapOfColumnNameAndIndex = parsingUtil.getAttributeNameIndexFromExcel(sheet); Integer indexOfBoundaryCode = parsingUtil.getIndexOfBoundaryCode(0, parsingUtil.sortColumnByIndex(mapOfColumnNameAndIndex), mappedValues); @@ -105,6 +106,7 @@ public void enrichsheetWithApprovedCensusRecords(Sheet sheet, PlanConfigurationR for(Row row: sheet) { + //TODO: remove from here parsingUtil.printRow(sheet, row); // Skip the header row and empty rows if (row.getRowNum() == 0 || parsingUtil.isRowEmpty(row)) { @@ -112,6 +114,7 @@ public void enrichsheetWithApprovedCensusRecords(Sheet sheet, PlanConfigurationR } // Get the boundaryCode in the current row + //TODO: make it inline row.getCell(indexOfBoundaryCode).getStringCellValue(); Cell boundaryCodeCell = row.getCell(indexOfBoundaryCode); String boundaryCode = boundaryCodeCell.getStringCellValue(); @@ -121,6 +124,7 @@ public void enrichsheetWithApprovedCensusRecords(Sheet sheet, PlanConfigurationR // For each field in the sheetToCensusMap, update the cell if the field is editable for (Map.Entry entry : mappedValues.entrySet()) { String censusKey = entry.getKey(); + //TODO: rename to localizedSheetColumn String sheetColumn = entry.getValue(); if(config.getCensusAdditionalFieldOverrideKeys().contains(censusKey)) diff --git a/health-services/resource-generator/src/main/java/org/egov/processor/util/ParsingUtil.java b/health-services/resource-generator/src/main/java/org/egov/processor/util/ParsingUtil.java index ba10327e4c..1fc45c52b9 100644 --- a/health-services/resource-generator/src/main/java/org/egov/processor/util/ParsingUtil.java +++ b/health-services/resource-generator/src/main/java/org/egov/processor/util/ParsingUtil.java @@ -360,6 +360,7 @@ public int compare(Map.Entry o1, Map.Entry o2) return sortedColumnList; } + //TODO: change System to log.debug public void printRow(Sheet sheet, Row row) { System.out.print("Row -> "); for (Cell cell : row) {