Here is a bit of code that will fetch all of the reports that are currently available in the Automation Engine.
private void getreportList(int runId) {
ReportTypeList reportTypeList = new ReportTypeList(runId);
localUC4Object.sendRequestAndWait(reportTypeList);
Common.getMsgBox(reportTypeList);
log.writeLine("================================================================================");
for (String reportType : reportTypeList) {
String caption = reportTypeList.getCaption(reportType);
log.writeLine(String.format("Report type: %s (%s)", reportType, caption));
log.writeLine("--------------------------------------------------------------------------------");
Report report = new Report(runId, reportType);
localUC4Object.sendRequestAndWait(report);
Common.getMsgBox(report);
for (int pagenum = 1; pagenum <= report.getNumberOfPages(); pagenum++ ) {
String currentPage = report.getReport();
System.out.print(currentPage);
report.nextPage(pagenum);
}
log.writeLine("--------------------------------------------------------------------------------");
log.writeLine("");
}
log.writeLine("================================================================================");
log.writeLine("");
}
If one views a job report in the Java GUI, one can load a partial report via the
Directory tab.
https://us.v-cdn.net/5019921/uploads/editor/ix/zckm4jxd1ay7.png" width="698">
If one clicks the
Download button, this fetches a copy of the partial report, directly to the computer where you are running the Java GUI.
The
ReportTypeList
API class provides a list of the available reports for a given run ID. So for the above job, it would provide the list
{ACT, REP, REV2, REV1, REV0}
.
I could not identify the specific API that corresponds to the
Download button. I have not played around yet with the
GetOutputDirectory
class, so I do not know if it is possible to use this class to fetch the REP report of a job that has not completed. (But for what it’s worth, I do not think the the
Download function in the GUI goes through the AE; I believe it fetches the log from the agent directly.)
It should be relatively straightforward to do something like this:
- Convert the task run ID to an alphanumeric job ID, so that you know the name of the log file.
- Fetch the log file via SCP, CIFS, or some other method.