- JSONObject j = new JSONObject("{safePolicyWarningDatas: " + responseString + "}");
-
- out.write(j.toString());
-
- return null;
- } catch (Exception e) {
+ String responseString = "";
+ if(duplicateflag){
+ responseString = DUPLICATE;
+ }else{
+ responseString = mapper.writeValueAsString(commonClassDao.getData(SafePolicyWarning.class));
+ }
+
+ if (fromAPI) {
+ if (responseString!=null && !responseString.equals(DUPLICATE)) {
+ if(isFakeUpdate){
+ responseString = "Exists";
+ } else {
+ responseString = "Success";
+ }
+ }
+ ModelAndView result = new ModelAndView();
+ result.setViewName(responseString);
+ return result;
+ } else {
+ response.setCharacterEncoding("UTF-8");
+ response.setContentType("application / json");
+ request.setCharacterEncoding("UTF-8");
+
+ PrintWriter out = response.getWriter();
+ JSONObject j = new JSONObject("{safePolicyWarningDatas: " + responseString + "}");
+ out.write(j.toString());
+ return null;
+ }
+
+ }catch (Exception e) {