@Override public UpdateContainer doIt(Workspace workspace) throws CommandException { UpdateContainer c = new UpdateContainer(); UpdateContainer rwu = WorksheetUpdateFactory.createRegenerateWorksheetUpdates(worksheetId); if (rwu != null) { c.append(rwu); } try { JSONArray historyJson = extractHistoryFromModel(workspace, c); if (null == historyJson || historyJson.length() == 0) { return new UpdateContainer(new ErrorUpdate("No history found in R2RML Model!")); } WorksheetCommandHistoryExecutor histExecutor = new WorksheetCommandHistoryExecutor(worksheetId, workspace); UpdateContainer hc = histExecutor.executeAllCommands(historyJson); if (hc != null) c.append(hc); } catch (Exception e) { String msg = "Error occured while applying history!"; logger.error(msg, e); return new UpdateContainer(new ErrorUpdate(msg)); } // Add worksheet updates that could have resulted out of the transformation commands c.append(computeAlignmentAndSemanticTypesAndCreateUpdates(workspace)); c.add(new InfoUpdate("Model successfully applied!")); return c; }
@Override public UpdateContainer doIt(Workspace workspace) throws CommandException { UpdateContainer undoEffects = workspace.getCommandHistory().undoOrRedoCommandsUntil(workspace, commandIdArg); UpdateContainer result = new UpdateContainer(new HistoryUpdate(workspace.getCommandHistory())); result.append(undoEffects); return result; }