use of org.drools.workbench.models.guided.dtable.shared.model.BRLConditionVariableColumn in project drools-wb by kiegroup.
the class GuidedDecisionTablePopulater method setCompositeColumnHeader.
private void setCompositeColumnHeader(final BRLConditionColumn column) {
final List<BRLConditionVariableColumn> columnVariableColumns = column.getChildColumns();
final StringBuilder sb = new StringBuilder();
final List<String> variableColumnHeaders = new ArrayList<>();
sb.append("Converted from [");
for (int i = 0; i < columnVariableColumns.size(); i++) {
final BRLConditionVariableColumn variableColumn = columnVariableColumns.get(i);
final String header = variableColumn.getHeader();
variableColumnHeaders.add(header);
sb.append("'").append(header).append("'");
sb.append(i < columnVariableColumns.size() - 1 ? ", " : "");
}
sb.append("]");
column.setHeader(sb.toString());
for (int i = 0; i < columnVariableColumns.size(); i++) {
final BRLConditionVariableColumn variableColumn = columnVariableColumns.get(i);
variableColumn.setHeader(variableColumnHeaders.get(i));
}
}
use of org.drools.workbench.models.guided.dtable.shared.model.BRLConditionVariableColumn in project drools-wb by kiegroup.
the class GuidedDecisionTableLHSBuilder method addPatternColumn.
// A Pattern column adds constraints to a Pattern. It has a value in the OBJECT row
private List<BRLVariableColumn> addPatternColumn() {
// Sort column builders by column index to ensure columns are added in the correct sequence
final TreeSet<Integer> sortedIndexes = new TreeSet<Integer>(this.valueBuilders.keySet());
final List<BRLVariableColumn> variableColumns = new ArrayList<BRLVariableColumn>();
// DRL prefix
final StringBuffer drl = new StringBuffer();
drl.append(this.colDefPrefix);
String sep = "";
// DRL fragment
for (Integer index : sortedIndexes) {
final ParameterizedValueBuilder vb = this.valueBuilders.get(index);
for (String parameter : vb.getParameters()) {
final BRLConditionVariableColumn parameterColumn = new BRLConditionVariableColumn(parameter, DataType.TYPE_OBJECT);
parameterColumn.setHeader(this.columnHeaders.get(index));
variableColumns.add(parameterColumn);
}
drl.append(sep).append(vb.getTemplate());
sep = this.andop;
}
// DRL suffix
drl.append(this.colDefSuffix);
// Store DRL fragment for use by GuidedDecisionTableRHSBuilder
drlFragments.add(drl.toString());
return variableColumns;
}
use of org.drools.workbench.models.guided.dtable.shared.model.BRLConditionVariableColumn in project drools-wb by kiegroup.
the class GuidedDecisionTableLHSBuilder method addExplicitColumns.
// An explicit column does not add constraints to a Pattern. It does not have a value in the OBJECT row
private List<BRLVariableColumn> addExplicitColumns() {
// Sort column builders by column index to ensure Actions are added in the correct sequence
final Set<Integer> sortedIndexes = new TreeSet<Integer>(this.valueBuilders.keySet());
final List<BRLVariableColumn> variableColumns = new ArrayList<BRLVariableColumn>();
for (Integer index : sortedIndexes) {
final ParameterizedValueBuilder vb = this.valueBuilders.get(index);
final List<BRLVariableColumn> vbVariableColumns = new ArrayList<BRLVariableColumn>();
if (vb instanceof LiteralValueBuilder) {
vbVariableColumns.addAll(addLiteralColumn((LiteralValueBuilder) vb));
for (BRLVariableColumn vbVariableColumn : vbVariableColumns) {
((BRLConditionVariableColumn) vbVariableColumn).setHeader(this.columnHeaders.get(index));
}
} else {
vbVariableColumns.addAll(addBRLFragmentColumn(vb));
for (BRLVariableColumn vbVariableColumn : vbVariableColumns) {
((BRLConditionVariableColumn) vbVariableColumn).setHeader(this.columnHeaders.get(index));
}
}
variableColumns.addAll(vbVariableColumns);
}
return variableColumns;
}
use of org.drools.workbench.models.guided.dtable.shared.model.BRLConditionVariableColumn in project drools-wb by kiegroup.
the class GuidedDecisionTableLHSBuilder method addLiteralColumn.
private List<BRLVariableColumn> addLiteralColumn(final LiteralValueBuilder vb) {
final List<BRLVariableColumn> variableColumns = new ArrayList<BRLVariableColumn>();
final BRLConditionVariableColumn parameterColumn = new BRLConditionVariableColumn("", DataType.TYPE_BOOLEAN);
variableColumns.add(parameterColumn);
// Store DRL fragment for use by GuidedDecisionTableRHSBuilder
drlFragments.add(vb.getTemplate());
return variableColumns;
}
Aggregations