@Test public void declareLhs() { String name = "NAME"; String statusToSet = "STATUS_TO_SET"; KiePMMLDroolsRule rule = KiePMMLDroolsRule.builder(name, statusToSet, Collections.emptyList()).build(); KiePMMLDescrLhsFactory.factory(lhsBuilder).declareLhs(rule); assertNotNull(lhsBuilder.getDescr()); assertNotNull(lhsBuilder.getDescr().getDescrs()); assertEquals(1, lhsBuilder.getDescr().getDescrs().size()); assertTrue(lhsBuilder.getDescr().getDescrs().get(0) instanceof PatternDescr); PatternDescr patternDescr = (PatternDescr) lhsBuilder.getDescr().getDescrs().get(0); assertEquals(KiePMMLStatusHolder.class.getSimpleName(), patternDescr.getObjectType()); assertEquals(STATUS_HOLDER, patternDescr.getIdentifier()); assertTrue(patternDescr.getConstraint() instanceof AndDescr); AndDescr andDescr = (AndDescr) patternDescr.getConstraint(); assertTrue(andDescr.getDescrs().isEmpty()); }
public void declareLhs(final KiePMMLDroolsRule rule) { logger.trace("declareLhs {}", rule); final PatternDescrBuilder<CEDescrBuilder<RuleDescrBuilder, AndDescr>> patternDescrBuilder = builder.pattern(KiePMMLStatusHolder.class.getSimpleName()).id(STATUS_HOLDER, false); if (rule.getStatusConstraint() != null) { patternDescrBuilder.constraint(rule.getStatusConstraint()); } if (rule.getAndConstraints() != null) { declareConstraintsAndOr(rule.getAndConstraints(), builder.and()); } if (rule.getOrConstraints() != null) { declareConstraintsAndOr(rule.getOrConstraints(), builder.or()); } if (rule.getXorConstraints() != null) { declareConstraintsXor(rule.getXorConstraints()); } if (rule.getNotConstraints() != null) { declareNotConstraints(rule.getNotConstraints()); } if (rule.getInConstraints() != null) { rule.getInConstraints().forEach(this::declareConstraintIn); } if (rule.getNotInConstraints() != null) { rule.getNotInConstraints().forEach(this::declareConstraintNotIn); } if (rule.getIfBreakField() != null) { declareIfBreak(rule.getIfBreakField(), rule.getIfBreakOperator(), rule.getIfBreakValue()); } }
KiePMMLDescrLhsFactory { public void declareLhs(final KiePMMLDroolsRule rule) { logger.trace("declareLhs {}", rule); final PatternDescrBuilder<CEDescrBuilder<RuleDescrBuilder, AndDescr>> patternDescrBuilder = builder.pattern(KiePMMLStatusHolder.class.getSimpleName()).id(STATUS_HOLDER, false); if (rule.getStatusConstraint() != null) { patternDescrBuilder.constraint(rule.getStatusConstraint()); } if (rule.getAndConstraints() != null) { declareConstraintsAndOr(rule.getAndConstraints(), builder.and()); } if (rule.getOrConstraints() != null) { declareConstraintsAndOr(rule.getOrConstraints(), builder.or()); } if (rule.getXorConstraints() != null) { declareConstraintsXor(rule.getXorConstraints()); } if (rule.getNotConstraints() != null) { declareNotConstraints(rule.getNotConstraints()); } if (rule.getInConstraints() != null) { rule.getInConstraints().forEach(this::declareConstraintIn); } if (rule.getNotInConstraints() != null) { rule.getNotInConstraints().forEach(this::declareConstraintNotIn); } if (rule.getIfBreakField() != null) { declareIfBreak(rule.getIfBreakField(), rule.getIfBreakOperator(), rule.getIfBreakValue()); } } }
KiePMMLDescrLhsFactory { public void declareLhs(final KiePMMLDroolsRule rule) { logger.trace("declareLhs {}", rule); final PatternDescrBuilder<CEDescrBuilder<RuleDescrBuilder, AndDescr>> patternDescrBuilder = builder.pattern(KiePMMLStatusHolder.class.getSimpleName()).id(STATUS_HOLDER, false); if (rule.getStatusConstraint() != null) { patternDescrBuilder.constraint(rule.getStatusConstraint()); } if (rule.getAndConstraints() != null) { declareConstraintsAndOr(rule.getAndConstraints(), builder.and()); } if (rule.getOrConstraints() != null) { declareConstraintsAndOr(rule.getOrConstraints(), builder.or()); } if (rule.getXorConstraints() != null) { declareConstraintsXor(rule.getXorConstraints()); } if (rule.getNotConstraints() != null) { declareNotConstraints(rule.getNotConstraints()); } if (rule.getInConstraints() != null) { rule.getInConstraints().forEach(this::declareConstraintIn); } if (rule.getNotInConstraints() != null) { rule.getNotInConstraints().forEach(this::declareConstraintNotIn); } if (rule.getIfBreakField() != null) { declareIfBreak(rule.getIfBreakField(), rule.getIfBreakOperator(), rule.getIfBreakValue()); } } private  KiePMMLDescrLhsFactory(final CEDescrBuilder<RuleDescrBuilder, AndDescr> builder); }
KiePMMLDescrLhsFactory { public void declareLhs(final KiePMMLDroolsRule rule) { logger.trace("declareLhs {}", rule); final PatternDescrBuilder<CEDescrBuilder<RuleDescrBuilder, AndDescr>> patternDescrBuilder = builder.pattern(KiePMMLStatusHolder.class.getSimpleName()).id(STATUS_HOLDER, false); if (rule.getStatusConstraint() != null) { patternDescrBuilder.constraint(rule.getStatusConstraint()); } if (rule.getAndConstraints() != null) { declareConstraintsAndOr(rule.getAndConstraints(), builder.and()); } if (rule.getOrConstraints() != null) { declareConstraintsAndOr(rule.getOrConstraints(), builder.or()); } if (rule.getXorConstraints() != null) { declareConstraintsXor(rule.getXorConstraints()); } if (rule.getNotConstraints() != null) { declareNotConstraints(rule.getNotConstraints()); } if (rule.getInConstraints() != null) { rule.getInConstraints().forEach(this::declareConstraintIn); } if (rule.getNotInConstraints() != null) { rule.getNotInConstraints().forEach(this::declareConstraintNotIn); } if (rule.getIfBreakField() != null) { declareIfBreak(rule.getIfBreakField(), rule.getIfBreakOperator(), rule.getIfBreakValue()); } } private  KiePMMLDescrLhsFactory(final CEDescrBuilder<RuleDescrBuilder, AndDescr> builder); static KiePMMLDescrLhsFactory factory(final CEDescrBuilder<RuleDescrBuilder, AndDescr> builder); void declareLhs(final KiePMMLDroolsRule rule); }
KiePMMLDescrLhsFactory { public void declareLhs(final KiePMMLDroolsRule rule) { logger.trace("declareLhs {}", rule); final PatternDescrBuilder<CEDescrBuilder<RuleDescrBuilder, AndDescr>> patternDescrBuilder = builder.pattern(KiePMMLStatusHolder.class.getSimpleName()).id(STATUS_HOLDER, false); if (rule.getStatusConstraint() != null) { patternDescrBuilder.constraint(rule.getStatusConstraint()); } if (rule.getAndConstraints() != null) { declareConstraintsAndOr(rule.getAndConstraints(), builder.and()); } if (rule.getOrConstraints() != null) { declareConstraintsAndOr(rule.getOrConstraints(), builder.or()); } if (rule.getXorConstraints() != null) { declareConstraintsXor(rule.getXorConstraints()); } if (rule.getNotConstraints() != null) { declareNotConstraints(rule.getNotConstraints()); } if (rule.getInConstraints() != null) { rule.getInConstraints().forEach(this::declareConstraintIn); } if (rule.getNotInConstraints() != null) { rule.getNotInConstraints().forEach(this::declareConstraintNotIn); } if (rule.getIfBreakField() != null) { declareIfBreak(rule.getIfBreakField(), rule.getIfBreakOperator(), rule.getIfBreakValue()); } } private  KiePMMLDescrLhsFactory(final CEDescrBuilder<RuleDescrBuilder, AndDescr> builder); static KiePMMLDescrLhsFactory factory(final CEDescrBuilder<RuleDescrBuilder, AndDescr> builder); void declareLhs(final KiePMMLDroolsRule rule);  }