@Override public UpdateContainer undoIt(Workspace workspace) { CommandHistoryUtil historyUtil = new CommandHistoryUtil(Collections.EMPTY_LIST, workspace, volatileWorksheetId); UpdateContainer updateContainer = historyUtil.replayHistory(historyCommandsBackup); this.volatileWorksheetId = historyUtil.getWorksheetId(); return updateContainer; }
public Set<String> generateInputColumns() { Map<Command, List<Command> > dag = generateGraph(); Set<String> inputColumns = new HashSet<>(); for (Command t : commands) { if (t.getCommandName().equals("SetSemanticTypeCommand") || t.getCommandName().equals("SetMetaPropertyCommand")) { inputColumns.addAll(getParents(t, dag)); } } return inputColumns; }
Property.oldCommandHistory, oldCommandsArray.toString()); CommandHistoryUtil historyUtil = new CommandHistoryUtil(history.getCommandsFromWorksheetId(worksheetId), workspace, worksheetId); boolean isHistoryStale = history.isStale(worksheetId); if (isHistoryStale) { System.out.println("**** REPLAY HISTORY ***"); uc.append(historyUtil.replayHistory()); worksheetId = historyUtil.getWorksheetId(); worksheet = workspace.getWorksheet(worksheetId); selection = getSuperSelection(worksheet); historyUtil = new CommandHistoryUtil(history.getCommandsFromWorksheetId(worksheetId), workspace, worksheetId); List<Command> wkCommands = historyUtil.getCommands(); for(Command wkCommand : wkCommands) { if(wkCommand instanceof SetSemanticTypeCommand) { Set<String> inputColumns = historyUtil.generateInputColumns(); Set<String> outputColumns = historyUtil.generateOutputColumns(); JSONArray inputColumnsArray = new JSONArray(); JSONArray outputColumnsArray = new JSONArray();
historyCommandsBackup.put(workspace.getCommandHistory().getCommandJSON(workspace, command)); CommandHistoryUtil historyUtil = new CommandHistoryUtil(commands, workspace, volatileWorksheetId); if (isDelete) { historyUtil.removeCommands(commandSet); UpdateContainer updateContainer = historyUtil.replayHistory(); this.volatileWorksheetId = historyUtil.getWorksheetId(); return updateContainer; historyUtil.retainCommands(commandSet); JSONArray commandsArray = historyUtil.getCommandsJSON(); R2RMLAlignmentFileSaver fileSaver = new R2RMLAlignmentFileSaver(workspace); String graphLabel = worksheet.getMetadataContainer().getWorksheetProperties().
public void deleteExistingTransformationCommands() { CommandHistory history = workspace.getCommandHistory(); CommandHistoryUtil util = new CommandHistoryUtil(history.getCommandsFromWorksheetId(worksheetId), workspace, worksheetId); Set<String> outputColumns = util.generateOutputColumns(); JSONArray newHistoryJSON = new JSONArray(); Object organizeCommand = null;
@Override public UpdateContainer doIt(Workspace workspace) throws CommandException { CommandHistory history = workspace.getCommandHistory(); UpdateContainer updateContainer = new UpdateContainer(); if (history.isStale(worksheetId)) { CommandHistoryUtil util = new CommandHistoryUtil(history.getCommandsFromWorksheetId(worksheetId), workspace, worksheetId); updateContainer.append(util.replayHistory()); updateContainer.add(new HistoryUpdate(history)); } return updateContainer; }
public UpdateContainer replayHistory() { JSONArray redoCommandsArray = new JSONArray(); for (Command refined : commands) { redoCommandsArray.put(workspace.getCommandHistory().getCommandJSON(workspace, refined)); } return replayHistory(redoCommandsArray); }
private Set<String> getParents(Command c, Map<Command, List<Command> >dag) { List<Command> parents = dag.get(c); Set<String> terminalColumns = new HashSet<>(); if (parents == null || parents.size() == 0) terminalColumns.addAll(c.getInputColumns()); else { for (Command t : parents) { terminalColumns.addAll(getParents(t, dag)); for (String hNodeId : c.getInputColumns()) { HNode hn = workspace.getFactory().getHNode(hNodeId); if (hn != null && hn.getHNodeType() == HNodeType.Regular) terminalColumns.add(hNodeId); } } } return terminalColumns; }
public void deleteExistingTransformationAndModelingCommands() { CommandHistory history = workspace.getCommandHistory(); CommandHistoryUtil util = new CommandHistoryUtil(history.getCommandsFromWorksheetId(worksheetId), workspace, worksheetId); Set<String> outputColumns = util.generateOutputColumns(); JSONArray newHistoryJSON = new JSONArray(); List<Object> orderedColumnCommands = new ArrayList<>();