X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ONAP-PAP-REST%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fpap%2Fxacml%2Frest%2Fhandler%2FDeleteHandler.java;fp=ONAP-PAP-REST%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fpap%2Fxacml%2Frest%2Fhandler%2FDeleteHandler.java;h=a185054781d77ed1d2f9bf1b3729b916c2b2a63e;hb=7925630b5edc79119f29392edc6ddc84cf7c3757;hp=17fd2c12bd0787ae3fc3a9c5791c23d08a23910c;hpb=c53fa990ea27ec074859eb94bcb7ec6deaa2157b;p=policy%2Fengine.git diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandler.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandler.java index 17fd2c12b..a18505478 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandler.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandler.java @@ -36,6 +36,7 @@ import javax.servlet.http.HttpServletResponse; import org.onap.policy.common.logging.ONAPLoggingContext; import org.onap.policy.common.logging.eelf.MessageCodes; import org.onap.policy.common.logging.eelf.PolicyLogger; +import org.onap.policy.common.logging.flexlogger.FlexLogger; import org.onap.policy.pap.xacml.rest.XACMLPapServlet; import org.onap.policy.pap.xacml.rest.components.PolicyDBDaoTransaction; import org.onap.policy.pap.xacml.rest.elk.client.PolicyElasticSearchController; @@ -50,7 +51,8 @@ import org.onap.policy.xacml.api.XACMLErrorConstants; import org.onap.policy.xacml.api.pap.OnapPDPGroup; import org.onap.policy.xacml.std.pap.StdPAPPolicy; import org.onap.policy.xacml.std.pap.StdPDPGroup; - +import org.onap.policy.common.logging.flexlogger.FlexLogger; +import org.onap.policy.common.logging.flexlogger.Logger; import com.att.research.xacml.api.pap.PAPException; import com.att.research.xacml.api.pap.PDPPolicy; import com.att.research.xacml.util.XACMLProperties; @@ -58,13 +60,14 @@ import com.att.research.xacml.util.XACMLProperties; public class DeleteHandler { private OnapPDPGroup newgroup; - + private static Logger logger = FlexLogger.getLogger(DeleteHandler.class); + private static String papDbDriver = null; private static String papDbUrl = null; private static String papDbUser = null; private static String papDbPassword = null; - public void doAPIDeleteFromPAP(HttpServletRequest request, HttpServletResponse response, ONAPLoggingContext loggingContext) throws Exception { + public static void doAPIDeleteFromPAP(HttpServletRequest request, HttpServletResponse response, ONAPLoggingContext loggingContext) throws IOException, SQLException { // get the request content into a String String json = null; java.util.Scanner scanner = new java.util.Scanner(request.getInputStream()); @@ -188,6 +191,7 @@ public class DeleteHandler { policyVersionDeleted = true; em.remove(pVersion); }catch(Exception e){ + logger.error(e.getMessage(),e); policyVersionDeleted = false; } } @@ -228,6 +232,7 @@ public class DeleteHandler { policyVersionDeleted = true; em.persist(pVersion); }catch(Exception e){ + logger.error(e.getMessage(),e); policyVersionDeleted = false; } }else{ @@ -235,6 +240,7 @@ public class DeleteHandler { policyVersionDeleted = true; em.remove(pVersion); }catch(Exception e){ + logger.error(e.getMessage(),e); policyVersionDeleted = false; } } @@ -274,7 +280,7 @@ public class DeleteHandler { } } - public String deletePolicyEntityData(EntityManager em, PolicyEntity policyEntity) throws SQLException{ + public static String deletePolicyEntityData(EntityManager em, PolicyEntity policyEntity) throws SQLException{ PolicyElasticSearchController controller = new PolicyElasticSearchController(); PolicyRestAdapter policyData = new PolicyRestAdapter(); String policyName = policyEntity.getPolicyName(); @@ -289,12 +295,13 @@ public class DeleteHandler { controller.deleteElk(policyData); em.remove(policyEntity); }catch(Exception e){ + logger.error(e.getMessage(),e); return "error"; } return "success"; } - public boolean checkPolicyGroupEntity(EntityManager em, Connection con, List peResult) throws SQLException{ + public static boolean checkPolicyGroupEntity(EntityManager em, Connection con, List peResult) throws SQLException{ for(Object peData : peResult){ PolicyEntity policyEntity = (PolicyEntity) peData; Statement st = null; @@ -469,7 +476,7 @@ public class DeleteHandler { DeleteHandler instance = (DeleteHandler) deleteHandler.newInstance(); return instance; } catch (Exception e) { - PolicyLogger.error(e.getMessage()); + logger.error(e.getMessage(),e); } return null; }