@Test public void testGraphCommandUndoWithNoParameters() { setupCommand(); final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler); assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce)); assertEquals(GraphCommandResultBuilder.SUCCESS, c.undo(gce)); assertFormalParameters(); }
@Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { function.getFormalParameter().clear(); function.getFormalParameter().addAll(parameters); parameters.forEach(parameter -> parameter.setParent(function)); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { function.getFormalParameter().clear(); function.getFormalParameter().addAll(oldParameters); parameters.forEach(parameter -> parameter.setParent(function)); return GraphCommandResultBuilder.SUCCESS; } }; }
SetParametersCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
                                                                                VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { function.getFormalParameter().clear(); function.getFormalParameter().addAll(parameters); parameters.forEach(parameter -> parameter.setParent(function)); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { function.getFormalParameter().clear(); function.getFormalParameter().addAll(oldParameters); parameters.forEach(parameter -> parameter.setParent(function)); return GraphCommandResultBuilder.SUCCESS; } }; } }
SetParametersCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
                                                                                VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { function.getFormalParameter().clear(); function.getFormalParameter().addAll(parameters); parameters.forEach(parameter -> parameter.setParent(function)); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { function.getFormalParameter().clear(); function.getFormalParameter().addAll(oldParameters); parameters.forEach(parameter -> parameter.setParent(function)); return GraphCommandResultBuilder.SUCCESS; } }; } SetParametersCommand(final FunctionDefinition function,
                                final List<InformationItem> parameters,
                                final org.uberfire.mvp.Command canvasOperation); }
SetParametersCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
                                                                                VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { function.getFormalParameter().clear(); function.getFormalParameter().addAll(parameters); parameters.forEach(parameter -> parameter.setParent(function)); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { function.getFormalParameter().clear(); function.getFormalParameter().addAll(oldParameters); parameters.forEach(parameter -> parameter.setParent(function)); return GraphCommandResultBuilder.SUCCESS; } }; } SetParametersCommand(final FunctionDefinition function,
                                final List<InformationItem> parameters,
                                final org.uberfire.mvp.Command canvasOperation);  }
SetParametersCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
                                                                                VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { function.getFormalParameter().clear(); function.getFormalParameter().addAll(parameters); parameters.forEach(parameter -> parameter.setParent(function)); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { function.getFormalParameter().clear(); function.getFormalParameter().addAll(oldParameters); parameters.forEach(parameter -> parameter.setParent(function)); return GraphCommandResultBuilder.SUCCESS; } }; } SetParametersCommand(final FunctionDefinition function,
                                final List<InformationItem> parameters,
                                final org.uberfire.mvp.Command canvasOperation);   }