User user = getUser(request);
Authorizations authorizations = getAuthorizations(request, user);
String workspaceId = getActiveWorkspaceId(request);
Workspace workspace = workspaceRepository.findById(workspaceId, user);
AnalystsNotebookVersion version = DEFAULT_VERSION;
String versionParameter = getOptionalParameter(request, VERSION_PARAMETER_NAME);
if (versionParameter != null) {
version = AnalystsNotebookVersion.valueOf(versionParameter);
}
Locale locale = getLocale(request);
String timeZone = getTimeZone(request);
String baseUrl = getBaseUrl(request);
Chart chart = analystsNotebookExporter.toChart(version, workspace, user, authorizations, locale, timeZone, baseUrl);
List<String> comments = new ArrayList<String>();
comments.add(String.format("Lumify Workspace: %s", workspace.getDisplayTitle()));
comments.add(String.format("%s/#w=%s", baseUrl, workspaceId));
comments.add(String.format("Exported %1$tF %1$tT %1$tz for Analyst's Notebook version %2$s", new Date(), version.toString()));
String xml = AnalystsNotebookExporter.toXml(chart, comments);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
response.setContentType(CONTENT_TYPE);
setMaxAge(response, EXPIRES_1_HOUR);