diff options
author | Kotta, Shireesha (sk434m) <sk434m@att.com> | 2018-03-06 09:44:53 -0500 |
---|---|---|
committer | Kotta, Shireesha (sk434m) <sk434m@att.com> | 2018-03-06 17:43:16 -0500 |
commit | cfb69f44f841338e1f208225ec006388e986bd2c (patch) | |
tree | e8b7e982637a5b27f3383a793fcdcee50f7e0057 /ecomp-sdk/epsdk-app-common/src/main | |
parent | 724ff8f8b22d6503ce5070ebc13f6f5fbc48c8cf (diff) |
Added Junits & AAF attributes Support
Issue-ID: PORTAL-136
Includes JUNITS, AAF attributes support
Change-Id: Id4cc9f64268017665d7245d0a10369c9b498ba2f
Signed-off-by: Kotta, Shireesha (sk434m) <sk434m@att.com>
Diffstat (limited to 'ecomp-sdk/epsdk-app-common/src/main')
-rw-r--r-- | ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/OnBoardingApiServiceImpl.java | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/OnBoardingApiServiceImpl.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/OnBoardingApiServiceImpl.java index bfd0fc89..f19a14b6 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/OnBoardingApiServiceImpl.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/OnBoardingApiServiceImpl.java @@ -108,6 +108,7 @@ public class OnBoardingApiServiceImpl implements IPortalRestAPIService, IPortalR .getProperty(PortalApiConstants.ROLE_ACCESS_CENTRALIZED); private static final String isCentralized = "remote"; + private static String portalApiVersion = "/v1"; public OnBoardingApiServiceImpl() { // Defend against null-pointer exception during server startup @@ -229,11 +230,12 @@ public class OnBoardingApiServiceImpl implements IPortalRestAPIService, IPortalR try { if (logger.isDebugEnabled()) logger.debug(EELFLoggerDelegate.debugLogger, "## REST API ## loginId: {}", loginId); - + User user = null; - if(isCentralized.equals(isAccessCentralized)){ - String responseString = restApiRequestBuilder.getViaREST("/user/" + loginId, true, loginId); - user = userService.userMapper(responseString); + if (isCentralized.equals(isAccessCentralized)) { + String responseString = restApiRequestBuilder.getViaREST(portalApiVersion+"/user/" + loginId, true, + loginId); + user = userService.userMapper(responseString); } else{ user = userProfileService.getUserByLoginId(loginId); @@ -359,30 +361,30 @@ public class OnBoardingApiServiceImpl implements IPortalRestAPIService, IPortalR logger.debug(EELFLoggerDelegate.debugLogger, "## REST API ## loginId: {}", loginId); List<EcompRole> ecompRoles = new ArrayList<EcompRole>(); try { - - if(isCentralized.equals(isAccessCentralized)){ + + if (isCentralized.equals(isAccessCentralized)) { User user = null; - String responseString = restApiRequestBuilder.getViaREST("/user/" + loginId, true, loginId); - user = userService.userMapper(responseString); - SortedSet<Role> currentRoles = null; - if (user != null) { - currentRoles = user.getRoles(); - if (currentRoles != null) - for (Role role : currentRoles) - ecompRoles.add(UserUtils.convertToEcompRole(role)); - } - } - else{ - User user = userProfileService.getUserByLoginId(loginId); - SortedSet<Role> currentRoles = null; - if (user != null) { - currentRoles = user.getRoles(); - currentRoles.removeIf(role -> (role.getActive() == false)); - if (currentRoles != null) - for (Role role : currentRoles) - ecompRoles.add(UserUtils.convertToEcompRole(role)); + String responseString = restApiRequestBuilder.getViaREST(portalApiVersion+"/user/" + loginId, true, + loginId); + user = userService.userMapper(responseString); + SortedSet<Role> currentRoles = null; + if (user != null) { + currentRoles = user.getRoles(); + if (currentRoles != null) + for (Role role : currentRoles) + ecompRoles.add(UserUtils.convertToEcompRole(role)); + } + } else { + User user = userProfileService.getUserByLoginId(loginId); + SortedSet<Role> currentRoles = null; + if (user != null) { + currentRoles = user.getRoles(); + currentRoles.removeIf(role -> (role.getActive() == false)); + if (currentRoles != null) + for (Role role : currentRoles) + ecompRoles.add(UserUtils.convertToEcompRole(role)); + } } - } return ecompRoles; } catch (Exception e) { String response = "OnboardingApiService.getUserRoles failed"; |