Skip to content

Commit

Permalink
Cbrelease 4.8.15 (#638)
Browse files Browse the repository at this point in the history
* 4.8.15 dev v4 (#635)

* updated code for user bulk upload

* added code for process both csv and xlsx

* added code for process both csv and xlsx

* added code for process both csv and xlsx

* Changing access of  non-primary key to a primary key in Cassandra Query

Changing access of  non-primary key to a primary key in Cassandra Query

---------

Co-authored-by: anilkumarkammalapalli <121931293+anilkumarkammalapalli@users.noreply.github.com>
  • Loading branch information
SaipradeepR and anilkumarkammalapalli authored Jul 6, 2024
1 parent 1519379 commit 40a5546
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/main/java/org/sunbird/common/util/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -1097,6 +1097,8 @@ public class Constants {
public static final String SEARCH_COMPETENCY_SUB_THEMES = "competencySubTheme";
public static final String MCQ_MCA_W = "mcq-mca-w";
public static final String MCQ_SCA_TF = "mcq-sca-tf";
public static final String CSV_FILE = ".csv";
public static final String XLSX_FILE = ".xlsx";

private Constants() {
throw new IllegalStateException("Utility class");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public SBApiResponse fetchEhrmsProfileDetail(String userId, String authToken) {
SBApiResponse response = ProjectUtil.createDefaultResponse(Constants.EHRMS);
try {
Map<String, Object> propertyMap = new HashMap<>();
propertyMap.put(Constants.USER_ID_LOWER, userId);
propertyMap.put(Constants.ID, userId);
Map<String, Object> result = cassandraOperation.getRecordsByProperties(
Constants.KEYSPACE_SUNBIRD,
Constants.USER,
Expand Down Expand Up @@ -137,4 +137,4 @@ private Map<String, Object> prepareErrorResponse(String responseBodyString) {
}
return errResponseBody;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,19 @@ public void initiateUserBulkUploadProcess(String inputData) {
if (errList.isEmpty()) {
updateUserBulkUploadStatus(inputDataMap.get(Constants.ROOT_ORG_ID),
inputDataMap.get(Constants.IDENTIFIER), Constants.STATUS_IN_PROGRESS_UPPERCASE, 0, 0, 0);
storageService.downloadFile(inputDataMap.get(Constants.FILE_NAME));
//processBulkUpload(inputDataMap);
processCSVBulkUploadV2(inputDataMap);
String fileName = inputDataMap.get(Constants.FILE_NAME);
logger.info("fileName {} ", fileName);
storageService.downloadFile(fileName);
switch (getFileExtension(fileName)) {
case Constants.CSV_FILE:
processCSVBulkUploadV2(inputDataMap);
break;
case Constants.XLSX_FILE:
processBulkUpload(inputDataMap);
break;
default:
logger.error("Unsupported file type: {}", fileName);
}
} else {
logger.error(String.format("Error in the Kafka Message Received : %s", errList));
}
Expand Down Expand Up @@ -788,5 +798,9 @@ private boolean validateFieldValue(String fieldKey, String fieldValue) {
return !designationsSet.contains(fieldValue);
}
}
private String getFileExtension(String fileName) {
int lastIndexOfDot= fileName.lastIndexOf('.');
return lastIndexOfDot == -1 ? "" : fileName.substring(lastIndexOfDot);
}

}

0 comments on commit 40a5546

Please sign in to comment.