Merge "fixed some issues from sonar"
authorSunder Tattavarada <statta@research.att.com>
Thu, 18 Jun 2020 19:46:54 +0000 (19:46 +0000)
committerGerrit Code Review <gerrit@onap.org>
Thu, 18 Jun 2020 19:46:54 +0000 (19:46 +0000)
1  2 
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/RoleManageController.java

@@@ -7,10 -7,10 +7,10 @@@
   * Modifications Copyright (c) 2019 Samsung 
   * ===================================================================
   * Modifications Copyright (c) 2020 IBM
-  * ===================================================================
-  * 
+  * =================================================================== 
+  *
   * Unless otherwise specified, all software contained herein is licensed
-  * under the Apache License, Version 2.0 (the "License");
+  * under the Apache License, Version 2.0 (the "License"); 
   * you may not use this software except in compliance with the License.
   * You may obtain a copy of the License at
   * 
@@@ -97,10 -97,8 +97,8 @@@ import org.springframework.context.anno
  import org.springframework.http.ResponseEntity;
  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.PostMapping;
  import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
  import org.springframework.web.bind.annotation.RestController;
  import org.springframework.web.servlet.ModelAndView;
  import com.fasterxml.jackson.databind.DeserializationFeature;
@@@ -166,7 -164,7 +164,7 @@@ public class RoleManageController exten
                        EPApp requestedApp = appService.getApp(appId);
                        if (isAuthorizedUser(user, requestedApp)) {
                                fieldsValidation(requestedApp);
 -                              if (requestedApp.getCentralAuth()) {
 +                              if (requestedApp.getRolesInAAF()) {
                                        List<CentralV2Role> answer = null;
                                        Map<String, Object> model = new HashMap<>();
                                        ObjectMapper mapper = new ObjectMapper();
                        requestedApp = appService.getApp(appId);
                        if (isAuthorizedUser(user, requestedApp)) {
                                fieldsValidation(requestedApp);
 -                              if (requestedApp.getCentralAuth()) {
 +                              if (requestedApp.getRolesInAAF()) {
                                        externalRequestFieldsValidator = externalAccessRolesService.deleteDependencyRoleRecord(roleId,
                                                        requestedApp.getUebKey(), user.getOrgUserId());
                                        boolean deleteResponse = externalRequestFieldsValidator.isResult();
                        EPApp requestedApp = appService.getApp(appId);
                        if (isAuthorizedUser(user, requestedApp)) {
                                fieldsValidation(requestedApp);
 -                              if (requestedApp != null && requestedApp.getCentralAuth().equals(true)) {
 +                              if (requestedApp != null && requestedApp.getRolesInAAF().equals(true)) {
                                        ObjectMapper mapper = new ObjectMapper();
                                        mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
                                        JsonNode root = mapper.readTree(request.getReader());
                        EPApp requestedApp = appService.getApp(appId);
                        if (isAuthorizedUser(user, requestedApp)) {
                                fieldsValidation(requestedApp);
 -                              if (requestedApp.getCentralAuth()) {
 +                              if (requestedApp.getRolesInAAF()) {
                                        CentralV2Role answer = externalAccessRolesService.getRoleInfo(roleId, requestedApp.getUebKey());
                                        logger.info(EELFLoggerDelegate.applicationLogger, "role_id" + roleId);
                                        Map<String, Object> model = new HashMap<>();
                        EPApp requestedApp = appService.getApp(appId);
                        if (isAuthorizedUser(user, requestedApp)) {
                                fieldsValidation(requestedApp);
 -                              if (requestedApp.getCentralAuth()) {
 +                              if (requestedApp.getRolesInAAF()) {
                                        List<CentralV2RoleFunction> answer = null;
                                        Map<String, Object> model = new HashMap<>();
                                        ObjectMapper mapper = new ObjectMapper();
                        EPApp requestedApp = appService.getApp(appId);
                        if (isAuthorizedUser(user, requestedApp)) {
                                fieldsValidation(requestedApp);
 -                              if (requestedApp.getCentralAuth() && roleFunc!=null) {
 +                              if (requestedApp.getRolesInAAF() && roleFunc!=null) {
                                        String code = roleFunc.getType() + PIPE + roleFunc.getCode() + PIPE + roleFunc.getAction();
                                        CentralV2RoleFunction domainRoleFunction = externalAccessRolesService.getRoleFunction(code,
                                                        requestedApp.getUebKey());
                        EPApp requestedApp = appService.getApp(appId);
                        if (isAuthorizedUser(user, requestedApp)) {
                                fieldsValidation(requestedApp);
 -                              if (requestedApp.getCentralAuth()) {
 +                              if (requestedApp.getRolesInAAF()) {
                                        ObjectMapper mapper = new ObjectMapper();
                                        String data = roleFunc;
                                        boolean getDelFuncResponse = false;
                        throw new InvalidApplicationException("Invalid credentials");
                }
                if (!appInfo.isEmpty() && EcompPortalUtils.checkIfRemoteCentralAccessAllowed()
 -                              && appInfo.get(0).getCentralAuth()) {
 +                              && appInfo.get(0).getRolesInAAF()) {
                        ResponseEntity<String> response = externalAccessRolesService.getNameSpaceIfExists(appInfo.get(0));
                        if (response.getStatusCode().value() == HttpServletResponse.SC_NOT_FOUND)
                                throw new InvalidApplicationException("Invalid NameSpace");