public UpdateContainer executeCommandsByTags( List<CommandTag> tagsToAdd, List<CommandTag> tagsToRemove, JSONArray historyJson) throws JSONException, KarmaException, CommandException { JSONArray filteredCommands = HistoryJsonUtil.filterCommandsByTag(tagsToAdd, historyJson); filteredCommands = HistoryJsonUtil.removeCommandsByTag(tagsToRemove, filteredCommands); return executeAllCommands(filteredCommands); }
public CommandHistory getCommandHistory() { if(commandHistory == null) { commandHistory = new CommandHistory(); } return commandHistory; }
public CommandHistory clone() { return new CommandHistory(worksheetCommandHistory.clone()); }
public static boolean historyExists(String workspaceId, String worksheetId) { String filename = CommandHistory.getHistorySaver(workspaceId).getHistoryFilepath(worksheetId); File file = new File(filename); return file.exists(); }
@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 static boolean setArgumentValue(String name, Object value, JSONArray inputJson) throws JSONException { JSONObject obj = getJSONObjectWithName(name, inputJson); if(obj != null) { obj.put(ClientJsonKeys.value.name(), value); return true; } return false; }
public void setCurrentCommand(ICommand command, Pair<ICommand,Object> consolidatedCommand) { String worksheetId = getWorksheetId(command); if (worksheetId == null) { worksheetId = IMPORT_COMMANDS; } CommandTagListMap commandTagListMap = historyWorksheetMap.get(worksheetId); if (commandTagListMap == null) { commandTagListMap = new CommandTagListMap(); historyWorksheetMap.put(worksheetId, commandTagListMap); } commandTagListMap.currentCommand = new RedoCommandObject(command, consolidatedCommand); }
public void insertCommandToHistory(ICommand command) { String worksheetId = getWorksheetId(command); if (worksheetId == null) { worksheetId = IMPORT_COMMANDS; } CommandTagListMap commandTagListMap = historyWorksheetMap.get(worksheetId); if (commandTagListMap == null) { commandTagListMap = new CommandTagListMap(); historyWorksheetMap.put(worksheetId, commandTagListMap); } commandTagListMap.addCommandToHistory(command); }
public void setLastRedoCommandObject(RedoCommandObject command) { String worksheetId = getWorksheetId(command.getCommand()); if (worksheetId == null) { worksheetId = IMPORT_COMMANDS; } CommandTagListMap commandTagListMap = historyWorksheetMap.get(worksheetId); if (commandTagListMap == null) { commandTagListMap = new CommandTagListMap(); historyWorksheetMap.put(worksheetId, commandTagListMap); } if (commandTagListMap.lastRedoCommand == null) { commandTagListMap.lastRedoCommand = command; } }
public static JSONObject createJsonObject(String name, Object value, ParameterType type) throws JSONException { JSONObject obj = new JSONObject(); obj.put(ClientJsonKeys.name.name(), name); obj.put(ClientJsonKeys.value.name(), value); obj.put(ClientJsonKeys.type.name(), type.toString()); return obj; } }
public void removeCommands(String worksheetId) { List<ICommand> commandsFromWorksheet = worksheetCommandHistory.getCommandsFromWorksheetId(worksheetId); this.worksheetCommandHistory.removeCommandFromHistory(commandsFromWorksheet); }
public static boolean valueExits(String arg, JSONArray json) throws JSONException { return getJSONObjectWithName(arg, json) != null; }
public HistoryUpdate(CommandHistory commandHistory) { super(); this.commandHistory = commandHistory.clone(); }
public void clearRedoCommand(String worksheetId) { worksheetCommandHistory.clearRedoCommand(worksheetId); }
public boolean isStale(String worksheetId) { return worksheetCommandHistory.isStale(worksheetId); }
public void clearCurrentCommand(String worksheetId) { worksheetCommandHistory.clearCurrentCommand(worksheetId); }
public List<ICommand> _getHistory() { return worksheetCommandHistory.getAllCommands(); }
public void setStale(String worksheetId, boolean stale) { worksheetCommandHistory.setStale(worksheetId, stale); }
public void removeWorksheetHistory(String worksheetId) { worksheetCommandHistory.removeWorksheet(worksheetId); }
public static boolean getBooleanValue(String arg, JSONArray json) throws JSONException { return getJSONObjectWithName(arg, json).getBoolean(ClientJsonKeys.value.name()); }