From 750047c64917ae733c52c9d58f62b9cd1108994e Mon Sep 17 00:00:00 2001 From: Jayaprakash8887 Date: Wed, 6 Dec 2023 17:56:42 +0530 Subject: [PATCH] Issue #LR-676 feat: Delete User API --- .../user/UserDeletionBackgroundJobActor.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/service/src/main/java/org/sunbird/actor/user/UserDeletionBackgroundJobActor.java b/service/src/main/java/org/sunbird/actor/user/UserDeletionBackgroundJobActor.java index e1034ce68f..f5ce373798 100644 --- a/service/src/main/java/org/sunbird/actor/user/UserDeletionBackgroundJobActor.java +++ b/service/src/main/java/org/sunbird/actor/user/UserDeletionBackgroundJobActor.java @@ -30,7 +30,7 @@ private void inputKafkaTopic(Request request) throws Exception { User user = userService.getUserById(userId, request.getRequestContext()); String rootOrgId = user.getRootOrgId(); - List> suggestedUsersList = new ArrayList<>(); + ArrayList> suggestedUsersList = new ArrayList<>(); if (!roles.isEmpty()) { suggestedUsersList = fetchUsersByRoles(roles, rootOrgId, request); @@ -38,8 +38,8 @@ private void inputKafkaTopic(Request request) throws Exception { if (!roles.contains(JsonKey.ORG_ADMIN)) { // Add logic to fetch and add orgAdmins to suggestedUsersList - List> orgAdminUsersList = - fetchUsersByRoles((ArrayList) Arrays.asList("JsonKey.ORG_ADMIN"), rootOrgId, request); + ArrayList> orgAdminUsersList = + fetchUsersByRoles((ArrayList) Arrays.asList(JsonKey.ORG_ADMIN), rootOrgId, request); if (!orgAdminUsersList.isEmpty()) suggestedUsersList.addAll(orgAdminUsersList); } @@ -98,14 +98,14 @@ private void inputKafkaTopic(Request request) throws Exception { InstructionEventGenerator.pushInstructionEvent(userDeletionTopic, data); } - private List fetchUsersByRoles(ArrayList roles, String rootOrgId, Request request) { - List> suggestedUsersList = new ArrayList<>(); + private ArrayList fetchUsersByRoles(ArrayList roles, String rootOrgId, Request request) { + ArrayList> suggestedUsersList = new ArrayList<>(); Map searchQueryMap = new HashMap<>(); Map searchFilter = new HashMap<>(); searchFilter.put(JsonKey.ROOT_ORG_ID, rootOrgId); // for each role in the organisation, fetch list of other users to pass it as part of event - List queryFields = new ArrayList<>(); + ArrayList queryFields = new ArrayList<>(); queryFields.add(JsonKey.USER_ID); searchQueryMap.put(JsonKey.FIELDS, queryFields); logger.info("UserDeletionBackgroundJobActor::inputKafkaTopic:: roles size:: " + roles.size()); @@ -116,13 +116,13 @@ private List fetchUsersByRoles(ArrayList roles, String rootOrgId, Request reques SearchDTO searchDto = ElasticSearchHelper.createSearchDTO(searchQueryMap); Map result = userService.searchUser(searchDto, request.getRequestContext()); - List> userMapList = - (List>) result.get(JsonKey.CONTENT); + ArrayList> userMapList = + (ArrayList>) result.get(JsonKey.CONTENT); if (!userMapList.isEmpty()) { Map roleUsersMap = new HashMap<>(); roleUsersMap.put(JsonKey.ROLE, role); - List roleUsersList = new ArrayList<>(); + ArrayList roleUsersList = new ArrayList<>(); for (Map userMap : userMapList) { roleUsersList.add((String) userMap.get(JsonKey.USER_ID)); }