public void clearCurrentCommand(String worksheetId) { worksheetCommandHistory.clearCurrentCommand(worksheetId); }
public void clearRedoCommand(String worksheetId) { worksheetCommandHistory.clearRedoCommand(worksheetId); }
public List<ICommand> _getHistory() { return worksheetCommandHistory.getAllCommands(); }
public void removeCommands(String worksheetId) { List<ICommand> commandsFromWorksheet = worksheetCommandHistory.getCommandsFromWorksheetId(worksheetId); this.worksheetCommandHistory.removeCommandFromHistory(commandsFromWorksheet); }
Pair<ICommand, Object> consolidatedCommand = null; String consolidatorName = null; String worksheetId = worksheetCommandHistory.getWorksheetId(command); RepFactory factory = workspace.getFactory(); List<ICommand> potentialConsolidateCommands = worksheetCommandHistory.getCommandsFromWorksheetIdAndCommandTag(worksheetId, command.getTagFromPriority()); for (CommandConsolidator consolidator : consolidators) { consolidatedCommand = consolidator.consolidateCommand(potentialConsolidateCommands, command, workspace); worksheetCommandHistory.setStale(worksheetId, true); if (consolidatorName.equals("PyTransformConsolidator")) { Command runCommand = (Command)consolidatedCommand.getLeft(); worksheetCommandHistory.removeCommandFromHistory(Arrays.asList(consolidatedCommand.getLeft())); effects.append(command.doIt(workspace)); worksheetCommandHistory.replaceCommandFromHistory(consolidatedCommand.getKey(), (ICommand)consolidatedCommand.getRight()); effects.append(((ICommand) consolidatedCommand.getRight()).doIt(workspace)); worksheetCommandHistory.replaceCommandFromHistory(consolidatedCommand.getKey(), (ICommand)consolidatedCommand.getRight()); worksheetCommandHistory.removeCommandFromHistory(Arrays.asList(consolidatedCommand.getLeft())); effects.append(command.doIt(workspace)); worksheetCommandHistory.replaceCommandFromHistory(consolidatedCommand.getKey(), (ICommand)consolidatedCommand.getRight()); effects.append(((ICommand) consolidatedCommand.getRight()).doIt(workspace)); worksheetCommandHistory.removeCommandFromHistory(Arrays.asList(consolidatedCommand.getLeft())); effects.append(command.doIt(workspace));
RedoCommandObject currentCommand = worksheetCommandHistory.getCurrentRedoCommandObject(worksheetId); RedoCommandObject lastCommand = worksheetCommandHistory.getLastRedoCommandObject(worksheetId); UpdateContainer container = new UpdateContainer(); if (lastCommand == null) { worksheetCommandHistory.setLastRedoCommandObject(currentCommand); Pair<ICommand, Object> pair = currentCommand.getConsolidatedCommand(); if (pair == null) { container.append(currentCommand.getCommand().undoIt(workspace)); worksheetCommandHistory.removeCommandFromHistory(Arrays.asList(currentCommand.getCommand())); } else { if (pair.getLeft().getCommandName().equals("SubmitPythonTransformationCommand")) { worksheetCommandHistory.insertCommandToHistory(pair.getLeft());
@Override public WorksheetCommandHistory clone() { WorksheetCommandHistory worksheetCommandHistory = new WorksheetCommandHistory(); for (String worksheetId : getAllWorksheetId()) { worksheetCommandHistory.historyWorksheetMap.put(worksheetId, new CommandTagListMap()); } for (ICommand command : getAllCommands()) { worksheetCommandHistory.insertCommandToHistory(command); } for (String worksheetId : getAllWorksheetId()) { CommandTagListMap newMap = worksheetCommandHistory.historyWorksheetMap.get(worksheetId); CommandTagListMap oldMap = this.historyWorksheetMap.get(worksheetId); if (oldMap != null && newMap != null) { if (oldMap.currentCommand != null) { newMap.currentCommand = new RedoCommandObject(oldMap.currentCommand.getCommand(), oldMap.currentCommand.getConsolidatedCommand()); } if (oldMap.lastRedoCommand != null) { newMap.lastRedoCommand = new RedoCommandObject(oldMap.lastRedoCommand.getCommand(), oldMap.lastRedoCommand.getConsolidatedCommand()); } newMap.stale = oldMap.stale; } } return worksheetCommandHistory; } }
public void generateFullHistoryJson(String prefix, PrintWriter pw, VWorkspace vWorkspace) { boolean isFirst = true; for (String worksheetId : worksheetCommandHistory.getAllWorksheetId()) { Iterator<ICommand> histIt = worksheetCommandHistory.getCommandsFromWorksheetId(worksheetId).iterator(); RedoCommandObject currentCommand = worksheetCommandHistory.getCurrentRedoCommandObject(worksheetId); RedoCommandObject redoCommandObject = worksheetCommandHistory.getLastRedoCommandObject(worksheetId); while (histIt.hasNext()) { ICommand command = histIt.next();
Set<String> cmdOutputs = command.getOutputColumns(); List<Command> commandsToMove = new ArrayList<>(); for (ICommand afterCmd : worksheetCommandHistory.getCommandsAfterCommand(command, CommandTag.Transformation)) { Set<String> afterCmdOutputs = ((Command)afterCmd).getOutputColumns(); Set<String> afterCmdInputs = ((Command)afterCmd).getInputColumns(); worksheetCommandHistory.removeCommandFromHistory(Arrays.asList((ICommand)command)); JSONArray inputJSON = new JSONArray(command.getInputParameterJson()); JSONArray placeAfterCmdInputJSON = new JSONArray(command.getInputParameterJson()); HistoryJsonUtil.setArgumentValue("hNodeId", placeHNodeId, inputJSON); command.setInputParameterJson(inputJSON.toString()); worksheetCommandHistory.insertCommandToHistoryAfterCommand(command, placeAfterCmd);
public CommandHistory clone() { return new CommandHistory(worksheetCommandHistory.clone()); }
public List<Command> getCommandsFromWorksheetId(String worksheetId) { List<Command> commandsFromWorksheet = new ArrayList<>(); List<ICommand> history = worksheetCommandHistory.getCommandsFromWorksheetId(worksheetId); for(ICommand command : history) { if(command instanceof Command && command.isSavedInHistory() && (command.hasTag(CommandTag.Modeling) || command.hasTag(CommandTag.Transformation) || command.hasTag(CommandTag.Selection) || command.hasTag(CommandTag.SemanticType) )) { commandsFromWorksheet.add((Command) command); } } return commandsFromWorksheet; }
private Pair<Boolean, Set<String>> detectTransformCycle(String worksheetId) { DirectedGraph<String, DefaultEdge> historyInputOutputGraph = new DefaultDirectedGraph<>(DefaultEdge.class); for (ICommand cmd : worksheetCommandHistory.getCommandsFromWorksheetIdAndCommandTag(worksheetId, CommandTag.Transformation)) { Set<String> outputs = ((Command)cmd).getOutputColumns(); Set<String> inputs = ((Command)cmd).getInputColumns();