From 1ba7812ca3044f59ec7281090745ed5ecc028d4a Mon Sep 17 00:00:00 2001 From: karthik-tarento Date: Fri, 8 Jul 2022 14:13:38 +0530 Subject: [PATCH] Fix for sbRootOrgId value update when creating org --- .../org/sunbird/org/service/ExtendedOrgServiceImpl.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/sunbird/org/service/ExtendedOrgServiceImpl.java b/src/main/java/org/sunbird/org/service/ExtendedOrgServiceImpl.java index cccffb850..93ee20d91 100644 --- a/src/main/java/org/sunbird/org/service/ExtendedOrgServiceImpl.java +++ b/src/main/java/org/sunbird/org/service/ExtendedOrgServiceImpl.java @@ -60,7 +60,8 @@ public SBApiResponse createOrg(Map request, String userToken) { Map updateRequest = new HashMap(); updateRequest.put(Constants.SB_ORG_ID, orgId); String orgType = (String) requestData.get(Constants.ORGANIZATION_TYPE); - if (requestData.containsKey(Constants.SB_ROOT_ORG_ID)) { + if (requestData.containsKey(Constants.SB_ROOT_ORG_ID) + && StringUtils.isNotEmpty((String) requestData.get(Constants.SB_ROOT_ORG_ID))) { updateRequest.put(Constants.SB_ROOT_ORG_ID, (String) requestData.get(Constants.SB_ROOT_ORG_ID)); } else if (!(Constants.STATE.equalsIgnoreCase(orgType) || Constants.MINISTRY.equalsIgnoreCase(orgType))) { @@ -329,12 +330,12 @@ private String findRootOrgId(String orgName, String mapId) { Constants.KEYSPACE_SUNBIRD, Constants.TABLE_ORG_HIERARCHY, searchRequest, null); if (CollectionUtils.isNotEmpty(existingDataList)) { Map data = existingDataList.get(0); - parentMapId = (String) data.get(Constants.PARENT_MAP_ID); + parentMapId = (String) data.get(Constants.PARENT_MAP_ID.toLowerCase()); // We found the 1st level object if (Constants.SPV.equalsIgnoreCase(parentMapId)) { - return (String) data.get(Constants.SB_ORG_ID); + return (String) data.get(Constants.SB_ORG_ID.toLowerCase()); } else { - mapId = (String) data.get(Constants.PARENT_MAP_ID); + mapId = (String) data.get(Constants.PARENT_MAP_ID.toLowerCase()); orgName = StringUtils.EMPTY; continue; }