use of org.drools.workbench.models.guided.dtable.shared.model.BRLConditionVariableColumn in project drools-wb by kiegroup.
the class DecisionTableAnalyzerTest method testInsertBRLConditionColumn.
@Test
public void testInsertBRLConditionColumn() throws Exception {
BRLConditionColumn brlConditionOne = new BRLConditionColumn();
BRLConditionVariableColumn a = new BRLConditionVariableColumn();
BRLConditionVariableColumn b = new BRLConditionVariableColumn();
BRLConditionColumn brlConditionTwo = new BRLConditionColumn();
BRLConditionVariableColumn c = new BRLConditionVariableColumn();
BRLConditionVariableColumn d = new BRLConditionVariableColumn();
brlConditionOne.setChildColumns(Arrays.asList(a, b));
brlConditionTwo.setChildColumns(Arrays.asList(c, d));
model.getConditions().addAll(Arrays.asList(brlConditionOne, brlConditionTwo));
decisionTableAnalyzer.insertColumn(brlConditionTwo);
verify(updateManager).newColumn(model, 4);
}
use of org.drools.workbench.models.guided.dtable.shared.model.BRLConditionVariableColumn in project drools-wb by kiegroup.
the class DecisionTableAnalyzerTest method testInsertNonExistingColumn.
@Test(expected = IllegalArgumentException.class)
public void testInsertNonExistingColumn() throws Exception {
ConditionCol52 a = new ConditionCol52();
ConditionCol52 b = new ConditionCol52();
pattern.setChildColumns(Arrays.asList(a));
BRLConditionColumn brlCondition = new BRLConditionColumn();
BRLConditionVariableColumn c = new BRLConditionVariableColumn();
BRLConditionVariableColumn d = new BRLConditionVariableColumn();
brlCondition.setChildColumns(Arrays.asList(c, d));
model.getConditions().addAll(Arrays.asList(pattern, brlCondition));
decisionTableAnalyzer.insertColumn(b);
}
use of org.drools.workbench.models.guided.dtable.shared.model.BRLConditionVariableColumn in project drools-wb by kiegroup.
the class DecisionTableAnalyzerTest method testInsertBRLVariableColumn.
@Test
public void testInsertBRLVariableColumn() throws Exception {
ConditionCol52 a = new ConditionCol52();
ConditionCol52 b = new ConditionCol52();
pattern.setChildColumns(Arrays.asList(a, b));
BRLConditionColumn brlCondition = new BRLConditionColumn();
BRLConditionVariableColumn c = new BRLConditionVariableColumn();
BRLConditionVariableColumn d = new BRLConditionVariableColumn();
brlCondition.setChildColumns(Arrays.asList(c, d));
model.getConditions().addAll(Arrays.asList(pattern, brlCondition));
decisionTableAnalyzer.insertColumn(d);
verify(updateManager).newColumn(model, 5);
}
use of org.drools.workbench.models.guided.dtable.shared.model.BRLConditionVariableColumn in project drools-wb by kiegroup.
the class BRLConditionColumnPlugin method cloneVariable.
BRLConditionVariableColumn cloneVariable(BRLConditionVariableColumn variable) {
final BRLConditionVariableColumn clone = new BRLConditionVariableColumn(variable.getVarName(), variable.getFieldType(), variable.getFactType(), variable.getFactField());
clone.setHeader(variable.getHeader());
clone.setHideColumn(variable.isHideColumn());
clone.setWidth(variable.getWidth());
return clone;
}
use of org.drools.workbench.models.guided.dtable.shared.model.BRLConditionVariableColumn in project drools-wb by kiegroup.
the class BRLConditionColumnPlugin method convertInterpolationVariables.
private List<BRLConditionVariableColumn> convertInterpolationVariables(Map<InterpolationVariable, Integer> ivs) {
// If there are no variables add a boolean column to specify whether the fragment should apply
if (ivs.isEmpty()) {
BRLConditionVariableColumn variable = new BRLConditionVariableColumn("", DataType.TYPE_BOOLEAN);
variable.setHeader(editingCol.getHeader());
variable.setHideColumn(editingCol.isHideColumn());
List<BRLConditionVariableColumn> variables = new ArrayList<BRLConditionVariableColumn>();
variables.add(variable);
return variables;
}
// Convert to columns for use in the Decision Table
BRLConditionVariableColumn[] variables = new BRLConditionVariableColumn[ivs.size()];
for (Map.Entry<InterpolationVariable, Integer> me : ivs.entrySet()) {
InterpolationVariable iv = me.getKey();
int index = me.getValue();
BRLConditionVariableColumn variable = new BRLConditionVariableColumn(iv.getVarName(), iv.getDataType(), iv.getFactType(), iv.getFactField());
variable.setHeader(editingCol.getHeader());
variable.setHideColumn(editingCol.isHideColumn());
variables[index] = variable;
}
// Convert the array into a mutable list (Arrays.toList provides an immutable list)
List<BRLConditionVariableColumn> variableList = new ArrayList<BRLConditionVariableColumn>();
for (BRLConditionVariableColumn variable : variables) {
variableList.add(variable);
}
return variableList;
}
Aggregations