Skip to content

Commit

Permalink
change names to camel case.
Browse files Browse the repository at this point in the history
  • Loading branch information
devdatta-egov committed Jun 19, 2024
1 parent b9accbf commit 14c8c1d
Showing 1 changed file with 30 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ private void processRows(PlanConfigurationRequest planConfigurationRequest, Shee
planConfigurationRequest.getPlanConfiguration().getTenantId());
org.egov.processor.web.models.File file = planConfig.getFiles().stream()
.filter(f -> f.getFilestoreId().equalsIgnoreCase(fileStoreId)).findFirst().get();
Map<String, Object> attributenamevsdatatypemap = mdmsUtil.filterMasterData(mdmsData.toString(), file.getInputFileType(),
Map<String, Object> attributeNameVsDataTypeMap = mdmsUtil.filterMasterData(mdmsData.toString(), file.getInputFileType(),
file.getTemplateIdentifier(), campaign.getCampaign().get(0).getProjectType());
BoundarySearchResponse boundarySearchResponse = boundaryUtil.search(planConfig.getTenantId(),
campaign.getCampaign().get(0).getHierarchyType(), planConfigurationRequest);
Expand All @@ -212,9 +212,9 @@ private void processRows(PlanConfigurationRequest planConfigurationRequest, Shee
.convertAssumptionsToMap(planConfig.getAssumptions());
Map<String, Integer> mapOfColumnNameAndIndex = parsingUtil.getAttributeNameIndexFromExcel(sheet);

Integer indexOfBCode = campaignIntegrationUtil.getIndexOfBoundaryCode(0,
Integer indexOfBoundaryCode = campaignIntegrationUtil.getIndexOfBoundaryCode(0,
campaignIntegrationUtil.sortColumnByIndex(mapOfColumnNameAndIndex), mappedValues);
validateRows(indexOfBCode, row, firstRow, attributenamevsdatatypemap, mappedValues, mapOfColumnNameAndIndex,
validateRows(indexOfBoundaryCode, row, firstRow, attributeNameVsDataTypeMap, mappedValues, mapOfColumnNameAndIndex,
planConfigurationRequest, boundaryCodeList);
JsonNode feature = createFeatureNodeFromRow(row, dataFormatter, mapOfColumnNameAndIndex);
int columnIndex = row.getLastCellNum(); // Get the index of the last cell in the row
Expand Down Expand Up @@ -360,10 +360,10 @@ public void printRow(Sheet sheet, Row row) {
/**
* Validates the data in a row.
*
* @param indexOfBCode The index of the "BCode" column in the row.
* @param indexOfBoundaryCode The index of the "BCode" column in the row.
* @param row The row containing the data to be validated.
* @param columnHeaderRow The row containing the column headers.
* @param attributenamevsdatatypemap Map containing data types from external
* @param attributeNameVsDataTypeMap Map containing data types from external
* source (MDMS).
* @param mappedValues Map containing mapped values.
* @param mapOfColumnNameAndIndex Map containing column names and their
Expand All @@ -373,13 +373,13 @@ public void printRow(Sheet sheet, Row row) {
* @throws CustomException if the input data is not valid or if a custom
* exception occurs.
*/
public void validateRows(Integer indexOfBCode, Row row, Row columnHeaderRow, Map<String, Object> attributenamevsdatatypemap,
public void validateRows(Integer indexOfBoundaryCode, Row row, Row columnHeaderRow, Map<String, Object> attributeNameVsDataTypeMap,
Map<String, String> mappedValues, Map<String, Integer> mapOfColumnNameAndIndex,
PlanConfigurationRequest planConfigurationRequest, List<String> boundaryCodeList) {

try {
validateTillBoundaryCode(indexOfBCode, row, columnHeaderRow);
validateAttributes(attributenamevsdatatypemap, mappedValues, mapOfColumnNameAndIndex, row, columnHeaderRow, indexOfBCode,
validateTillBoundaryCode(indexOfBoundaryCode, row, columnHeaderRow);
validateAttributes(attributeNameVsDataTypeMap, mappedValues, mapOfColumnNameAndIndex, row, columnHeaderRow, indexOfBoundaryCode,
boundaryCodeList);
} catch (JsonProcessingException e) {
log.info(ServiceConstants.INPUT_IS_NOT_VALID + (row.getRowNum() + 1));
Expand All @@ -399,36 +399,36 @@ public void validateRows(Integer indexOfBCode, Row row, Row columnHeaderRow, Map
/**
* Validates the data in columns from "BCode" column.
*
* @param attributenamevsdatatypemap Map containing data types from an external
* source (MDMS).
* @param mappedValues Map containing mapped values.
* @param mapOfColumnNameAndIndex Map containing column names and their
* corresponding indices.
* @param row The row containing the data to be validated.
* @param columnHeaderRow The row containing the column headers.
* @param indexOfBCode The index of the "BCode" column in the row.
* @throws JsonMappingException if there's an issue mapping JSON.
* @throws JsonProcessingException if there's an issue processing JSON.
* @param attributeNameVsDataTypeMap Map containing data types from an external
* source (MDMS).
* @param mappedValues Map containing mapped values.
* @param mapOfColumnNameAndIndex Map containing column names and their
* corresponding indices.
* @param row The row containing the data to be validated.
* @param columnHeaderRow The row containing the column headers.
* @param indexOfBoundaryCode The index of the "BCode" column in the row.
* @throws JsonMappingException if there's an issue mapping JSON.
* @throws JsonProcessingException if there's an issue processing JSON.
*/
private void validateAttributes(Map<String, Object> attributenamevsdatatypemap, Map<String, String> mappedValues,
Map<String, Integer> mapOfColumnNameAndIndex, Row row, Row columnHeaderRow, Integer indexOfBCode,
private void validateAttributes(Map<String, Object> attributeNameVsDataTypeMap, Map<String, String> mappedValues,
Map<String, Integer> mapOfColumnNameAndIndex, Row row, Row columnHeaderRow, Integer indexOfBoundaryCode,
List<String> boundaryCodeList) throws JsonMappingException, JsonProcessingException {
for (int j = indexOfBCode; j < mapOfColumnNameAndIndex.size(); j++) {
for (int j = indexOfBoundaryCode; j < mapOfColumnNameAndIndex.size(); j++) {
Cell cell = row.getCell(j);
Cell columnName = columnHeaderRow.getCell(j);
String name = findByValue(mappedValues, columnName.getStringCellValue());
String value;
if (attributenamevsdatatypemap.containsKey(name)) {
value = attributenamevsdatatypemap.get(name).toString();
if (attributeNameVsDataTypeMap.containsKey(name)) {
value = attributeNameVsDataTypeMap.get(name).toString();
switch (cell.getCellType()) {
case STRING:
String cellValue = cell.getStringCellValue();
if (j == indexOfBCode && !boundaryCodeList.contains(cellValue)) {
log.info("Boundary Code is not present in search for row " + (row.getRowNum() + 1)
if (j == indexOfBoundaryCode && !boundaryCodeList.contains(cellValue)) {
log.info("Boundary Code "+ cellValue+" is not present in boundary search. Code for row " + (row.getRowNum() + 1)
+ " and cell/column " + columnName);
throw new CustomException(Integer.toString(HttpStatus.INTERNAL_SERVER_ERROR.value()),
"Boundary Code is not present in search for row " + (row.getRowNum() + 1)
+ " and cell/column " + columnName);
"Boundary Code "+ cellValue+" is not present in boundary search. Code for row " + (row.getRowNum() + 1)
+ " and cell/column " + columnName);
}
// "^[a-zA-Z0-9 .,()-]+$"
if (cellValue != null && !cellValue.isEmpty()
Expand Down Expand Up @@ -476,12 +476,12 @@ private void validateAttributes(Map<String, Object> attributenamevsdatatypemap,
* Validates the data in columns up to the specified index of the "BCode"
* column.
*
* @param indexOfBCode The index of the "BCode" column in the row.
* @param indexOfBoundaryCode The index of the "BCode" column in the row.
* @param row The row containing the data to be validated.
* @param columnHeaderRow The row containing the column headers.
*/
private void validateTillBoundaryCode(Integer indexOfBCode, Row row, Row columnHeaderRow) {
for (int j = 0; j <= indexOfBCode - 1; j++) {
private void validateTillBoundaryCode(Integer indexOfBoundaryCode, Row row, Row columnHeaderRow) {
for (int j = 0; j <= indexOfBoundaryCode - 1; j++) {
Cell cell = row.getCell(j);
if (cell != null && !cell.getCellType().name().equals("BLANK")) {
String cellValue = cell.getStringCellValue();
Expand Down

0 comments on commit 14c8c1d

Please sign in to comment.