aboutsummaryrefslogtreecommitdiffstats
path: root/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/ConsoleAndApiService.java
diff options
context:
space:
mode:
Diffstat (limited to 'ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/ConsoleAndApiService.java')
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/ConsoleAndApiService.java138
1 files changed, 67 insertions, 71 deletions
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/ConsoleAndApiService.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/ConsoleAndApiService.java
index 52e4060b5..16340e5fe 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/ConsoleAndApiService.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/ConsoleAndApiService.java
@@ -3,6 +3,7 @@
* ONAP-PAP-REST
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +23,7 @@ package org.onap.policy.pap.xacml.rest;
import com.att.research.xacml.api.pap.PAPException;
import com.fasterxml.jackson.databind.ObjectMapper;
+
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
@@ -32,16 +34,18 @@ import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;
+
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.onap.policy.common.logging.ONAPLoggingContext;
+
+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.common.logging.flexlogger.Logger;
-import org.onap.policy.pap.xacml.rest.components.PolicyDBDao;
-import org.onap.policy.pap.xacml.rest.components.PolicyDBDaoTransaction;
+import org.onap.policy.pap.xacml.rest.components.PolicyDbDao;
+import org.onap.policy.pap.xacml.rest.components.PolicyDbDaoTransaction;
import org.onap.policy.pap.xacml.rest.handler.PushPolicyHandler;
import org.onap.policy.xacml.api.XACMLErrorConstants;
import org.onap.policy.xacml.api.pap.OnapPDP;
@@ -53,6 +57,15 @@ import org.onap.policy.xacml.std.pap.StdPDPPolicy;
public class ConsoleAndApiService {
+ private static final String SPACE_UNIMPLEMENTED = " UNIMPLEMENTED";
+ private static final String XACMLPAPSERVLET_DO_AC_PUT_COMMIT_TRANS = "XACMLPapServlet doACPut commitTransaction";
+ private static final String UNIMPLEMENTED = "UNIMPLEMENTED";
+ private static final String APPLICATION_JSON = "application/json";
+ private static final String CONTENT_TYPE = "content-type";
+ private static final String TO_GROUP = ",to group=";
+ private static final String PDP_ID = "pdpId";
+ private static final String XACML_PAP_SERVLET_DO_AC_PUT = "XACMLPapServlet.doACPut";
+ private static final String UNKNOWN_GROUP_ID = "Unknown groupId '";
private static final Logger LOGGER = FlexLogger.getLogger(ConsoleAndApiService.class);
private static final Logger auditLogger = FlexLogger.getLogger("auditLogger");
private static final String ADD_GROUP_ERROR = "addGroupError";
@@ -79,8 +92,8 @@ public class ConsoleAndApiService {
* @throws IOException Signals that an I/O exception has occurred.
*/
public void doAcPost(HttpServletRequest request, HttpServletResponse response, String groupId,
- ONAPLoggingContext loggingContext, PAPPolicyEngine papEngine) throws IOException {
- PolicyDBDaoTransaction doAcPostTransaction = null;
+ OnapLoggingContext loggingContext, PAPPolicyEngine papEngine) throws IOException {
+ PolicyDbDaoTransaction doAcPostTransaction = null;
try {
String groupName = request.getParameter("groupName");
String groupDescription = request.getParameter("groupDescription");
@@ -98,9 +111,9 @@ public class ConsoleAndApiService {
} catch (UnsupportedEncodingException e) {
LOGGER.error(e);
}
- PolicyDBDaoTransaction newGroupTransaction = XACMLPapServlet.getPolicyDbDao().getNewTransaction();
+ PolicyDbDaoTransaction newGroupTransaction = XACMLPapServlet.getPolicyDbDao().getNewTransaction();
try {
- newGroupTransaction.createGroup(PolicyDBDao.createNewPDPGroupId(unescapedName), unescapedName,
+ newGroupTransaction.createGroup(PolicyDbDao.createNewPdpGroupId(unescapedName), unescapedName,
unescapedDescription, PAPSERVLETDOACPOST);
papEngine.newGroup(unescapedName, unescapedDescription);
loggingContext.metricStarted();
@@ -134,7 +147,7 @@ public class ConsoleAndApiService {
LOGGER.error(e);
}
if (group == null) {
- String message = "Unknown groupId '" + groupId + "'";
+ String message = UNKNOWN_GROUP_ID + groupId + "'";
// for fixing Header Manipulation of Fortify issue
if (!message.matches(REGEX)) {
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
@@ -168,7 +181,7 @@ public class ConsoleAndApiService {
StdPDPGroup updatedGroup = null;
StdPDPPolicy policyForSafetyCheck = new StdPDPPolicy();
for (String policyId : policyIdList) {
- PolicyDBDaoTransaction addPolicyToGroupTransaction =
+ PolicyDbDaoTransaction addPolicyToGroupTransaction =
XACMLPapServlet.getPolicyDbDao().getNewTransaction();
try {
// Copying the policy to the file system and updating groups
@@ -224,13 +237,13 @@ public class ConsoleAndApiService {
*/
// Get new transaction to perform updateGroup()
- PolicyDBDaoTransaction acPutTransaction = XACMLPapServlet.getPolicyDbDao().getNewTransaction();
+ PolicyDbDaoTransaction acPutTransaction = XACMLPapServlet.getPolicyDbDao().getNewTransaction();
try {
// Assume that this is an update of an existing PDP
// Group
loggingContext.setServiceName("PolicyEngineAPI:PAP.updateGroup");
try {
- acPutTransaction.updateGroup(updatedGroup, "XACMLPapServlet.doACPut", userId);
+ acPutTransaction.updateGroup(updatedGroup, XACML_PAP_SERVLET_DO_AC_PUT, userId);
} catch (Exception e) {
PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, XACMLPAPSERVLET,
" Error occurred when notifying PAPs of a group change: " + e);
@@ -276,8 +289,6 @@ public class ConsoleAndApiService {
loggingContext.transactionEnded();
auditLogger.info(SUCCESS);
LOGGER.info(TRANSENDED);
-
- return;
} else if (request.getParameter("default") != null) {
// Args: group=<groupId> default=true <= make default
// change the current default group to be the one identified in
@@ -289,7 +300,7 @@ public class ConsoleAndApiService {
// It should never be the case that multiple groups are
// currently marked as the default, but protect against that
// anyway.
- PolicyDBDaoTransaction setDefaultGroupTransaction =
+ PolicyDbDaoTransaction setDefaultGroupTransaction =
XACMLPapServlet.getPolicyDbDao().getNewTransaction();
try {
setDefaultGroupTransaction.changeDefaultGroup(group, PAPSERVLETDOACPOST);
@@ -313,20 +324,19 @@ public class ConsoleAndApiService {
}
auditLogger.info(SUCCESS);
LOGGER.info(TRANSENDED);
- return;
- } else if (request.getParameter("pdpId") != null) {
+ } else if (request.getParameter(PDP_ID) != null) {
doAcPostTransaction = XACMLPapServlet.getPolicyDbDao().getNewTransaction();
// Args: group=<groupId> pdpId=<pdpId> <= move PDP to group
loggingContext.setServiceName("AC:PAP.movePDP");
- String pdpId = request.getParameter("pdpId");
+ String pdpId = request.getParameter(PDP_ID);
OnapPDP pdp = papEngine.getPDP(pdpId);
- OnapPDPGroup originalGroup = papEngine.getPDPGroup(pdp);
+ final OnapPDPGroup originalGroup = papEngine.getPDPGroup(pdp);
try {
doAcPostTransaction.movePdp(pdp, group, PAPSERVLETDOACPOST);
} catch (Exception e) {
doAcPostTransaction.rollbackTransaction();
PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, XACMLPAPSERVLET,
- " Error while moving pdp in the database: " + "pdp=" + pdp.getId() + ",to group="
+ " Error while moving pdp in the database: " + "pdp=" + pdp.getId() + TO_GROUP
+ group.getId());
throw new PAPException(e.getMessage());
}
@@ -348,14 +358,12 @@ public class ConsoleAndApiService {
loggingContext.transactionEnded();
auditLogger.info(SUCCESS);
PolicyLogger.audit(TRANSENDED);
- return;
}
} catch (PAPException e) {
PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, XACMLPAPSERVLET, " AC POST exception");
loggingContext.transactionEnded();
PolicyLogger.audit(TRANSACTIONFAILED);
setResponseError(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
- return;
}
}
@@ -370,10 +378,10 @@ public class ConsoleAndApiService {
* @throws IOException Signals that an I/O exception has occurred.
*/
public void doAcGet(HttpServletRequest request, HttpServletResponse response, String groupId,
- ONAPLoggingContext loggingContext, PAPPolicyEngine papEngine) throws IOException {
+ OnapLoggingContext loggingContext, PAPPolicyEngine papEngine) throws IOException {
try {
String parameterDefault = request.getParameter("default");
- String pdpId = request.getParameter("pdpId");
+ String pdpId = request.getParameter(PDP_ID);
String pdpGroup = request.getParameter("getPDPGroup");
if ("".equals(groupId)) {
// request IS from AC but does not identify a group by name
@@ -388,7 +396,7 @@ public class ConsoleAndApiService {
LOGGER.debug("GET Default group req from '" + request.getRequestURL() + "'");
}
response.setStatus(HttpServletResponse.SC_OK);
- response.setHeader("content-type", "application/json");
+ response.setHeader(CONTENT_TYPE, APPLICATION_JSON);
try {
response.getOutputStream().close();
} catch (IOException e) {
@@ -417,7 +425,7 @@ public class ConsoleAndApiService {
LOGGER.debug("GET pdp '" + pdpId + "' req from '" + request.getRequestURL() + "'");
}
response.setStatus(HttpServletResponse.SC_OK);
- response.setHeader("content-type", "application/json");
+ response.setHeader(CONTENT_TYPE, APPLICATION_JSON);
try {
response.getOutputStream().close();
} catch (IOException e) {
@@ -444,7 +452,7 @@ public class ConsoleAndApiService {
LOGGER.debug("GET PDP '" + pdpId + "' Group req from '" + request.getRequestURL() + "'");
}
response.setStatus(HttpServletResponse.SC_OK);
- response.setHeader("content-type", "application/json");
+ response.setHeader(CONTENT_TYPE, APPLICATION_JSON);
try {
response.getOutputStream().close();
} catch (IOException e) {
@@ -475,7 +483,7 @@ public class ConsoleAndApiService {
LOGGER.debug("GET All groups req");
}
response.setStatus(HttpServletResponse.SC_OK);
- response.setHeader("content-type", "application/json");
+ response.setHeader(CONTENT_TYPE, APPLICATION_JSON);
try {
response.getOutputStream().close();
} catch (IOException e) {
@@ -496,7 +504,7 @@ public class ConsoleAndApiService {
LOGGER.error(e);
}
if (group == null) {
- String message = "Unknown groupId '" + groupId + "'";
+ String message = UNKNOWN_GROUP_ID + groupId + "'";
// for fixing Header Manipulation of Fortify issue
if (!message.matches(REGEX)) {
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
@@ -529,7 +537,7 @@ public class ConsoleAndApiService {
LOGGER.debug("GET group '" + group.getId() + "' req from '" + request.getRequestURL() + "'");
}
response.setStatus(HttpServletResponse.SC_OK);
- response.setHeader("content-type", "application/json");
+ response.setHeader(CONTENT_TYPE, APPLICATION_JSON);
try {
response.getOutputStream().close();
} catch (IOException e) {
@@ -551,13 +559,12 @@ public class ConsoleAndApiService {
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " UNIMPLEMENTED ");
loggingContext.transactionEnded();
PolicyLogger.audit(TRANSACTIONFAILED);
- setResponseError(response, HttpServletResponse.SC_BAD_REQUEST, "UNIMPLEMENTED");
+ setResponseError(response, HttpServletResponse.SC_BAD_REQUEST, UNIMPLEMENTED);
} catch (PAPException e) {
PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, XACMLPAPSERVLET, " AC Get exception");
loggingContext.transactionEnded();
PolicyLogger.audit(TRANSACTIONFAILED);
setResponseError(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
- return;
}
}
@@ -572,8 +579,8 @@ public class ConsoleAndApiService {
* @throws IOException Signals that an I/O exception has occurred.
*/
public void doAcPut(HttpServletRequest request, HttpServletResponse response, String groupId,
- ONAPLoggingContext loggingContext, PAPPolicyEngine papEngine) throws IOException {
- PolicyDBDaoTransaction acPutTransaction = XACMLPapServlet.getPolicyDbDao().getNewTransaction();
+ OnapLoggingContext loggingContext, PAPPolicyEngine papEngine) throws IOException {
+ PolicyDbDaoTransaction acPutTransaction = XACMLPapServlet.getPolicyDbDao().getNewTransaction();
try {
String userId = request.getParameter("userId");
// for PUT operations the group may or may not need to exist before
@@ -584,7 +591,7 @@ public class ConsoleAndApiService {
// for remaining operations the group must exist before the
// operation can be done
if (group == null) {
- String message = "Unknown groupId '" + groupId + "'";
+ String message = UNKNOWN_GROUP_ID + groupId + "'";
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " " + message);
loggingContext.transactionEnded();
PolicyLogger.audit(TRANSACTIONFAILED);
@@ -605,11 +612,10 @@ public class ConsoleAndApiService {
auditLogger.info(SUCCESS);
PolicyLogger.audit(TRANSENDED);
acPutTransaction.rollbackTransaction();
- return;
- } else if (request.getParameter("pdpId") != null) {
+ } else if (request.getParameter(PDP_ID) != null) {
// ARGS: group=<groupId> pdpId=<pdpId/URL> <= create a new PDP
// or Update an Existing one
- String pdpId = request.getParameter("pdpId");
+ String pdpId = request.getParameter(PDP_ID);
if (papEngine.getPDP(pdpId) == null) {
loggingContext.setServiceName("AC:PAP.createPDP");
} else {
@@ -658,18 +664,18 @@ public class ConsoleAndApiService {
// this is a request to create a new PDP object
try {
acPutTransaction.addPdpToGroup(pdp.getId(), group.getId(), pdp.getName(),
- pdp.getDescription(), pdp.getJmxPort(), "XACMLPapServlet.doACPut");
+ pdp.getDescription(), pdp.getJmxPort(), XACML_PAP_SERVLET_DO_AC_PUT);
papEngine.newPDP(pdp.getId(), group, pdp.getName(), pdp.getDescription(), pdp.getJmxPort());
} catch (Exception e) {
PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, XACMLPAPSERVLET,
" Error while adding pdp to group in the database: " + "pdp=" + (pdp.getId())
- + ",to group=" + group.getId());
+ + TO_GROUP + group.getId());
throw new PAPException(e.getMessage());
}
} else {
// this is a request to update the pdp
try {
- acPutTransaction.updatePdp(pdp, "XACMLPapServlet.doACPut");
+ acPutTransaction.updatePdp(pdp, XACML_PAP_SERVLET_DO_AC_PUT);
papEngine.updatePDP(pdp);
} catch (Exception e) {
PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, XACMLPAPSERVLET,
@@ -688,15 +694,14 @@ public class ConsoleAndApiService {
loggingContext.metricStarted();
acPutTransaction.commitTransaction();
loggingContext.metricEnded();
- PolicyLogger.metrics("XACMLPapServlet doACPut commitTransaction");
+ PolicyLogger.metrics(XACMLPAPSERVLET_DO_AC_PUT_COMMIT_TRANS);
loggingContext.transactionEnded();
auditLogger.info(SUCCESS);
PolicyLogger.audit(TRANSENDED);
- return;
} else {
try {
PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, XACMLPAPSERVLET,
- " Error while adding pdp to group in the database: " + "pdp=null" + ",to group="
+ " Error while adding pdp to group in the database: " + "pdp=null" + TO_GROUP
+ group.getId());
throw new PAPException("PDP is null");
} catch (Exception e) {
@@ -708,12 +713,11 @@ public class ConsoleAndApiService {
// <= add a PIP to pip config, or replace it if it already
// exists (lenient operation)
loggingContext.setServiceName("AC:PAP.putPIP");
- PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + " UNIMPLEMENTED");
+ PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + UNIMPLEMENTED);
loggingContext.transactionEnded();
PolicyLogger.audit(TRANSACTIONFAILED);
- setResponseError(response, HttpServletResponse.SC_BAD_REQUEST, "UNIMPLEMENTED");
+ setResponseError(response, HttpServletResponse.SC_BAD_REQUEST, UNIMPLEMENTED);
acPutTransaction.rollbackTransaction();
- return;
} else {
// Assume that this is an update of an existing PDP Group
// ARGS: group=<groupId> <= Update an Existing Group
@@ -739,7 +743,7 @@ public class ConsoleAndApiService {
} catch (Exception e) {
LOGGER.error(e);
}
- if (objectFromJson == null || !(objectFromJson instanceof StdPDPGroup)
+ if (!(objectFromJson instanceof StdPDPGroup)
|| !((StdPDPGroup) objectFromJson).getId().equals(group.getId())) {
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " Group update had bad input. id="
+ group.getId() + " objectFromJSON=" + objectFromJson);
@@ -760,7 +764,7 @@ public class ConsoleAndApiService {
if ("delete".equals(((StdPDPGroup) objectFromJson).getOperation())) {
acPutTransaction.updateGroup((StdPDPGroup) objectFromJson, "XACMLPapServlet.doDelete", userId);
} else {
- acPutTransaction.updateGroup((StdPDPGroup) objectFromJson, "XACMLPapServlet.doACPut", userId);
+ acPutTransaction.updateGroup((StdPDPGroup) objectFromJson, XACML_PAP_SERVLET_DO_AC_PUT, userId);
}
} catch (Exception e) {
PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW + " Error while updating group in the database: "
@@ -786,13 +790,12 @@ public class ConsoleAndApiService {
loggingContext.metricStarted();
acPutTransaction.commitTransaction();
loggingContext.metricEnded();
- PolicyLogger.metrics("XACMLPapServlet doACPut commitTransaction");
+ PolicyLogger.metrics(XACMLPAPSERVLET_DO_AC_PUT_COMMIT_TRANS);
// Group changed, which might include changing the policies
getPapInstance().groupChanged(group, loggingContext);
loggingContext.transactionEnded();
auditLogger.info(SUCCESS);
PolicyLogger.audit(TRANSENDED);
- return;
}
} catch (PAPException e) {
LOGGER.debug(e);
@@ -801,7 +804,6 @@ public class ConsoleAndApiService {
loggingContext.transactionEnded();
PolicyLogger.audit(TRANSACTIONFAILED);
setResponseError(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
- return;
}
}
@@ -816,19 +818,19 @@ public class ConsoleAndApiService {
* @throws IOException Signals that an I/O exception has occurred.
*/
public void doAcDelete(HttpServletRequest request, HttpServletResponse response, String groupId,
- ONAPLoggingContext loggingContext, PAPPolicyEngine papEngine) throws IOException {
- PolicyDBDaoTransaction removePdpOrGroupTransaction = XACMLPapServlet.getPolicyDbDao().getNewTransaction();
+ OnapLoggingContext loggingContext, PAPPolicyEngine papEngine) throws IOException {
+ PolicyDbDaoTransaction removePdpOrGroupTransaction = XACMLPapServlet.getPolicyDbDao().getNewTransaction();
try {
// for all DELETE operations the group must exist before the
// operation can be done
loggingContext.setServiceName("AC:PAP.delete");
OnapPDPGroup group = papEngine.getGroup(groupId);
if (group == null) {
- String message = "Unknown groupId '" + groupId + "'";
+ String message = UNKNOWN_GROUP_ID + groupId + "'";
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " " + message);
loggingContext.transactionEnded();
PolicyLogger.audit(TRANSACTIONFAILED);
- setResponseError(response, HttpServletResponse.SC_NOT_FOUND, "Unknown groupId '" + groupId + "'");
+ setResponseError(response, HttpServletResponse.SC_NOT_FOUND, UNKNOWN_GROUP_ID + groupId + "'");
removePdpOrGroupTransaction.rollbackTransaction();
return;
}
@@ -838,15 +840,14 @@ public class ConsoleAndApiService {
// group=<groupId> policy=<policyId> [delete=<true|false>] <=
// delete policy file from group
loggingContext.setServiceName("AC:PAP.deletePolicy");
- PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + " UNIMPLEMENTED");
+ PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + SPACE_UNIMPLEMENTED);
loggingContext.transactionEnded();
PolicyLogger.audit(TRANSACTIONFAILED);
- setResponseError(response, HttpServletResponse.SC_BAD_REQUEST, "UNIMPLEMENTED");
+ setResponseError(response, HttpServletResponse.SC_BAD_REQUEST, UNIMPLEMENTED);
removePdpOrGroupTransaction.rollbackTransaction();
- return;
- } else if (request.getParameter("pdpId") != null) {
+ } else if (request.getParameter(PDP_ID) != null) {
// ARGS: group=<groupId> pdpId=<pdpId> <= delete PDP
- String pdpId = request.getParameter("pdpId");
+ String pdpId = request.getParameter(PDP_ID);
OnapPDP pdp = papEngine.getPDP(pdpId);
removePdpFromGroup(removePdpOrGroupTransaction, pdp, papEngine);
// adjust the status of the group, which may have changed when
@@ -859,21 +860,19 @@ public class ConsoleAndApiService {
loggingContext.metricStarted();
removePdpOrGroupTransaction.commitTransaction();
loggingContext.metricEnded();
- PolicyLogger.metrics("XACMLPapServlet doACPut commitTransaction");
+ PolicyLogger.metrics(XACMLPAPSERVLET_DO_AC_PUT_COMMIT_TRANS);
loggingContext.transactionEnded();
auditLogger.info(SUCCESS);
PolicyLogger.audit(TRANSENDED);
- return;
} else if (request.getParameter("pipId") != null) {
// group=<groupId> pipId=<pipEngineId> <= delete PIP config for
// given engine
loggingContext.setServiceName("AC:PAP.deletePIPConfig");
- PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + " UNIMPLEMENTED");
+ PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + SPACE_UNIMPLEMENTED);
loggingContext.transactionEnded();
PolicyLogger.audit(TRANSACTIONFAILED);
- setResponseError(response, HttpServletResponse.SC_BAD_REQUEST, "UNIMPLEMENTED");
+ setResponseError(response, HttpServletResponse.SC_BAD_REQUEST, UNIMPLEMENTED);
removePdpOrGroupTransaction.rollbackTransaction();
- return;
} else {
// ARGS: group=<groupId> movePDPsToGroupId=<movePDPsToGroupId>
// <= delete a group and move all its PDPs to the given group
@@ -901,11 +900,10 @@ public class ConsoleAndApiService {
loggingContext.metricStarted();
removePdpOrGroupTransaction.commitTransaction();
loggingContext.metricEnded();
- PolicyLogger.metrics("XACMLPapServlet doACPut commitTransaction");
+ PolicyLogger.metrics(XACMLPAPSERVLET_DO_AC_PUT_COMMIT_TRANS);
loggingContext.transactionEnded();
auditLogger.info(SUCCESS);
PolicyLogger.audit(TRANSENDED);
- return;
}
} catch (PAPException e) {
removePdpOrGroupTransaction.rollbackTransaction();
@@ -913,11 +911,10 @@ public class ConsoleAndApiService {
loggingContext.transactionEnded();
PolicyLogger.audit(TRANSACTIONFAILED);
setResponseError(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
- return;
}
}
- private void deleteGroup(PolicyDBDaoTransaction removePdpOrGroupTransaction, OnapPDPGroup group,
+ private void deleteGroup(PolicyDbDaoTransaction removePdpOrGroupTransaction, OnapPDPGroup group,
OnapPDPGroup moveToGroup, PAPPolicyEngine papEngine) throws PAPException {
try {
removePdpOrGroupTransaction.deleteGroup(group, moveToGroup, "XACMLPapServlet.doACDelete");
@@ -929,7 +926,7 @@ public class ConsoleAndApiService {
}
}
- private void removePdpFromGroup(PolicyDBDaoTransaction removePdpOrGroupTransaction, OnapPDP pdp,
+ private void removePdpFromGroup(PolicyDbDaoTransaction removePdpOrGroupTransaction, OnapPDP pdp,
PAPPolicyEngine papEngine) throws PAPException {
try {
removePdpOrGroupTransaction.removePdpFromGroup(pdp.getId(), "XACMLPapServlet.doACDelete");
@@ -959,6 +956,5 @@ public class ConsoleAndApiService {
} catch (IOException e) {
LOGGER.error("Error setting Error response Header ", e);
}
- return;
}
}