Skip to content

Commit

Permalink
Fix for sbRootOrgId value update when creating org
Browse files Browse the repository at this point in the history
  • Loading branch information
karthik-tarento committed Jul 8, 2022
1 parent db034a8 commit 1ba7812
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public SBApiResponse createOrg(Map<String, Object> request, String userToken) {
Map<String, Object> updateRequest = new HashMap<String, Object>();
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))) {
Expand Down Expand Up @@ -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<String, Object> 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;
}
Expand Down

0 comments on commit 1ba7812

Please sign in to comment.