aboutsummaryrefslogtreecommitdiffstats
path: root/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AdminTabController.java
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2019-10-11 08:56:16 -0400
committerPamela Dragosh <pdragosh@research.att.com>2019-10-11 09:53:17 -0400
commitf36e53a3637e1204a42491ec0eeed7b3c763f681 (patch)
tree903cc402afb1228fe8f96c550b2bf01c572fc41e /POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AdminTabController.java
parentb86c95c99240e8ed0ef91932a70ebed313dbd60c (diff)
More sonar cleanup and line consolidation
Missing javadoc and some variable naming to remove consecutive capitlization of letters. 120 line width reduction Missing curly braces Moving variables due to distance requirements Add missing rawtype suppression or useless ones There are some null return statements that are useless Started doing some combining of lines at the risk of making the code even more unreadable than it already is. Started addressing some nested if's. I see opportunity for a lot of common code to be combined or put into a base controller or utility method. Issue-ID: POLICY-2133 Change-Id: I6d4d9618bea685cf1d02899e3a9d4a43919a2a96 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AdminTabController.java')
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AdminTabController.java30
1 files changed, 20 insertions, 10 deletions
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AdminTabController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AdminTabController.java
index 92f125a7d..0ab266071 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AdminTabController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AdminTabController.java
@@ -74,6 +74,12 @@ public class AdminTabController extends RestrictedBaseController {
AdminTabController.commonClassDao = commonClassDao;
}
+ /**
+ * getAdminTabEntityData.
+ *
+ * @param request HttpServletRequest
+ * @param response HttpServletResponse
+ */
@RequestMapping(
value = {"/get_LockDownData"},
method = {org.springframework.web.bind.annotation.RequestMethod.GET},
@@ -83,14 +89,20 @@ public class AdminTabController extends RestrictedBaseController {
Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("lockdowndata", mapper.writeValueAsString(commonClassDao.getData(GlobalRoleSettings.class)));
- JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
- JSONObject j = new JSONObject(msg);
- response.getWriter().write(j.toString());
+ response.getWriter().write(new JSONObject(new JsonMessage(mapper.writeValueAsString(model))).toString());
} catch (Exception e) {
LOGGER.error("Exception Occured" + e);
}
}
+ /**
+ * saveAdminTabLockdownValue.
+ *
+ * @param request HttpServletRequest
+ * @param response HttpServletResponse
+ * @return ModelAndView object
+ * @throws IOException IOException
+ */
@RequestMapping(
value = {"/adminTabController/save_LockDownValue.htm"},
method = {org.springframework.web.bind.annotation.RequestMethod.POST})
@@ -101,10 +113,10 @@ public class AdminTabController extends RestrictedBaseController {
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
String userId = UserUtils.getUserSession(request).getOrgUserId();
LOGGER.info(
- "****************************************Logging UserID for Application Lockdown Function*****************************************");
+ "********************Logging UserID for Application Lockdown Function**************************");
LOGGER.info("UserId: " + userId);
LOGGER.info(
- "*********************************************************************************************************************************");
+ "**********************************************************************************************");
JsonNode root = mapper.readTree(request.getReader());
GlobalRoleSettings globalRole =
mapper.readValue(root.get("lockdowndata").toString(), GlobalRoleSettings.class);
@@ -115,19 +127,17 @@ public class AdminTabController extends RestrictedBaseController {
response.setContentType("application / json");
request.setCharacterEncoding(CHARACTER_ENCODING);
- PrintWriter out = response.getWriter();
String responseString = mapper.writeValueAsString(commonClassDao.getData(GlobalRoleSettings.class));
- JSONObject j = new JSONObject("{descriptiveScopeDictionaryDatas: " + responseString + "}");
- out.write(j.toString());
+ response.getWriter().write(new JSONObject("{descriptiveScopeDictionaryDatas: " + responseString
+ + "}").toString());
return null;
} catch (Exception e) {
LOGGER.error("Exception Occured" + e);
response.setCharacterEncoding(CHARACTER_ENCODING);
request.setCharacterEncoding(CHARACTER_ENCODING);
- PrintWriter out = response.getWriter();
- out.write(PolicyUtils.CATCH_EXCEPTION);
+ response.getWriter().write(PolicyUtils.CATCH_EXCEPTION);
}
return null;
}