if(importAsWorksheet) {
JsonImport jsonImp = new JsonImport(new File(fileLocalPath), newWorksheetName, finalWorkspace, "utf-8", -1, null);
jsonImp.generateWorksheet();
newWSId = jsonImp.getWorksheet().getId();
new WorksheetListUpdate().applyUpdate(vWorkspace);
}
} catch(Exception ie) {
logger.error("Error writing JSON to file: " + fileLocalPath);
errorOnUpdate = "Error exporting to JSON";
}
}
@Override
public void generateJson(String prefix, PrintWriter pw,
VWorkspace vWorkspace) {
if(errorOnUpdate != null) {
new ErrorUpdate(errorOnUpdate).generateJson(prefix, pw, vWorkspace);
} else {
JSONObject outputObject = new JSONObject();
outputObject.put(JsonKeys.updateType.name(), "PublishJSONUpdate");
outputObject.put(JsonKeys.fileUrl.name(), relFilename);
outputObject.put(JsonKeys.worksheetId.name(), worksheetId);
pw.println(outputObject.toString(4));
pw.println(",");
new InfoUpdate("Succesfully exported to JSON").generateJson(prefix, pw, vWorkspace);
boolean showCleaningCharts = UIConfiguration.Instance().isD3ChartsEnabled();
if(importAsWorksheet && newWSId != null) {
pw.println(",");
new WorksheetListUpdate().generateJson(prefix, pw, vWorkspace);
pw.println(",");
if (showCleaningCharts) {
new WorksheetCleaningUpdate(newWSId, true, SuperSelectionManager.DEFAULT_SELECTION).generateJson(prefix, pw, vWorkspace);
pw.println(",");
}