Fix sonar issues in RoleFunctionListController 34/88234/1
authorPawel <pawel.kasperkiewicz@nokia.com>
Wed, 22 May 2019 09:28:59 +0000 (05:28 -0400)
committerPawel <pawel.kasperkiewicz@nokia.com>
Wed, 22 May 2019 09:50:59 +0000 (05:50 -0400)
Issue-ID: PORTAL-585

Signed-off-by: Pawel <pawel.kasperkiewicz@nokia.com>
Change-Id: I9e8362923ff19d3e49164e0fad68ff25a7c10f39

ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/RoleFunctionListController.java

index 699e83c..4ac5f37 100644 (file)
@@ -67,6 +67,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 public class RoleFunctionListController extends RestrictedBaseController {
 
        private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RoleFunctionListController.class);
+       private static final String SUCCESS = "SUCCESS";
 
        @Autowired
        private RoleService service;
@@ -117,7 +118,7 @@ public class RoleFunctionListController extends RestrictedBaseController {
                        RoleFunction domainRoleFunction = service.getRoleFunction(user.getOrgUserId(), code);
                        domainRoleFunction.setName(availableRoleFunction.getName());
                        domainRoleFunction.setCode(code);
-                       restCallStatus = "success";
+                       restCallStatus = SUCCESS;
                        service.saveRoleFunction(user.getOrgUserId(), domainRoleFunction);
                } catch (Exception e) {
                        logger.error(EELFLoggerDelegate.errorLogger, "saveRoleFunction failed", e);
@@ -141,7 +142,7 @@ public class RoleFunctionListController extends RestrictedBaseController {
                        RoleFunction availableRoleFunction = mapper.readValue(data, RoleFunction.class);
                        String code = availableRoleFunction.getCode();
                        List<RoleFunction> currentRoleFunction = service.getRoleFunctions(user.getOrgUserId());
-                       restCallStatus = "success";
+                       restCallStatus = SUCCESS;
                        for (RoleFunction roleF : currentRoleFunction) {
                                if (roleF.getCode().equals(code)) {
                                        restCallStatus = "code exists";
@@ -177,7 +178,7 @@ public class RoleFunctionListController extends RestrictedBaseController {
 
                        service.deleteRoleFunction(user.getOrgUserId(), domainRoleFunction);
                        logger.info(EELFLoggerDelegate.auditLogger, "Remove role function " + domainRoleFunction.getName());
-                       restCallStatus = "success";
+                       restCallStatus = SUCCESS;
                } catch (Exception e) {
                        logger.error(EELFLoggerDelegate.errorLogger, "removeRoleFunction failed", e);
                        throw new IOException(e);