- public ModelAndView removeRiskTypeDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
- try {
- ObjectMapper mapper = new ObjectMapper();
- mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- JsonNode root = mapper.readTree(request.getReader());
- RiskType onapData = mapper.readValue(root.get("data").toString(), RiskType.class);
- commonClassDao.delete(onapData);
- response.setCharacterEncoding(utf8);
- response.setContentType(applicationJsonContentType);
- request.setCharacterEncoding(utf8);
-
- PrintWriter out = response.getWriter();
-
- String responseString = mapper.writeValueAsString(commonClassDao.getData(RiskType.class));
- JSONObject j = new JSONObject("{riskTypeDictionaryDatas: " + responseString + "}");
- out.write(j.toString());
-
- return null;
- } catch (Exception e) {
- LOGGER.error(e);
- response.setCharacterEncoding(utf8);
- request.setCharacterEncoding(utf8);
- PrintWriter out = response.getWriter();
- out.write(PolicyUtils.CATCH_EXCEPTION);
- }
- return null;
+ public void removeRiskTypeDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
+ DictionaryUtils utils = getDictionaryUtilsInstance();
+ utils.removeData(request, response, riskTypeDatas, RiskType.class);