use of org.drools.workbench.models.guided.dtable.shared.model.BRLConditionColumn in project drools-wb by kiegroup.
the class BRLConditionColumnSynchronizer method doMoveBRLFragment.
private void doMoveBRLFragment(final List<MoveColumnToMetaData> metaData) throws VetoException {
final MoveColumnToMetaData md = metaData.get(0);
final BRLConditionVariableColumn srcModelColumn = (BRLConditionVariableColumn) md.getColumn();
final BRLConditionColumn srcModelBRLFragment = model.getBRLColumn(srcModelColumn);
if (srcModelBRLFragment == null) {
throw new ModelSynchronizer.MoveVetoException();
}
final List<BRLConditionVariableColumn> srcModelBRLFragmentColumns = srcModelBRLFragment.getChildColumns();
final int srcModelPatternConditionColumnCount = srcModelBRLFragmentColumns.size();
if (srcModelPatternConditionColumnCount == 0) {
throw new ModelSynchronizer.MoveVetoException();
}
if (srcModelPatternConditionColumnCount != metaData.size()) {
throw new ModelSynchronizer.MoveVetoException();
}
final int tgtColumnIndex = md.getTargetColumnIndex();
final int tgtPatternIndex = findTargetPatternIndex(md);
final List<BaseColumn> allModelColumns = model.getExpandedColumns();
moveModelData(tgtColumnIndex, allModelColumns.indexOf(srcModelBRLFragmentColumns.get(0)), allModelColumns.indexOf(srcModelBRLFragmentColumns.get(0)) + srcModelPatternConditionColumnCount - 1);
model.getConditions().remove(srcModelBRLFragment);
model.getConditions().add(tgtPatternIndex, srcModelBRLFragment);
}
use of org.drools.workbench.models.guided.dtable.shared.model.BRLConditionColumn 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.BRLConditionColumn 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.BRLConditionColumn 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.BRLConditionColumn in project drools-wb by kiegroup.
the class GuidedDecisionTablePresenterTest method addBrlConstraintToModel.
private void addBrlConstraintToModel(final GuidedDecisionTable52 model, final String factType, final String field) {
final Pattern52 p = new Pattern52();
p.setFactType(factType);
final BRLConditionColumn conditionColumn = new BRLConditionColumn();
conditionColumn.setFactField(field);
p.getChildColumns().add(conditionColumn);
model.getConditions().add(p);
}
Aggregations