summaryrefslogtreecommitdiffstats
path: root/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandler.java
diff options
context:
space:
mode:
Diffstat (limited to 'ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandler.java')
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandler.java19
1 files changed, 13 insertions, 6 deletions
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;
}