use of net.sourceforge.processdash.tool.export.mgr.CompletionStatus in project processdash by dtuma.
the class TextMetricsFileExporter method run.
public void run() {
try {
outWriter = new RobustFileWriter(dest, "UTF-8");
PrintWriter out = new PrintWriter(new BufferedWriter(outWriter));
// Find and print any applicable task lists.
Iterator i = ctx.getData().getKeys();
Set taskListNames = new HashSet();
String name;
int pos;
while (i.hasNext()) {
name = (String) i.next();
pos = name.indexOf(TASK_ORD_PREF);
if (pos != -1 && Filter.matchesFilter(filter, name))
taskListNames.add(name.substring(pos + TASK_ORD_PREF.length()));
}
i = taskListNames.iterator();
String owner = ProcessDashboard.getOwnerName(ctx.getData());
while (i.hasNext()) {
name = (String) i.next();
EVTaskList tl = EVTaskList.openExisting(name, ctx.getData(), ctx.getHierarchy(), ctx.getCache(), false);
if (tl == null)
continue;
tl.recalc();
String xml = tl.getAsXML(false);
name = exportedScheduleDataName(owner, name);
out.write(name + ",");
out.write(StringData.escapeString(xml));
out.println();
}
ctx.getData().dumpRepository(out, filter, DataRepository.DUMP_STYLE_TEXT);
TimeLog tl = ctx.getTimeLog();
Iterator keys = tl.filter(null, null, null);
while (keys.hasNext()) {
TimeLogEntry tle = (TimeLogEntry) keys.next();
if (Filter.matchesFilter(filter, tle.getPath()))
out.println(toAbbrevString(tle));
}
out.println(DefectXmlConstantsv1.DEFECT_START_TOKEN);
DefectExporterXMLv1 exp = new DefectExporterXMLv1();
exp.dumpDefects(ctx.getHierarchy(), filter, out);
out.close();
outWriter = null;
completionStatus = new CompletionStatus(CompletionStatus.SUCCESS, dest, null);
} catch (Exception ioe) {
completionStatus = new CompletionStatus(CompletionStatus.ERROR, dest, ioe);
System.out.println("IOException: " + ioe);
tryCancel();
}
ctx.getData().gc(filter);
}
use of net.sourceforge.processdash.tool.export.mgr.CompletionStatus in project processdash by dtuma.
the class ExportNow method run.
/** 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>");
}
}
use of net.sourceforge.processdash.tool.export.mgr.CompletionStatus in project processdash by dtuma.
the class ArchiveMetricsFileExporter method run.
public void run() {
try {
doExport();
completionStatus = new CompletionStatus(CompletionStatus.SUCCESS, dest.getTarget(), null);
} catch (Exception ioe) {
completionStatus = new CompletionStatus(CompletionStatus.ERROR, dest.getTarget(), ioe);
ioe.printStackTrace();
tryCancel();
}
ctx.getData().gc(filter);
}
Aggregations