- ConditionType condition = ((RuleType) object).getCondition();
- if (condition != null) {
- ApplyType decisionApply = (ApplyType) condition.getExpression().getValue();
- decisionApply = (ApplyType) decisionApply.getExpression().get(0).getValue();
- ruleAlgoirthmTracker = new LinkedList<>();
- if (policyAdapter.getRuleProvider() != null
- && (GUARD_YAML.equals(policyAdapter.getRuleProvider())
- || (GUARD_BL_YAML.equals(policyAdapter.getRuleProvider()))
- || (GUARD_MIN_MAX.equals(policyAdapter.getRuleProvider())))){
- YAMLParams yamlParams = new YAMLParams();
- for (int i = 0; i < attributeList.size(); i++) {
- Map<String, String> map = (Map<String, String>) attributeList.get(i);
- if ("actor".equals(map.get("key"))) {
- yamlParams.setActor(map.get("value"));
- } else if ("recipe".equals(map.get("key"))) {
- yamlParams.setRecipe(map.get("value"));
- } else if ("target".equals(map.get("key"))) {
- yamlParams.setTargets(Arrays.asList(map.get("value").split("\\|")));
- } else if ("clname".equals(map.get("key"))) {
- yamlParams.setClname(map.get("value"));
- } else if ("min".equals(map.get("key"))) {
- yamlParams.setMin(map.get("value"));
- } else if ("max".equals(map.get("key"))) {
- yamlParams.setMax(map.get("value"));
- }
- }
- ApplyType apply =
- (ApplyType) ((ApplyType) decisionApply.getExpression().get(0).getValue())
- .getExpression().get(0).getValue();
- yamlParams.setGuardActiveStart(
- ((AttributeValueType) apply.getExpression().get(1).getValue()).getContent()
- .get(0).toString());
- yamlParams.setGuardActiveEnd(
- ((AttributeValueType) apply.getExpression().get(2).getValue()).getContent()
- .get(0).toString());
- if (GUARD_BL_YAML.equals(policyAdapter.getRuleProvider())) {
- apply = (ApplyType) ((ApplyType) ((ApplyType) decisionApply.getExpression()
- .get(0).getValue()).getExpression().get(1).getValue()).getExpression()
- .get(2).getValue();
- Iterator<JAXBElement<?>> attributes = apply.getExpression().iterator();
- List<String> blackList = new ArrayList<>();
- while (attributes.hasNext()) {
- blackList.add(((AttributeValueType) attributes.next().getValue())
- .getContent().get(0).toString());
- }
- yamlParams.setBlackList(blackList);
- if ("Use File Upload".equals(policyAdapter.getBlackListEntryType())) {
- policyAdapter.setBlackListEntries(blackList);
- }
- } else {
- ApplyType timeWindowSection = (ApplyType) ((ApplyType) decisionApply
- .getExpression().get(0).getValue()).getExpression().get(1).getValue();
- yamlParams.setLimit(((AttributeValueType) timeWindowSection.getExpression()
- .get(1).getValue()).getContent().get(0).toString());
- String timeWindow = ((AttributeDesignatorType) ((ApplyType) timeWindowSection
- .getExpression().get(0).getValue()).getExpression().get(0).getValue())
- .getIssuer();
- yamlParams.setTimeUnits(timeWindow.substring(timeWindow.lastIndexOf(':') + 1));
- yamlParams.setTimeWindow(timeWindow.substring(timeWindow.indexOf(":tw:") + 4,
- timeWindow.lastIndexOf(':')));
- }
- policyAdapter.setYamlparams(yamlParams);
- policyAdapter.setAttributes(new ArrayList<Object>());
- policyAdapter.setRuleAlgorithmschoices(new ArrayList<Object>());
- break;
+ ApplyType apply =
+ (ApplyType) ((ApplyType) decisionApply.getExpression().get(0).getValue())
+ .getExpression().get(0).getValue();
+ yamlParams.setGuardActiveStart(
+ ((AttributeValueType) apply.getExpression().get(1).getValue()).getContent()
+ .get(0).toString());
+ yamlParams.setGuardActiveEnd(
+ ((AttributeValueType) apply.getExpression().get(2).getValue()).getContent()
+ .get(0).toString());
+ if (GUARD_BL_YAML.equals(policyAdapter.getRuleProvider())) {
+ apply = (ApplyType) ((ApplyType) ((ApplyType) decisionApply.getExpression()
+ .get(0).getValue()).getExpression().get(1).getValue()).getExpression()
+ .get(2).getValue();
+ List<String> blackList = new ArrayList<>();
+ for (JAXBElement<?> attr : apply.getExpression()) {
+ blackList.add(((AttributeValueType) attr.getValue())
+ .getContent().get(0).toString());