/** Export the data, and tell the user the results.
*/
private void run() {
CompletionStatus result = null;
if (parameters.containsKey("all"))
DashController.exportAllData();
else
result = DashController.exportDataForPrefix(getPrefix());
if (result == null || CompletionStatus.SUCCESS.equals(result.getStatus())) {
interpOut("<HTML><HEAD><TITLE>${ExportComplete}</TITLE></HEAD>\n"
+ "<BODY><H1>${ExportComplete}</H1>\n");
out.println(HTMLUtils.escapeEntities(resources.format(
"ExportDataComplete_FMT", new Date())));
out.println("</BODY></HTML>");
} else if (CompletionStatus.NO_WORK_NEEDED.equals(result.getStatus())) {
interpOut("<HTML><HEAD><TITLE>${ExportNotNeeded.Title}</TITLE></HEAD>\n"
+ "<BODY><H1>${ExportNotNeeded.Title}</H1>\n"
+ "${ExportNotNeeded.Message}"
+ "</BODY></HTML>");
} else {
interpOut("<HTML><HEAD><TITLE>${ExportError.Title}</TITLE></HEAD>\n"
+ "<BODY><H1>${ExportError.Title}</H1>\n");
if (result != null && result.getTarget() != null
&& result.getException() instanceof IOException) {
String target = result.getTarget().toString();
String resKey = TeamServerSelector.isUrlFormat(target)
? "ExportError.Server_IO_FMT": "ExportError.IO_FMT";
out.println(HTMLUtils.escapeEntities(resources.format(
resKey, target)));
} else {
out.println(resources.getHTML("ExportError.Message"));
if (result != null && result.getException() != null) {
out.print("<PRE>");
result.getException().printStackTrace(out);
out.print("</PRE>");
}
}
out.println("</BODY></HTML>");