Merge "fixed some issues from sonar"
[portal.git] / ecomp-portal-BE-common / src / main / java / org / onap / portalapp / portal / controller / RoleManageController.java
index e308182..4b983d8 100644 (file)
@@ -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 @@ import org.springframework.context.annotation.EnableAspectJAutoProxy;
 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 @@ public class RoleManageController extends EPRestrictedBaseController {
                        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();
@@ -244,7 +242,7 @@ public class RoleManageController extends EPRestrictedBaseController {
                        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();
@@ -307,7 +305,7 @@ public class RoleManageController extends EPRestrictedBaseController {
                        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());
@@ -450,7 +448,7 @@ public class RoleManageController extends EPRestrictedBaseController {
                        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<>();
@@ -483,7 +481,7 @@ public class RoleManageController extends EPRestrictedBaseController {
                        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();
@@ -525,7 +523,7 @@ public class RoleManageController extends EPRestrictedBaseController {
                        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());
@@ -624,7 +622,7 @@ public class RoleManageController extends EPRestrictedBaseController {
                        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;
@@ -811,7 +809,7 @@ public class RoleManageController extends EPRestrictedBaseController {
                        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");