Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.0.x] [DROOLS-7635] ansible-rulebook : Raise an error when a condition comp… #126

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public class Rule {

private final RuleGenerationContext ruleGenerationContext = new RuleGenerationContext();

private String ruleSetName;

private String name;

private Action action;
Expand All @@ -31,6 +33,14 @@ public class Rule {

private Condition condition;

public String getRuleSetName() {
return ruleSetName;
}

public void setRuleSetName(String ruleSetName) {
this.ruleSetName = ruleSetName;
}

public String getName() {
return name;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,23 +224,23 @@ List<Rule> toExecModelRules(RulesSet rulesSet, org.drools.ansible.rulebook.integ
if (getRuleName() == null) {
setRuleName("r_" + ruleCounter.getAndIncrement());
}
setRuleSetName(rulesSet.getName());


List<org.drools.model.Rule> rules = createRules(rulesExecutionController);
if (hasTemporalConstraint(ansibleRule)) {
rulesSet.withOptions(RuleConfigurationOption.EVENTS_PROCESSING);
}
return rules;
}

private void updateContextFromRule(org.drools.ansible.rulebook.integration.api.domain.Rule anisbleRule) {
setRuleName(anisbleRule.getName());
setAction(anisbleRule.getAction());
if (anisbleRule.getOptions() != null) {
addOptions(anisbleRule.getOptions().getOptions());
}
setCondition(anisbleRule.getCondition());
}
private void updateContextFromRule(org.drools.ansible.rulebook.integration.api.domain.Rule anisbleRule) {
setRuleSetName(anisbleRule.getRuleSetName());
setRuleName(anisbleRule.getName());
setAction(anisbleRule.getAction());
if (anisbleRule.getOptions() != null) {
addOptions(anisbleRule.getOptions().getOptions());
}
setCondition(anisbleRule.getCondition());
}

private static class StackedContext<K, V> {
private final Deque<Map<K, V>> stack = new ArrayDeque<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public List<RuleContainer> getRules() {

public void setRules(List<RuleContainer> rules) {
this.rules = rules;
rules.forEach(ruleContainer -> ruleContainer.getRule().setRuleSetName(name));
}

public Rule addRule() {
Expand Down
Loading