@Test public void declareRule() { String name = "NAME"; String statusToSet = "STATUS_TO_SET"; String patternType = "TEMPERATURE"; String agendaGroup = "agendaGroup"; String activationGroup = "activationGroup"; List<KiePMMLFieldOperatorValue> orConstraints = Arrays.asList(new KiePMMLFieldOperatorValue(patternType, BOOLEAN_OPERATOR.OR, Collections.singletonList(new KiePMMLOperatorValue(OPERATOR.LESS_THAN, 35)), null), new KiePMMLFieldOperatorValue(patternType, BOOLEAN_OPERATOR.AND, Collections.singletonList(new KiePMMLOperatorValue(OPERATOR.GREATER_THAN, 85)), null)); KiePMMLDroolsRule rule = KiePMMLDroolsRule.builder(name, statusToSet, Collections.emptyList()) .withAgendaGroup(agendaGroup) .withActivationGroup(activationGroup) .withOrConstraints(orConstraints) .build(); KiePMMLDescrRulesFactory.factory(builder).declareRule(rule); assertNotNull(builder.getDescr().getRules()); assertEquals(1, builder.getDescr().getRules().size()); final RuleDescr retrieved = builder.getDescr().getRules().get(0); assertEquals(name, retrieved.getName()); assertEquals(2, retrieved.getAttributes().size()); assertTrue(retrieved.getAttributes().containsKey("agenda-group")); assertEquals(agendaGroup, retrieved.getAttributes().get("agenda-group").getValue()); assertTrue(retrieved.getAttributes().containsKey("activation-group")); assertEquals(activationGroup, retrieved.getAttributes().get("activation-group").getValue()); printGeneratedRules(); }
protected void declareRule(final KiePMMLDroolsRule rule) { logger.trace("declareRule {}", rule); final RuleDescrBuilder ruleBuilder = builder.newRule().name(rule.getName()); if (rule.getAgendaGroup() != null) { declareAgendaGroup(ruleBuilder, rule.getAgendaGroup()); } if (rule.getActivationGroup() != null) { declareActivationGroup(ruleBuilder, rule.getActivationGroup()); } KiePMMLDescrLhsFactory.factory(ruleBuilder.lhs()).declareLhs(rule); KiePMMLDescrRhsFactory.factory(ruleBuilder).declareRhs(rule); }
KiePMMLDescrRulesFactory { protected void declareRule(final KiePMMLDroolsRule rule) { logger.trace("declareRule {}", rule); final RuleDescrBuilder ruleBuilder = builder.newRule().name(rule.getName()); if (rule.getAgendaGroup() != null) { declareAgendaGroup(ruleBuilder, rule.getAgendaGroup()); } if (rule.getActivationGroup() != null) { declareActivationGroup(ruleBuilder, rule.getActivationGroup()); } KiePMMLDescrLhsFactory.factory(ruleBuilder.lhs()).declareLhs(rule); KiePMMLDescrRhsFactory.factory(ruleBuilder).declareRhs(rule); } }
KiePMMLDescrRulesFactory { protected void declareRule(final KiePMMLDroolsRule rule) { logger.trace("declareRule {}", rule); final RuleDescrBuilder ruleBuilder = builder.newRule().name(rule.getName()); if (rule.getAgendaGroup() != null) { declareAgendaGroup(ruleBuilder, rule.getAgendaGroup()); } if (rule.getActivationGroup() != null) { declareActivationGroup(ruleBuilder, rule.getActivationGroup()); } KiePMMLDescrLhsFactory.factory(ruleBuilder.lhs()).declareLhs(rule); KiePMMLDescrRhsFactory.factory(ruleBuilder).declareRhs(rule); } private  KiePMMLDescrRulesFactory(final PackageDescrBuilder builder); }
KiePMMLDescrRulesFactory { protected void declareRule(final KiePMMLDroolsRule rule) { logger.trace("declareRule {}", rule); final RuleDescrBuilder ruleBuilder = builder.newRule().name(rule.getName()); if (rule.getAgendaGroup() != null) { declareAgendaGroup(ruleBuilder, rule.getAgendaGroup()); } if (rule.getActivationGroup() != null) { declareActivationGroup(ruleBuilder, rule.getActivationGroup()); } KiePMMLDescrLhsFactory.factory(ruleBuilder.lhs()).declareLhs(rule); KiePMMLDescrRhsFactory.factory(ruleBuilder).declareRhs(rule); } private  KiePMMLDescrRulesFactory(final PackageDescrBuilder builder); static KiePMMLDescrRulesFactory factory(final PackageDescrBuilder builder); void declareRules(final List<KiePMMLDroolsRule> rules); }
KiePMMLDescrRulesFactory { protected void declareRule(final KiePMMLDroolsRule rule) { logger.trace("declareRule {}", rule); final RuleDescrBuilder ruleBuilder = builder.newRule().name(rule.getName()); if (rule.getAgendaGroup() != null) { declareAgendaGroup(ruleBuilder, rule.getAgendaGroup()); } if (rule.getActivationGroup() != null) { declareActivationGroup(ruleBuilder, rule.getActivationGroup()); } KiePMMLDescrLhsFactory.factory(ruleBuilder.lhs()).declareLhs(rule); KiePMMLDescrRhsFactory.factory(ruleBuilder).declareRhs(rule); } private  KiePMMLDescrRulesFactory(final PackageDescrBuilder builder); static KiePMMLDescrRulesFactory factory(final PackageDescrBuilder builder); void declareRules(final List<KiePMMLDroolsRule> rules); static final String STATUS_HOLDER; static final String BREAK_LABEL; }