private UpdateContainer addNewLinks(WorksheetCommandHistoryExecutor histExecutor, Workspace workspace, Alignment alignment, OntologyManager ontMgr)
throws JSONException {
UpdateContainer uc = new UpdateContainer();
boolean saveToHistory = !this.isExecutedInBatch();
for (int i = 0; i < newEdges.length(); i++) {
JSONObject newEdge = newEdges.getJSONObject(i);
try {
Command cmd = (new AddLinkCommandFactory()).createCommand(worksheetId, alignmentId, newEdge, model, workspace);
cmd.setExecutedInBatch(this.isExecutedInBatch());
uc.append(workspace.getCommandHistory().doCommand(cmd, workspace, saveToHistory && i==newEdges.length()-1));
} catch(CommandException e) {
logger.error("Error adding a new link: " + newEdge.toString(), e);
}
}
return uc;
}