From de06eee657f606a22dbff6c7f88a44762878c6a2 Mon Sep 17 00:00:00 2001 From: sreeragksgh Date: Fri, 3 Mar 2023 09:51:08 +0530 Subject: [PATCH 1/2] adding loggers for org ext search issue --- .../java/org/sunbird/org/service/ExtendedOrgServiceImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/org/sunbird/org/service/ExtendedOrgServiceImpl.java b/src/main/java/org/sunbird/org/service/ExtendedOrgServiceImpl.java index 802f3eb4a..737b63168 100644 --- a/src/main/java/org/sunbird/org/service/ExtendedOrgServiceImpl.java +++ b/src/main/java/org/sunbird/org/service/ExtendedOrgServiceImpl.java @@ -158,6 +158,7 @@ public SBApiResponse listOrg(String parentMapId) { @Override public SBApiResponse orgExtSearch(Map request) throws Exception { SBApiResponse response = ProjectUtil.createDefaultResponse(Constants.API_ORG_EXT_SEARCH); + log.info("Inside org ext search implementation"); try { String errMsg = validateOrgSearchReq(request); if (!StringUtils.isEmpty(errMsg)) { @@ -178,6 +179,7 @@ public SBApiResponse orgExtSearch(Map request) throws Exception List> existingDataList = cassandraOperation.getRecordsByProperties( Constants.KEYSPACE_SUNBIRD, Constants.TABLE_ORG_HIERARCHY, searchRequest, null); + log.info("existing data list : "+existingDataList); if (CollectionUtils.isNotEmpty(existingDataList)) { List orgIdList = existingDataList.stream().filter(item -> !ObjectUtils.isEmpty(item)) .map(item -> { @@ -185,6 +187,7 @@ public SBApiResponse orgExtSearch(Map request) throws Exception }).collect(Collectors.toList()); SBApiOrgSearchRequest orgSearchRequest = new SBApiOrgSearchRequest(); orgSearchRequest.getFilters().setId(orgIdList); + log.info("org id list : "+orgIdList); Map orgSearchRequestBody = new HashMap() { private static final long serialVersionUID = 1L; @@ -199,6 +202,8 @@ public SBApiResponse orgExtSearch(Map request) throws Exception Map apiResponse = (Map) outboundService.fetchResultUsingPost(url, orgSearchRequestBody, headers); + log.info("api response : "+apiResponse); + if (Constants.OK.equalsIgnoreCase((String) apiResponse.get(Constants.RESPONSE_CODE))) { Map apiResponseResult = (Map) apiResponse.get(Constants.RESULT); response.put(Constants.RESPONSE, apiResponseResult.get(Constants.RESPONSE)); From 17ad6d6edc430b41dc79e17404abae30d5985f43 Mon Sep 17 00:00:00 2001 From: sreeragksgh Date: Fri, 3 Mar 2023 16:18:37 +0530 Subject: [PATCH 2/2] Fix for NIC ORG list issue --- .../org/sunbird/org/service/ExtendedOrgServiceImpl.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/main/java/org/sunbird/org/service/ExtendedOrgServiceImpl.java b/src/main/java/org/sunbird/org/service/ExtendedOrgServiceImpl.java index 737b63168..d2e313ebb 100644 --- a/src/main/java/org/sunbird/org/service/ExtendedOrgServiceImpl.java +++ b/src/main/java/org/sunbird/org/service/ExtendedOrgServiceImpl.java @@ -158,7 +158,6 @@ public SBApiResponse listOrg(String parentMapId) { @Override public SBApiResponse orgExtSearch(Map request) throws Exception { SBApiResponse response = ProjectUtil.createDefaultResponse(Constants.API_ORG_EXT_SEARCH); - log.info("Inside org ext search implementation"); try { String errMsg = validateOrgSearchReq(request); if (!StringUtils.isEmpty(errMsg)) { @@ -179,15 +178,13 @@ public SBApiResponse orgExtSearch(Map request) throws Exception List> existingDataList = cassandraOperation.getRecordsByProperties( Constants.KEYSPACE_SUNBIRD, Constants.TABLE_ORG_HIERARCHY, searchRequest, null); - log.info("existing data list : "+existingDataList); if (CollectionUtils.isNotEmpty(existingDataList)) { List orgIdList = existingDataList.stream().filter(item -> !ObjectUtils.isEmpty(item)) .map(item -> { - return (String) item.get(Constants.SB_ROOT_ORG_ID.toLowerCase()); + return (String) item.get(Constants.SB_ORG_ID); }).collect(Collectors.toList()); SBApiOrgSearchRequest orgSearchRequest = new SBApiOrgSearchRequest(); orgSearchRequest.getFilters().setId(orgIdList); - log.info("org id list : "+orgIdList); Map orgSearchRequestBody = new HashMap() { private static final long serialVersionUID = 1L; @@ -202,8 +199,6 @@ public SBApiResponse orgExtSearch(Map request) throws Exception Map apiResponse = (Map) outboundService.fetchResultUsingPost(url, orgSearchRequestBody, headers); - log.info("api response : "+apiResponse); - if (Constants.OK.equalsIgnoreCase((String) apiResponse.get(Constants.RESPONSE_CODE))) { Map apiResponseResult = (Map) apiResponse.get(Constants.RESULT); response.put(Constants.RESPONSE, apiResponseResult.get(Constants.RESPONSE));