X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=POLICY-SDK-APP%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fadmin%2FPolicyRestController.java;h=507f19820d36807a0e3d37c03ec37e90c9d09511;hb=695d88bd7a987a06173fc4fa13f4135916a79a86;hp=63d0cb29899f1cde3ddbfc0fe0b33b8cc4a54753;hpb=6425d452d8507e9eeeb4da2f9f7051e602af541e;p=policy%2Fengine.git diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyRestController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyRestController.java index 63d0cb298..507f19820 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyRestController.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyRestController.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -384,7 +384,7 @@ public class PolicyRestController extends RestrictedBaseController{ } @RequestMapping(value={"/saveDictionary/*/*"}, method={RequestMethod.POST}) - public ModelAndView saveDictionaryController(HttpServletRequest request, HttpServletResponse response) throws IOException{ + public void saveDictionaryController(HttpServletRequest request, HttpServletResponse response) throws IOException{ String userId = ""; String uri = request.getRequestURI().replace("/saveDictionary", ""); if(uri.startsWith("/")){ @@ -401,12 +401,15 @@ public class PolicyRestController extends RestrictedBaseController{ policyLogger.info("***********************************************************************************************************************************"); String body = callPAP(request, "POST", uri.replaceFirst("/", "").trim()); - response.getWriter().write(body); - return null; + if(body != null && !body.isEmpty()){ + response.getWriter().write(body); + }else{ + response.getWriter().write("Failed"); + } } @RequestMapping(value={"/deleteDictionary/*/*"}, method={RequestMethod.POST}) - public ModelAndView deletetDictionaryController(HttpServletRequest request, HttpServletResponse response) throws IOException { + public void deletetDictionaryController(HttpServletRequest request, HttpServletResponse response) throws IOException { String uri = request.getRequestURI().replace("/deleteDictionary", ""); if(uri.startsWith("/")){ uri = uri.substring(uri.indexOf('/')+1); @@ -419,8 +422,11 @@ public class PolicyRestController extends RestrictedBaseController{ policyLogger.info("*************************************************************************************************************************************"); String body = callPAP(request, "POST", uri.replaceFirst("/", "").trim()); - response.getWriter().write(body); - return null; + if(body != null && !body.isEmpty()){ + response.getWriter().write(body); + }else{ + response.getWriter().write("Failed"); + } } @RequestMapping(value={"/searchDictionary"}, method={RequestMethod.POST}) @@ -471,7 +477,9 @@ public class PolicyRestController extends RestrictedBaseController{ resultList = json.get("policyresult"); }catch(Exception e){ List data = new ArrayList<>(); - data.add("Elastic Search Server is down"); + resultList = json.get("data"); + data.add("Exception"); + data.add(resultList.toString()); resultList = data; policyLogger.error("Exception Occured while searching for Policy in Elastic Database" +e); } @@ -490,5 +498,10 @@ public class PolicyRestController extends RestrictedBaseController{ String uri = "searchPolicy?action=delete&policyName='"+fileName+"'"; callPAP(null, "POST", uri.trim()); } + + public String notifyOtherPAPSToUpdateConfigurations(String mode, String newName, String oldName){ + String uri = "onap/notifyOtherPAPs?action="+mode+"&newPolicyName="+newName+"&oldPolicyName="+oldName+""; + return callPAP(null, "POST", uri.trim()); + } }