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%2Fcontroller%2FPushPolicyController.java;h=b7b63a9e086c1f62b8f1e2070f69c7feed0742f2;hb=e4ac1ef3c51fc9afe44849ada5bea8c3d6057897;hp=17fce7142bab6ceea0647babcc21d12761e7e7b1;hpb=2903daf20f5e473a96a36342151a26e9f2e55005;p=policy%2Fengine.git diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/PushPolicyController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/PushPolicyController.java index 17fce7142..b7b63a9e0 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/PushPolicyController.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/PushPolicyController.java @@ -24,6 +24,7 @@ import com.att.research.xacml.api.pap.PAPException; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; + import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; @@ -32,9 +33,11 @@ import java.io.ObjectOutputStream; import java.net.URI; import java.util.List; import java.util.UUID; + import javax.script.SimpleBindings; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import org.onap.policy.common.logging.eelf.MessageCodes; import org.onap.policy.common.logging.eelf.PolicyLogger; import org.onap.policy.common.logging.flexlogger.FlexLogger; @@ -93,8 +96,8 @@ public class PushPolicyController { LOGGER.info("No request ID provided, sending generated ID: " + requestID); } LOGGER.info("Push policy Request to get the selectedPolicy : " + root.asText()); - String policyVersionName = policyScope.replace(".", File.separator) + File.separator - + filePrefix + policyName; + String policyVersionName = + policyScope.replace(".", File.separator) + File.separator + filePrefix + policyName; List policyVersionObject = commonClassDao.getDataById(PolicyVersion.class, policyNames, policyVersionName); if (policyVersionObject != null) { @@ -120,10 +123,10 @@ public class PushPolicyController { } private void addPolicyToGroup(String policyScope, String policyID, String policyName, String pdpGroup, - HttpServletResponse response) { + HttpServletResponse response) { StdPDPGroup selectedPDPGroup = null; StdPDPPolicy selectedPolicy = null; - //Get the selected PDP Group to push the policy + // Get the selected PDP Group to push the policy try { selectedPDPGroup = (StdPDPGroup) XACMLPapServlet.getPAPEngine().getGroup(pdpGroup); } catch (PAPException e1) { @@ -147,16 +150,15 @@ public class PushPolicyController { params.put("scope", policyScope); params.put(policyNames, policyName.substring(policyScope.length() + 1)); List createPolicyQueryList = commonClassDao.getDataByQuery(createPolicyQuery, params); - LOGGER.info("addPolicyToGroup:Total execution time to retrieve " + policyNames - + " from PolicyEntity"); + LOGGER.info("addPolicyToGroup:Total execution time to retrieve " + policyNames + " from PolicyEntity"); PolicyEntity policyEntity = null; if (!createPolicyQueryList.isEmpty()) { policyEntity = (PolicyEntity) createPolicyQueryList.get(0); } else { PolicyLogger - .error("Somehow, more than one policy with the same scope, name, and deleted status were found in" + - " the database"); + .error("Somehow, more than one policy with the same scope, name, and deleted status were found in" + + " the database"); String message = "Unknown Policy '" + policyName + "'"; PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " " + message); response.addHeader(errorMsg, "unknownPolicy");