From: Sunder Tattavarada Date: Tue, 19 May 2020 18:01:01 +0000 (+0000) Subject: Merge "removed code smells" X-Git-Tag: 3.4.0~71 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=0a538f1113c1236e1ce8ba589a9446f6848e1844;hp=-c;p=portal.git Merge "removed code smells" --- 0a538f1113c1236e1ce8ba589a9446f6848e1844 diff --combined ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/FunctionalMenuController.java index dd5f5f4d,3233a5fe..3442d5a6 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/FunctionalMenuController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/FunctionalMenuController.java @@@ -83,12 -83,10 +83,10 @@@ import org.springframework.context.anno import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; - import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.DeleteMapping; - import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @@@ -575,20 -573,14 +573,20 @@@ public class FunctionalMenuController e String lastNameStr = null; String emailStr = null; String lastLogin = null; + boolean isSystemUser = false; EPUser user = EPUserUtils.getUserSession(request); firstNameStr = user.getFirstName(); lastNameStr = user.getLastName(); orgUserIdStr = user.getOrgUserId(); + isSystemUser = user.isSystemUser(); emailStr = user.getEmail(); if (emailStr == null || emailStr.equals("")) { - EPUser userResult = searchService.searchUserByUserId(orgUserIdStr); - emailStr = userResult.getEmail(); + try { + EPUser userResult = searchService.searchUserByUserId(orgUserIdStr); + emailStr = userResult.getEmail(); + }catch(Exception ex) { + logger.error(EELFLoggerDelegate.errorLogger, "searchUserByUserId call failed", ex); + } } SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss Z a"); Date lastLoginDate = user.getLastLoginDate(); @@@ -628,7 -620,6 +626,7 @@@ map.put("userId", orgUserIdStr != null ? orgUserIdStr : (orgUserIdSC != null ? orgUserIdSC.getCvalue() : null)); map.put("last_login", lastLogin); + map.put("isSystemUser", String.valueOf(isSystemUser)); JSONObject j = new JSONObject(map); fnMenuStaticResponse = j.toString(); // Be chatty in the log