summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-common/src/main
diff options
context:
space:
mode:
authorManoop Talasila <talasila@research.att.com>2019-03-12 14:27:31 +0000
committerGerrit Code Review <gerrit@onap.org>2019-03-12 14:27:31 +0000
commitc71749fb73e1f7e2487b8b56bb52788842634758 (patch)
tree5609a7fb709ba9ef0afdf7c7ebc2584408eca580 /ecomp-sdk/epsdk-app-common/src/main
parent57fbb270d5cc336e7ce09570c1e3de6a7bb03a21 (diff)
parent5ebfbe3184394f4c0ae50cdf08f18f5b743c2925 (diff)
Merge "Fix sonar issues in FnMenuController"
Diffstat (limited to 'ecomp-sdk/epsdk-app-common/src/main')
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FnMenuController.java34
1 files changed, 18 insertions, 16 deletions
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FnMenuController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FnMenuController.java
index e4c862fd..8f49b640 100644
--- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FnMenuController.java
+++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FnMenuController.java
@@ -74,35 +74,35 @@ public class FnMenuController extends RestrictedBaseController {
private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FnMenuController.class);
+ private static final String UTF8 = "UTF-8";
+
@Autowired
FnMenuService service;
@Autowired
FunctionalMenuListService functionalMenuListService;
- private String viewName;
-
@RequestMapping(value = { "/admin_fn_menu/get_parent_list" }, method = RequestMethod.GET)
- public void getParentList(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public void getParentList(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException {
ObjectMapper mapper = new ObjectMapper();
try {
response.getWriter().write(mapper.writeValueAsString(service.getParentList()));
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger, "getParentListFailed", e);
- response.setCharacterEncoding("UTF-8");
+ response.setCharacterEncoding(UTF8);
PrintWriter out = response.getWriter();
out.write("An error occurred in the getParentList () ");
}
}
@RequestMapping(value = { "/admin_fn_menu/get_function_cd_list" }, method = RequestMethod.GET)
- public void getFunctionCDList(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public void getFunctionCDList(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException {
ObjectMapper mapper = new ObjectMapper();
try {
response.getWriter().write(mapper.writeValueAsString(functionalMenuListService.getFunctionCDList(request)));
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger, "getFunctionCDList", e);
- response.setCharacterEncoding("UTF-8");
+ response.setCharacterEncoding(UTF8);
PrintWriter out = response.getWriter();
out.write("An error occurred in the getFunctionCDList ()");
}
@@ -153,7 +153,8 @@ public class FnMenuController extends RestrictedBaseController {
}
@RequestMapping(value = { "/admin_fn_menu/updateFnMenu" }, method = RequestMethod.POST)
- public ModelAndView updateFnMenu(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView updateFnMenu(HttpServletRequest request, HttpServletResponse response)
+ throws java.io.IOException, java.io.UnsupportedEncodingException {
try {
ObjectMapper mapper = new ObjectMapper();
@@ -166,9 +167,9 @@ public class FnMenuController extends RestrictedBaseController {
request.getSession().removeAttribute(SystemProperties.LEFT_MENU_CHILDREND);
request.getSession().removeAttribute(SystemProperties.LEFT_MENU_PARENT);
- response.setCharacterEncoding("UTF-8");
+ response.setCharacterEncoding(UTF8);
response.setContentType("application / json");
- request.setCharacterEncoding("UTF-8");
+ request.setCharacterEncoding(UTF8);
PrintWriter out = response.getWriter();
String responseString = mapper.writeValueAsString(service.getMenuItem(fnMenuItem.getId()));
@@ -179,8 +180,8 @@ public class FnMenuController extends RestrictedBaseController {
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger, "updateFnMenu failed", e);
- response.setCharacterEncoding("UTF-8");
- request.setCharacterEncoding("UTF-8");
+ response.setCharacterEncoding(UTF8);
+ request.setCharacterEncoding(UTF8);
PrintWriter out = response.getWriter();
out.write("An error occurred in the updateFnMenu () ");
}
@@ -189,7 +190,8 @@ public class FnMenuController extends RestrictedBaseController {
}
@RequestMapping(value = { "/admin_fn_menu/removeMenuItem" }, method = RequestMethod.POST)
- public ModelAndView removeFnMenu(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removeFnMenu(HttpServletRequest request, HttpServletResponse response)
+ throws java.io.IOException, java.io.UnsupportedEncodingException {
try {
ObjectMapper mapper = new ObjectMapper();
@@ -198,9 +200,9 @@ public class FnMenuController extends RestrictedBaseController {
Menu fnMenuItem = mapper.readValue(root.get("fnMenuItem").toString(), Menu.class);
Menu fnMenuItemRow = service.getMenuItemRow(fnMenuItem.getId());
service.removeMenuItem(fnMenuItemRow);
- response.setCharacterEncoding("UTF-8");
+ response.setCharacterEncoding(UTF8);
response.setContentType("application / json");
- request.setCharacterEncoding("UTF-8");
+ request.setCharacterEncoding(UTF8);
PrintWriter out = response.getWriter();
String responseString = mapper.writeValueAsString(service.getMenuItem(fnMenuItem.getId()));
out.write(responseString);
@@ -209,8 +211,8 @@ public class FnMenuController extends RestrictedBaseController {
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger, "removeFnMenu failed", e);
- response.setCharacterEncoding("UTF-8");
- request.setCharacterEncoding("UTF-8");
+ response.setCharacterEncoding(UTF8);
+ request.setCharacterEncoding(UTF8);
PrintWriter out = response.getWriter();
out.write("An error occurred in the removeFnMenu ()");
}