use of org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.ModelSynchronizer.VetoException in project drools-wb by kiegroup.
the class GuidedDecisionTablePresenter method doAppendColumn.
private void doAppendColumn(final BaseColumn column, final VetoableColumnCommand append, final Command callback) {
if (isReadOnly()) {
return;
}
try {
append.execute();
refreshView();
// Log addition of column
model.getAuditLog().add(new InsertColumnAuditLogEntry(identity.getIdentifier(), column));
callback.execute();
} catch (VetoException e) {
getModellerPresenter().getView().showGenericVetoMessage();
}
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.ModelSynchronizer.VetoException in project drools-wb by kiegroup.
the class GuidedDecisionTablePresenter method deleteRow.
private void deleteRow(final int rowIndex) {
try {
synchronizer.deleteRow(rowIndex);
refreshView();
// Log deletion of column
model.getAuditLog().add(new DeleteRowAuditLogEntry(identity.getIdentifier(), rowIndex));
} catch (VetoException e) {
getModellerPresenter().getView().showGenericVetoMessage();
}
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.ModelSynchronizer.VetoException in project drools-wb by kiegroup.
the class ColumnManagementViewTest method testRemoveConditionCanNotBeDeleted.
@Test
public void testRemoveConditionCanNotBeDeleted() throws Exception {
Stream.of(ConditionCol52.class, BRLConditionColumn.class).map(Mockito::mock).forEach(column -> {
final String columnHeader = "column header";
final ArgumentCaptor<Command> commandCaptor = ArgumentCaptor.forClass(Command.class);
doReturn(Optional.of(decisionTablePresenter)).when(modellerPresenter).getActiveDecisionTable();
doReturn(columnHeader).when(column).getHeader();
doNothing().when(modellerView).showUnableToDeleteColumnMessage(column);
try {
doThrow(VetoDeletePatternInUseException.class).when(decisionTablePresenter).deleteColumn(eq(column));
view.removeCondition(column);
verify(view).deleteAnchor(eq("column header"), commandCaptor.capture());
commandCaptor.getValue().execute();
verify(modellerView).showUnableToDeleteColumnMessage(eq(column));
} catch (VetoException veto) {
}
reset(view);
});
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.ModelSynchronizer.VetoException in project drools-wb by kiegroup.
the class ColumnManagementViewTest method testRemoveCondition.
@Test
public void testRemoveCondition() throws Exception {
Stream.of(ConditionCol52.class, BRLConditionColumn.class).map(Mockito::mock).forEach(column -> {
final String columnHeader = "column header";
final ArgumentCaptor<Command> commandCaptor = ArgumentCaptor.forClass(Command.class);
doReturn(Optional.of(decisionTablePresenter)).when(modellerPresenter).getActiveDecisionTable();
doReturn(columnHeader).when(column).getHeader();
view.removeCondition(column);
verify(view).deleteAnchor(eq("column header"), commandCaptor.capture());
commandCaptor.getValue().execute();
try {
verify(decisionTablePresenter).deleteColumn(column);
} catch (VetoException veto) {
fail("Deletion should have succeeded.");
}
reset(view);
});
}
Aggregations