@Test public void testUndo() { parent.getOutEdges().clear(); tested.undo(context); assertEquals(1, parent.getOutEdges().size()); assertEquals(1, candidate.getInEdges().size()); assertEquals(parent.getOutEdges().get(0), candidate.getInEdges().get(0)); final Edge edge = parent.getOutEdges().get(0); assertEquals(parent, edge.getSourceNode()); assertEquals(candidate, edge.getTargetNode()); assertTrue(edge.getContent() instanceof Child); }
@Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> undo(GraphCommandExecutionContext context) { final Node<View<?>, Edge> parent = (Node<View<?>, Edge>) getParent(context); final Node<View<?>, Edge> candidate = (Node<View<?>, Edge>) getCandidate(context); final CaseManagementSetChildNodeGraphCommand undoCommand = new CaseManagementSetChildNodeGraphCommand(parent, candidate, OptionalInt.of(index), Optional.empty(), OptionalInt.empty()); return undoCommand.execute(context); }
CaseManagementRemoveChildCommand extends RemoveChildrenCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> undo(GraphCommandExecutionContext context) { final Node<View<?>, Edge> parent = (Node<View<?>, Edge>) getParent(context); final Node<View<?>, Edge> candidate = (Node<View<?>, Edge>) getCandidate(context); final CaseManagementSetChildNodeGraphCommand undoCommand = new CaseManagementSetChildNodeGraphCommand(parent, candidate, OptionalInt.of(index), Optional.empty(), OptionalInt.empty()); return undoCommand.execute(context); } }
CaseManagementRemoveChildCommand extends RemoveChildrenCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> undo(GraphCommandExecutionContext context) { final Node<View<?>, Edge> parent = (Node<View<?>, Edge>) getParent(context); final Node<View<?>, Edge> candidate = (Node<View<?>, Edge>) getCandidate(context); final CaseManagementSetChildNodeGraphCommand undoCommand = new CaseManagementSetChildNodeGraphCommand(parent, candidate, OptionalInt.of(index), Optional.empty(), OptionalInt.empty()); return undoCommand.execute(context); } CaseManagementRemoveChildCommand(@MapsTo("parentUUID") String parentUUID,
                                            @MapsTo("candidateUUID") String candidateUUID);  CaseManagementRemoveChildCommand(Node<View<?>, Edge> parent,
                                            Node<View<?>, Edge> candidate); }
CaseManagementRemoveChildCommand extends RemoveChildrenCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> undo(GraphCommandExecutionContext context) { final Node<View<?>, Edge> parent = (Node<View<?>, Edge>) getParent(context); final Node<View<?>, Edge> candidate = (Node<View<?>, Edge>) getCandidate(context); final CaseManagementSetChildNodeGraphCommand undoCommand = new CaseManagementSetChildNodeGraphCommand(parent, candidate, OptionalInt.of(index), Optional.empty(), OptionalInt.empty()); return undoCommand.execute(context); } CaseManagementRemoveChildCommand(@MapsTo("parentUUID") String parentUUID,
                                            @MapsTo("candidateUUID") String candidateUUID);  CaseManagementRemoveChildCommand(Node<View<?>, Edge> parent,
                                            Node<View<?>, Edge> candidate); Node<?, Edge> getCandidate(); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(GraphCommandExecutionContext context); }
CaseManagementRemoveChildCommand extends RemoveChildrenCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> undo(GraphCommandExecutionContext context) { final Node<View<?>, Edge> parent = (Node<View<?>, Edge>) getParent(context); final Node<View<?>, Edge> candidate = (Node<View<?>, Edge>) getCandidate(context); final CaseManagementSetChildNodeGraphCommand undoCommand = new CaseManagementSetChildNodeGraphCommand(parent, candidate, OptionalInt.of(index), Optional.empty(), OptionalInt.empty()); return undoCommand.execute(context); } CaseManagementRemoveChildCommand(@MapsTo("parentUUID") String parentUUID,
                                            @MapsTo("candidateUUID") String candidateUUID);  CaseManagementRemoveChildCommand(Node<View<?>, Edge> parent,
                                            Node<View<?>, Edge> candidate); Node<?, Edge> getCandidate(); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(GraphCommandExecutionContext context);  }