use of org.drools.template.model.SnippetBuilder in project drools by kiegroup.
the class RuleMatrixSheetListener method createCondition.
private Condition createCondition(final String value, final String conditionTemplate) {
SnippetBuilder snip = new SnippetBuilder(conditionTemplate);
String result = snip.build(value);
Condition condition = new Condition();
condition.setSnippet(result);
return condition;
}
use of org.drools.template.model.SnippetBuilder in project drools by kiegroup.
the class DefaultTemplateColumn method createCellCondition.
private void createCellCondition(final Rule rule) {
StringBuffer conditionString = new StringBuffer();
Column column = templateContainer.getColumn(columnName);
column.getCondition(condition, index);
if (notCondition) {
conditionString.append("not ");
}
conditionString.append("exists ");
conditionString.append(column.getCondition(condition, index));
SnippetBuilder snip = new SnippetBuilder(conditionString.toString());
Condition condition = new Condition();
condition.setSnippet(snip.build(columnName));
rule.addCondition(condition);
}
use of org.drools.template.model.SnippetBuilder in project drools by kiegroup.
the class DefaultTemplateColumn method createColumnCondition.
private void createColumnCondition(final Rule rule, final String value) {
SnippetBuilder colSnip = new SnippetBuilder("$param : Column(name == \"$param\")");
Condition colCondition = new Condition();
colCondition.setSnippet(colSnip.build(value));
rule.addCondition(colCondition);
}
use of org.drools.template.model.SnippetBuilder in project drools by kiegroup.
the class LhsBuilder method addCellValue.
public void addCellValue(int row, int column, String value) {
this.hasValues = true;
Integer key = new Integer(column);
String content = this.constraints.get(key);
if (content == null) {
throw new DecisionTableParseException("No code snippet for CONDITION in cell " + RuleSheetParserUtil.rc2name(this.headerRow + 2, this.headerCol));
}
SnippetBuilder snip = new SnippetBuilder(content);
String result = snip.build(fixValue(column, value));
this.values.add(result);
}
use of org.drools.template.model.SnippetBuilder in project drools by kiegroup.
the class RhsBuilder method addCellValue.
public void addCellValue(int row, int column, String value) {
hasValues = true;
String template = (String) this.templates.get(new Integer(column));
if (template == null) {
throw new DecisionTableParseException("No code snippet for " + this.actionTypeCode + ", above cell " + RuleSheetParserUtil.rc2name(this.headerRow + 2, this.headerCol));
}
SnippetBuilder snip = new SnippetBuilder(template);
this.values.add(snip.build(value));
}
Aggregations