Developing Actuate Information Delivery API applications using Java : Developing Actuate Information Delivery API applications : Executing a report
 
Executing a report
An ExecuteReport operation generates a synchronous report from an executable file. The executable file can be an Actuate BIRT file type or an external executable file type.
An ExecuteReport request identifies the input file. To save the output, you indicate the output file’s destination by including a full path in the Name parameter for RequestedOutputFile.
An ExecuteReportResponse returns an Encyclopedia volume-generated ObjectId and the status of the report. For a persistent report, the ObjectId is valid until a user deletes the report. For a transient report, the ObjectId is a temporary identifier that lasts for a configurable period of time.
ExecuteReportResponse also returns a ConnectionHandle for a persistent report. Subsequent requests for the same report must use this ConnectionHandle. The ConnectionHandle remains valid throughout the session.
Understanding the structure of an ExecuteReport application
An ExecuteReport application typically uses a mix of developer and com.actuate.schemas classes to implement an ExecuteReport operation in an Encyclopedia volume. The following application derives from the code in the BIRT iHub Integration Technology example applications for the Apache Axis 1.4 client. In the example application, AcExecuteReport, performs these tasks:
*Instantiates the Arguments class, gets the input file (.rptdesign) and output file (.rptdocument) names as command line arguments, and passes these command line arguments to the constructor
*Instantiates the ActuateController class, getting a server URL from Arguments, if specified, at the command line
*Uses methods defined in the controller class to send a request to execute a report using the com.actuate.schemas.ExecuteReport and ExecuteReportResponse classes
The AcExecuteReport class looks like the following example:
public class AcExecuteReport {
public static ActuateControl actuateControl;
public static void main(String[ ] args) {
// download settings
String inputFileName;
String outputFileName;
Arguments arguments = new Arguments(args);
inputFileName = arguments.getArgument( );
outputFileName = arguments.getArgument( );
try {
actuateControl =
new ActuateControl(arguments.getURL( ));
actuateControl.setInputFileName(inputFileName);
actuateControl.setOutputFileName(outputFileName);
actuateControl.executeReport( );
}
catch (Exception e) {
e.printStackTrace( );
}
}
}
ActuateControl.executeReport( ) performs the following tasks:
*Sets up an ExecuteReport object, specifying the job name, input file name, and output file flag
*Sets up a NewFile object to receive the requested output file
*Calls the proxy to submit the request and receives the response
*Outputs a status message
ActuateControl.executeReport( ) looks like the following example:
public void executeReport( ) throws RemoteException {
com.actuate.schemas.ExecuteReport executeReport =
new com.actuate.schemas.ExecuteReport( );
executeReport.setJobName(jobName);
executeReport.setInputFileName(inputFileName);
boolean bSaveOutputFile = (!outputFileName.equals(""));
executeReport.setSaveOutputFile(
new Boolean(bSaveOutputFile));
if (bSaveOutputFile) {
com.actuate.schemas.NewFile requestedOutputFile =
new com.actuate.schemas.NewFile( );
requestedOutputFile.setName(outputFileName);
executeReport.setRequestedOutputFile(requestedOutputFile);
}
com.actuate.schemas.ExecuteReportResponse executeReportResponse
= proxy.executeReport(executeReport);
System.out.println("Status " + executeReportResponse.getStatus( ));
}