Merge "removed code smells"
authorSunder Tattavarada <statta@research.att.com>
Tue, 19 May 2020 18:01:01 +0000 (18:01 +0000)
committerGerrit Code Review <gerrit@onap.org>
Tue, 19 May 2020 18:01:01 +0000 (18:01 +0000)
1  2 
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();
                        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