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;
decisionPolicy.setTarget(target);
Map<String, String> dynamicFieldDecisionSettings = policyAdapter.getDynamicSettingsMap();
- if(policyAdapter.getRuleProvider()!=null && policyAdapter.getRuleProvider().equals(AAFPROVIDER)){
+ if(policyAdapter.getRuleProvider()!=null && (policyAdapter.getRuleProvider().equals(AAFPROVIDER)||
+ policyAdapter.getRuleProvider().equals(RAINY_DAY))){
dynamicFieldDecisionSettings = new HashMap<>();
}
VariableDefinitionType dynamicVariable = createDynamicVariable(key, value, dataType);
decisionPolicy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().add(dynamicVariable);
}
- Map<String, String> dynamicFieldTreatmentAttributes = policyAdapter.getRainydayMap();
+ Map<String, String> dynamicFieldTreatmentAttributes = policyAdapter.getRainydayMap();
if(policyAdapter.getRuleProvider().equals(RAINY_DAY)){
for(String keyField : dynamicFieldTreatmentAttributes.keySet()) {
String errorcode = keyField;
activeTimeRange.put("end", yamlParams.get("guardActiveEnd"));
String blackListString = yamlParams.get("blackList");
List<String> blackList = null;
- if(blackListString!=null){
+ if(blackListString!=null && !blackListString.trim().isEmpty()){
if (blackListString.contains(",")){
blackList = Arrays.asList(blackListString.split(","));
}
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:
// 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);
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));