protected void applyHistoryToWorksheet(Workspace workspace, Worksheet worksheet, KR2RMLMapping mapping) throws JSONException { WorksheetCommandHistoryExecutor wchr = new WorksheetCommandHistoryExecutor(worksheet.getId(), workspace); try { List<CommandTag> tags = new ArrayList<>(); tags.add(CommandTag.Selection); tags.add(CommandTag.Transformation); List<CommandTag> ignoreTags = new ArrayList<>(); ignoreTags.add(CommandTag.IgnoreInBatch); wchr.executeCommandsByTags(tags, ignoreTags, new JSONArray(mapping.getWorksheetHistoryString())); } catch (CommandException | KarmaException e) { logger.error("Unable to execute column transformations", e); } }
for (int i = 0; i < historyJSON.length(); i++) { JSONArray inputParamArr = new JSONArray(historyJSON.getJSONObject(i).get(HistoryArguments.inputParameters.name()).toString()); WorksheetCommandHistoryExecutor ex = new WorksheetCommandHistoryExecutor(worksheetId, workspace); String commandName = (String)historyJSON.getJSONObject(i).get(HistoryArguments.commandName.name()); JSONArray commandTag = (JSONArray)historyJSON.getJSONObject(i).get(HistoryArguments.tags.name());
WorksheetCommandHistoryExecutor ex = new WorksheetCommandHistoryExecutor(worksheetId, workspace); String commandName = (String)historyJSON.getJSONObject(i).get(HistoryArguments.commandName.name());
private Command generateCommandFromJSON(Workspace workspace, JSONObject obj) { JSONArray inputParamArr = (JSONArray) obj.get(HistoryArguments.inputParameters.name()); String commandName = (String)obj.get(HistoryArguments.commandName.name()); WorksheetCommandHistoryExecutor ex = new WorksheetCommandHistoryExecutor(worksheetId, workspace); ex.normalizeCommandHistoryJsonInput(workspace, worksheetId, inputParamArr, commandName, true); try { String model = Command.NEW_MODEL; if(obj.has(HistoryArguments.model.name())) model = obj.getString(HistoryArguments.model.name()); Command c = new OperateSelectionCommandFactory().createCommand(inputParamArr, model, workspace); return c; } catch (Exception e) { return null; } }
WorksheetCommandHistoryExecutor histExecutor = new WorksheetCommandHistoryExecutor( worksheetId, workspace);
if(!r2rmlModelFile.getProtocol().equals("file")) editor.updateModelUrlInCommands(r2rmlModelFile.toString()); WorksheetCommandHistoryExecutor histExecutor = new WorksheetCommandHistoryExecutor( worksheetId, workspace); AlignmentManager alignMgr = AlignmentManager.Instance();
WorksheetCommandHistoryExecutor histExecutor = new WorksheetCommandHistoryExecutor( worksheetId, workspace); UpdateContainer hc = histExecutor.executeAllCommands(redoCommandsArray);
@SuppressWarnings("unchecked") @Override public UpdateContainer doIt(Workspace workspace) throws CommandException { Alignment alignment = AlignmentManager.Instance().getAlignment( alignmentId); Worksheet worksheet = workspace.getWorksheet(worksheetId); OntologyManager ontMgr = workspace.getOntologyManager(); // Save the original alignment for undo oldAlignment = alignment.getAlignmentClone(); oldGraph = (DirectedWeightedMultigraph<Node, DefaultLink>) alignment .getGraph().clone(); UpdateContainer uc = new UpdateContainer(); WorksheetCommandHistoryExecutor histExecutor = new WorksheetCommandHistoryExecutor( worksheetId, workspace); // First delete the links that are not present in newEdges and present // in intialEdges try { refineInitialEdges(alignment); uc.append(deleteLinks(histExecutor, workspace, worksheet, alignment)); uc.append(addNewLinks(histExecutor, workspace, alignment, ontMgr)); } catch (JSONException e) { e.printStackTrace(); } return uc; }