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%2Fcomponents%2FDecisionPolicy.java;h=d870ca86c1606b7dd1d004865adbba61f3b4b971;hb=b0f132227b0d77ea847f40d07f57d9d053c1555e;hp=6e43c967cb58b31a1ed96faca8271248bf1dc29a;hpb=24c6b1682bb59691f8d5e631b1074355b7d82a54;p=policy%2Fengine.git diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/DecisionPolicy.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/DecisionPolicy.java index 6e43c967c..d870ca86c 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/DecisionPolicy.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/DecisionPolicy.java @@ -63,6 +63,7 @@ import org.onap.policy.xacml.api.XACMLErrorConstants; import org.onap.policy.xacml.std.pip.engines.aaf.AAFEngine; import org.onap.policy.xacml.util.XACMLPolicyScanner; +import com.att.research.xacml.api.XACML3; import com.att.research.xacml.api.pap.PAPException; import com.att.research.xacml.std.IdentifierImpl; @@ -285,7 +286,7 @@ public class DecisionPolicy extends Policy { activeTimeRange.put("end", yamlParams.get("guardActiveEnd")); String blackListString = yamlParams.get("blackList"); List blackList = null; - if(blackListString!=null){ + if(blackListString!=null && !blackListString.trim().isEmpty()){ if (blackListString.contains(",")){ blackList = Arrays.asList(blackListString.split(",")); } @@ -303,6 +304,9 @@ public class DecisionPolicy extends Policy { templateFile = new File(classLoader.getResource(XACML_BLGUARD_TEMPLATE).getFile()); xacmlTemplatePath = templateFile.toPath(); cons.setActive_time_range(activeTimeRange); + if(blackList==null || blackList.isEmpty()){ + throw new BuilderException("blackList is required"); + } cons.setBlacklist(blackList); break; default: @@ -420,7 +424,6 @@ public class DecisionPolicy extends Policy { // Values for AAF Provider are here for XML Creation. ConditionType condition = new ConditionType(); ApplyType decisionApply = new ApplyType(); - String selectedFunction = "boolean-equal"; AttributeValueType value1 = new AttributeValueType(); value1.setDataType(BOOLEAN_DATATYPE); @@ -436,7 +439,7 @@ public class DecisionPolicy extends Policy { innerDecisionApply.setFunctionId(FUNCTION_BOOLEAN_ONE_AND_ONLY); innerDecisionApply.getExpression().add(new ObjectFactory().createAttributeDesignator(value2)); - decisionApply.setFunctionId(dropDownMap.get(selectedFunction)); + decisionApply.setFunctionId(XACML3.ID_FUNCTION_BOOLEAN_EQUAL.stringValue()); decisionApply.getExpression().add(new ObjectFactory().createAttributeValue(value1)); decisionApply.getExpression().add(new ObjectFactory().createApply(innerDecisionApply)); condition.setExpression(new ObjectFactory().createApply(decisionApply));