summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-common/src
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-app-common/src')
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/CacheAdminController.java31
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FnMenuController.java34
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/MenuListController.java14
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/RoleController.java70
4 files changed, 80 insertions, 69 deletions
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/CacheAdminController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/CacheAdminController.java
index 34ad676e..9809b78a 100644
--- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/CacheAdminController.java
+++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/CacheAdminController.java
@@ -37,6 +37,8 @@
*/
package org.onap.portalapp.controller.core;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonProcessingException;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
@@ -71,6 +73,8 @@ import com.fasterxml.jackson.databind.SerializationFeature;
public class CacheAdminController extends RestrictedBaseController {
private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(CacheAdminController.class);
+ private static final String CACHE_NAME = "cacheName";
+ private static final String APPLICATION_JSON = "application/json";
private JCSAdminBean jcsAdminBean = new JCSAdminBean();
@@ -94,9 +98,9 @@ public class CacheAdminController extends RestrictedBaseController {
@RequestMapping(value = { "/jcs_admin/clearRegion" }, method = RequestMethod.GET)
public void clearRegion(HttpServletRequest request, HttpServletResponse response) throws IOException {
- String cacheName = request.getParameter("cacheName");
+ String cacheName = request.getParameter(CACHE_NAME);
clearCacheRegion(cacheName);
- response.setContentType("application/json");
+ response.setContentType(APPLICATION_JSON);
PrintWriter out = response.getWriter();
out.write(getRegions().toString());
}
@@ -104,7 +108,7 @@ public class CacheAdminController extends RestrictedBaseController {
@RequestMapping(value = { "/jcs_admin/clearAll" }, method = RequestMethod.GET)
public void clearAll(HttpServletResponse response) throws IOException {
clearAllRegions();
- response.setContentType("application/json");
+ response.setContentType(APPLICATION_JSON);
PrintWriter out = response.getWriter();
out.write(getRegions().toString());
}
@@ -112,16 +116,16 @@ public class CacheAdminController extends RestrictedBaseController {
@RequestMapping(value = { "/jcs_admin/clearItem" }, method = RequestMethod.GET)
public void clearItem(HttpServletRequest request, HttpServletResponse response) throws IOException {
String keyName = request.getParameter("keyName");
- String cacheName = request.getParameter("cacheName");
+ String cacheName = request.getParameter(CACHE_NAME);
clearCacheRegionItem(cacheName, keyName);
- response.setContentType("application/json");
+ response.setContentType(APPLICATION_JSON);
PrintWriter out = response.getWriter();
out.write(getRegions().toString());
}
@RequestMapping(value = { "/jcs_admin/showItemDetails" }, method = RequestMethod.GET)
public void showItemDetails(HttpServletRequest request, HttpServletResponse response) throws IOException {
- String cacheName = request.getParameter("cacheName");
+ String cacheName = request.getParameter(CACHE_NAME);
String keyName = request.getParameter("keyName");
String details = null;
try {
@@ -131,20 +135,20 @@ public class CacheAdminController extends RestrictedBaseController {
logger.error(EELFLoggerDelegate.errorLogger, "showItemDetails failed for cache name " + cacheName, e);
}
JSONObject j = new JSONObject(details);
- response.setContentType("application/json");
+ response.setContentType(APPLICATION_JSON);
PrintWriter out = response.getWriter();
out.write(j.toString());
}
@RequestMapping(value = { "/jcs_admin/showRegionDetails" }, method = RequestMethod.GET)
public void showRegionDetails(HttpServletRequest request, HttpServletResponse response) {
- String cacheName = request.getParameter("cacheName");
+ String cacheName = request.getParameter(CACHE_NAME);
ObjectMapper mapper = new ObjectMapper();
try {
String details = getRegionStats(cacheName);
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(details));
JSONObject j = new JSONObject(msg);
- response.setContentType("application/json");
+ response.setContentType(APPLICATION_JSON);
PrintWriter out = response.getWriter();
out.write(j.toString());
} catch (Exception e) {
@@ -163,9 +167,9 @@ public class CacheAdminController extends RestrictedBaseController {
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
for (CacheRegionInfo cri : regions) {
- if (cri.getCache().getCacheName() != null && !cri.getCache().getCacheName().equals("[object Object]")) {
+ if (cri.getCache().getCacheName() != null && !"[object Object]".equals(cri.getCache().getCacheName())) {
JSONObject jo = new JSONObject();
- jo.put("cacheName", cri.getCache().getCacheName());
+ jo.put(CACHE_NAME, cri.getCache().getCacheName());
jo.put("size", cri.getCache().getSize());
jo.put("byteCount", cri.getByteCount());
jo.put("status", cri.getStatus());
@@ -187,11 +191,10 @@ public class CacheAdminController extends RestrictedBaseController {
private String getRegionStats(String cacheName) throws CacheException {
JCS cache = JCS.getInstance(cacheName);
- String stats = cache.getStats();
- return stats;
+ return cache.getStats();
}
- private String getItemDetails(String cacheName, String keyName) throws Exception {
+ private String getItemDetails(String cacheName, String keyName) throws CacheException,JsonProcessingException {
JCS cache = JCS.getInstance(cacheName);
ICacheElement element = cache.getCacheElement(keyName);
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 ()");
}
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/MenuListController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/MenuListController.java
index 5ca764c1..bedd9c41 100644
--- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/MenuListController.java
+++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/MenuListController.java
@@ -74,6 +74,8 @@ public class MenuListController extends RestrictedBaseController {
private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MenuListController.class);
+ private static final String APPLICATION_JSON = "application/json";
+
@Autowired
private FnMenuService fnMenuService;
@Autowired
@@ -110,7 +112,7 @@ public class MenuListController extends RestrictedBaseController {
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(parentList),
mapper.writeValueAsString(childItemList), userName);
JSONObject j = new JSONObject(msg);
- response.setContentType("application/json");
+ response.setContentType(APPLICATION_JSON);
response.getWriter().write(j.toString());
logger.debug(EELFLoggerDelegate.debugLogger, "getMenu ends");
} catch (Exception e) {
@@ -132,12 +134,12 @@ public class MenuListController extends RestrictedBaseController {
try {
String appName = (String) session
.getAttribute(SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME));
- if (appName != null && appName.equals("app_display_name")) {
+ if (appName != null && "app_display_name".equals(appName)) {
appName = "";
}
JsonMessage msg = new JsonMessage(appName);
JSONObject j = new JSONObject(msg);
- response.setContentType("application/json");
+ response.setContentType(APPLICATION_JSON);
response.getWriter().write(j.toString());
logger.debug(EELFLoggerDelegate.debugLogger, "getAppName ends");
} catch (Exception e) {
@@ -194,7 +196,7 @@ public class MenuListController extends RestrictedBaseController {
String contextId = null;
if (request.getCookies() != null) {
for (Cookie ck : request.getCookies()) {
- if (ck.getName().equalsIgnoreCase("EPService"))
+ if ("EPService".equalsIgnoreCase(ck.getName()))
contextId = ck.getValue();
}
}
@@ -207,7 +209,7 @@ public class MenuListController extends RestrictedBaseController {
model.put(sharedContext.getCkey(), sharedContext.getCvalue());
}
JSONObject j = new JSONObject(model);
- response.setContentType("application/json");
+ response.setContentType(APPLICATION_JSON);
response.getWriter().write(j.toString());
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger, "getUserInfo failed", e);
@@ -248,7 +250,7 @@ public class MenuListController extends RestrictedBaseController {
isAppCentralized = true;
map.put("isAppCentralized", Boolean.toString(isAppCentralized));
JSONObject j = new JSONObject(map);
- response.setContentType("application/json");
+ response.setContentType(APPLICATION_JSON);
response.getWriter().write(j.toString());
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger, "Failed to serialize JSON", e);
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/RoleController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/RoleController.java
index 8306e91d..52dedd46 100644
--- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/RoleController.java
+++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/RoleController.java
@@ -76,6 +76,10 @@ import com.fasterxml.jackson.databind.type.TypeFactory;
public class RoleController extends RestrictedBaseController {
private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RoleController.class);
+ public static final String APPLICATION_JSON = "application/json";
+ public static final String ROLE_ID = "role_id";
+ public static final String UTF_8 = "UTF-8";
+ public static final String ROLE = "{role: ";
@Autowired
private RoleService roleService;
@@ -89,8 +93,8 @@ public class RoleController extends RestrictedBaseController {
User user = UserUtils.getUserSession(request);
Role role = roleService.getRole(user.getOrgUserId(),
- new Long(ServletRequestUtils.getIntParameter(request, "role_id", 0)));
- logger.info("role_id" + role.getId());
+ new Long(ServletRequestUtils.getIntParameter(request, ROLE_ID, 0)));
+ logger.info(ROLE_ID + role.getId());
try {
model.put("availableRoleFunctions",
mapper.writeValueAsString(roleService.getRoleFunctions(user.getOrgUserId())));
@@ -111,8 +115,8 @@ public class RoleController extends RestrictedBaseController {
User user = UserUtils.getUserSession(request);
Role role = roleService.getRole(user.getOrgUserId(),
- new Long(ServletRequestUtils.getIntParameter(request, "role_id", 0)));
- logger.info(EELFLoggerDelegate.applicationLogger, "role_id" + role.getId());
+ new Long(ServletRequestUtils.getIntParameter(request, ROLE_ID, 0)));
+ logger.info(EELFLoggerDelegate.applicationLogger, ROLE_ID + role.getId());
try {
model.put("availableRoleFunctions",
mapper.writeValueAsString(roleService.getRoleFunctions(user.getOrgUserId())));
@@ -172,13 +176,13 @@ public class RoleController extends RestrictedBaseController {
domainRole = new Role();
domainRole.setName(role.getName());
domainRole.setPriority(role.getPriority());
- if (role.getChildRoles() != null && role.getChildRoles().size() > 0) {
+ if (role.getChildRoles() != null && !role.getChildRoles().isEmpty()) {
for (Object childRole : childRoles) {
domainRole.addChildRole((Role) childRole);
}
}
}
- if (role.getRoleFunctions() != null && role.getRoleFunctions().size() > 0) {
+ if (role.getRoleFunctions() != null && !role.getRoleFunctions().isEmpty()) {
domainRole.setRoleFunctions(new TreeSet());
for (Object roleFunction : roleFunctions) {
domainRole.addRoleFunction((RoleFunction) roleFunction);
@@ -187,15 +191,15 @@ public class RoleController extends RestrictedBaseController {
roleService.saveRole(user.getOrgUserId(), domainRole);
String responseString = mapper.writeValueAsString(domainRole);
- j = new JSONObject("{role: " + responseString + "}");
+ j = new JSONObject(ROLE + responseString + "}");
} catch (Exception e) {
// Produce JSON error message
logger.error(EELFLoggerDelegate.errorLogger, "saveRole failed", e);
j = new JSONObject("{error: '" + e.getMessage() + "'}");
}
- response.setCharacterEncoding("UTF-8");
- response.setContentType("application/json");
+ response.setCharacterEncoding(UTF_8);
+ response.setContentType(APPLICATION_JSON);
PrintWriter out = response.getWriter();
out.write(j.toString());
return null;
@@ -213,24 +217,24 @@ public class RoleController extends RestrictedBaseController {
RoleFunction roleFunction = mapper.readValue(root.get("roleFunction").toString(), RoleFunction.class);
Role domainRole = roleService.getRole(user.getOrgUserId(),
- new Long(ServletRequestUtils.getIntParameter(request, "role_id", 0)));
+ new Long(ServletRequestUtils.getIntParameter(request, ROLE_ID, 0)));
doAuditLog("Remove role function {} from role {}", roleFunction.getCode(),
- ServletRequestUtils.getIntParameter(request, "role_id", 0));
+ ServletRequestUtils.getIntParameter(request, ROLE_ID, 0));
domainRole.removeRoleFunction(roleFunction.getCode());
roleService.saveRole(user.getOrgUserId(), domainRole);
- response.setCharacterEncoding("UTF-8");
- response.setContentType("application/json");
+ response.setCharacterEncoding(UTF_8);
+ response.setContentType(APPLICATION_JSON);
String responseString = mapper.writeValueAsString(domainRole);
- JSONObject j = new JSONObject("{role: " + responseString + "}");
+ JSONObject j = new JSONObject(ROLE + responseString + "}");
PrintWriter out = response.getWriter();
out.write(j.toString());
return null;
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger, "removeRole failed", e);
- response.setCharacterEncoding("UTF-8");
+ response.setCharacterEncoding(UTF_8);
PrintWriter out = response.getWriter();
out.write("An error occurred removeRole failed in the removeRoleFunction");
return null;
@@ -250,24 +254,24 @@ public class RoleController extends RestrictedBaseController {
RoleFunction roleFunction = mapper.readValue(root.get("roleFunction").toString(), RoleFunction.class);
Role domainRole = roleService.getRole(user.getOrgUserId(),
- new Long(ServletRequestUtils.getIntParameter(request, "role_id", 0)));
+ new Long(ServletRequestUtils.getIntParameter(request, ROLE_ID, 0)));
domainRole.addRoleFunction(roleFunction);
roleService.saveRole(user.getOrgUserId(), domainRole);
doAuditLog("Add role function {} to role {}", roleFunction.getCode(),
- ServletRequestUtils.getIntParameter(request, "role_id", 0));
+ ServletRequestUtils.getIntParameter(request, ROLE_ID, 0));
- response.setCharacterEncoding("UTF-8");
- response.setContentType("application/json");
+ response.setCharacterEncoding(UTF_8);
+ response.setContentType(APPLICATION_JSON);
String responseString = mapper.writeValueAsString(domainRole);
- JSONObject j = new JSONObject("{role: " + responseString + "}");
+ JSONObject j = new JSONObject(ROLE + responseString + "}");
PrintWriter out = response.getWriter();
out.write(j.toString());
return null;
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger, "removeRoleFunction failed", e);
- response.setCharacterEncoding("UTF-8");
+ response.setCharacterEncoding(UTF_8);
PrintWriter out = response.getWriter();
out.write("An error occurred removeRoleFunction failed in the removeRoleFunction");
return null;
@@ -286,24 +290,24 @@ public class RoleController extends RestrictedBaseController {
Role childRole = mapper.readValue(root.get("childRole").toString(), Role.class);
Role domainRole = roleService.getRole(user.getOrgUserId(),
- new Long(ServletRequestUtils.getIntParameter(request, "role_id", 0)));
+ new Long(ServletRequestUtils.getIntParameter(request, ROLE_ID, 0)));
domainRole.removeChildRole(childRole.getId());
doAuditLog("remove child role {} from role {}", childRole.getId(),
- ServletRequestUtils.getIntParameter(request, "role_id", 0));
+ ServletRequestUtils.getIntParameter(request, ROLE_ID, 0));
roleService.saveRole(user.getOrgUserId(), domainRole);
- response.setCharacterEncoding("UTF-8");
- response.setContentType("application/json");
+ response.setCharacterEncoding(UTF_8);
+ response.setContentType(APPLICATION_JSON);
String responseString = mapper.writeValueAsString(domainRole);
- JSONObject j = new JSONObject("{role: " + responseString + "}");
+ JSONObject j = new JSONObject(ROLE + responseString + "}");
PrintWriter out = response.getWriter();
out.write(j.toString());
return null;
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger, "removeChildRole failed", e);
- response.setCharacterEncoding("UTF-8");
+ response.setCharacterEncoding(UTF_8);
PrintWriter out = response.getWriter();
out.write("An error occurred removeChildRole failed in the removeChildRole()");
return null;
@@ -321,7 +325,7 @@ public class RoleController extends RestrictedBaseController {
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
JsonNode root = mapper.readTree(request.getReader());
Role childRole = mapper.readValue(root.get("childRole").toString(), Role.class);
- Long role_id = new Long(ServletRequestUtils.getIntParameter(request, "role_id", 0));
+ Long role_id = new Long(ServletRequestUtils.getIntParameter(request, ROLE_ID, 0));
Role domainRole = roleService.getRole(user.getOrgUserId(), role_id);
@@ -329,18 +333,18 @@ public class RoleController extends RestrictedBaseController {
roleService.saveRole(user.getOrgUserId(), domainRole);
doAuditLog("Add child role {} to role {}", childRole.getId(),
- ServletRequestUtils.getIntParameter(request, "role_id", 0));
+ ServletRequestUtils.getIntParameter(request, ROLE_ID, 0));
- response.setCharacterEncoding("UTF-8");
- response.setContentType("application/json");
+ response.setCharacterEncoding(UTF_8);
+ response.setContentType(APPLICATION_JSON);
String responseString = mapper.writeValueAsString(domainRole);
- JSONObject j = new JSONObject("{role: " + responseString + "}");
+ JSONObject j = new JSONObject(ROLE + responseString + "}");
PrintWriter out = response.getWriter();
out.write(j.toString());
return null;
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger, "addChildRole failed", e);
- response.setCharacterEncoding("UTF-8");
+ response.setCharacterEncoding(UTF_8);
PrintWriter out = response.getWriter();
out.write("An error occurred addChildRole failed in the addChildRole()");
return null;