Implementation Guide for Oracle Self-Service E-Billing > Using the Reporting Engine > Components Used by the Reporting Engine >

Reporting API


The reporting API offers an interface to interact with the Reporting Engine. These APIs manage common reporting features, such as sorting, grouping and paging. They also offer report clients the flexibility to customize reporting.

The reporting API is not tied to a particular presentation framework. You can use struts and tiles or servlets and JSP to access it. However, you could find that using struts and tiles is the easiest way to implement your own reporting UI, because that is the default presentation framework used for the reporting UI of Oracle Self-Service E-Billing.

The core reporting APIs are: ReportContext, IReportManager, IReport, ITransformer, IReportConfig and ReportActionHelper. For more information about reporting APIs, go to the Oracle Self-Service E-Billing Javadoc as described in Accessing Oracle Self-Service E-Billing Javadoc.

ReportContext is the carrier of information between the reporting caller and the Reporting Engine. ReportManager is a factory that gets an instance of IReportManager. IReportManager is the factory for IReport objects. IReport represents a report defined in XML. ITransformer represents the transformer defined inside a report in XML. IReportConfig represents the configuration information in XML.

The following example shows how to generate a report:

ReportContext context = new ReportContext();
context.put("form", StrutsActionBean);
IReportManager rptmgr = ReportManager.getInstance();
IReport rpt = rptmgr.getReport("reportId", context);
Rpt.writeTemplate("templateId", Writer);

In the example, a Struts Action Bean is put into the reportContext, which means this object is available to the Velocity template. You can use the syntax of $form.name in the Velocity template. Assume there is a name property in the form.

After you get an instance of IReportManager, call its getReport method to get a report. The report must match the one defined in the report XML. It will return an object that represents the report defined in the XML with the same reportId.

After you get an instance of IReport, it calls the writeTemplate() method to parse the Velocity template identified by templateId in the report XML, and writes the content into a Writer output. This method loops through all the transformers in the report and calls transformer.writeTemplate(). If the same template IDs appear in different transformers, then multiple templates can be parsed and the content of the parsed templates will be appended together in the order in which they appear in the report configuration XML.

You can also call the individual APIs of ITransformer to do sorting, grouping, or paging. However, it is tedious to call these APIs: they are usually used for back-end based applications. For the common UI features, such as sorting, grouping, and paging, the reporting API offers a Web helper class, ReportActionHelper, to shield you from the low-level APIs. This class is a facade to the Report Engine APIs. In most cases, your struts action must call this helper class instead of calling the lower-level reporting APIs. However, you can always access the report APIs directly if you want to. The action used by the product, Com.edocs.app.reporting.actions.ReportAction, calls this helper class. You can similarly do this in your action class.

Implementation Guide for Oracle Self-Service E-Billing Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Legal Notices.