Red Hat Training
A Red Hat training course is available for Red Hat Fuse
3.7. Report Server
The Report Server service is used to generate instances of a report whose definition has previously been deployed to the server. This section explains how to configure and deploy a report definition, and then how to generate the report instances.
3.7.1. Creating and Deploying a Report Definition
Specify a JSON representation of the
org.overlord.rtgov.reports.ReportDefinitionclassThe report definition only contains the name of the report, and the definition of the generator. Here is an example:[ { "name" : "SLAReport", "generator" : { "@class" : "org.overlord.rtgov.reports.MVELReportGenerator", "scriptLocation" : "SLAReport.mvel" } } ]In this case, theorg.overlord.rtgov.reports.MVELReportGeneratorimplementation of the report generator is used, which also includes a property to define the location of the report script (for example, SLAReport.mvel). This MVEL SLA report script is located atsamples/sla/reportfolder.For detals onorg.overlord.rtgov.reports.ReportDefinitionclass, see API documentation.Register the Report
The Report Definition is deployed within the JEE container as a WAR file with the following structure:warfile | |-META-INF | |- beans.xml | |-WEB-INF | |-classes | | |-reports.json | | |-<custom classes/resources> | | | |-lib | |-reports-loader-jee.jar | |-<additional libraries>
Thereports.jsonfile contains the JSON representation of the report definition configuration. Thereports-loader-jee.jaracts as a bootstrapper to load and register the Report Definition. If custom report generators or scripts are defined, then the associated classes and resources can be defined in theWEB-INF/classesfolder or within additional libraries located in theWEB-INF/libfolder. Here is an example of the mavenpom.xmlthat creates this structure is:<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>....</groupId> <artifactId>....</artifactId> <version>....</version> <packaging>war</packaging> <name>....</name> <properties> <rtgov.version>....</rtgov.version> </properties> <dependencies> <dependency> <groupId>org.overlord.rtgov.activity-analysis</groupId> <artifactId>reports-loader-jee</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>org.overlord.rtgov.activity-analysis</groupId> <artifactId>reports</artifactId> <version>${project.version}</version> <scope>test</scope> </dependency> .... </dependencies> </project>If deploying in JBoss Application Server, then include the following fragment to define the dependency on the core Runtime Governance modules:..... <build> <finalName>slamonitor-epn</finalName> <plugins> <plugin> <artifactId>maven-war-plugin</artifactId> <configuration> <failOnMissingWebXml>false</failOnMissingWebXml> <archive> <manifestEntries> <Dependencies>deployment.overlord-rtgov.war</Dependencies> </manifestEntries> </archive> </configuration> </plugin> </plugins> </build> .....
3.7.2. Generating an Instance of the Report
Use the following URL for the service's REST GET request:
<host>/overlord-rtgov/report/generate?<parameters>
The service uses basic authentication by default, using a valid JBoss EAP Application Realm user (you can use the Governance user you configured when you installed Fuse 6). This service has the following query parameters:
Table 3.46. Query Parameters
| Parameter | Description |
|---|---|
| report | The name of the report to be generated. This must match the previously deployed report definition name. |
| startDay/Month/Year | The optional start date for the report. If not defined, then the report will use all activities stored up until the end date. |
| endDay/Month/Year | The optional end date for the report. If not defined, then the report will use all activities up until the current date. |
| timezone | The optional timezone. |
| calendar | The optional business calendar name. A default called exists called Default which represents a working week of Monday to Friday, 9am to 5pm, excluding Christmas Day. |
The query parameters tare specific to the report definition being generated. The operation returns a JSON representation of the
org.overlord.rtgov.reports.model.Report class. See the API documentation for more details on the object model.
3.7.3. Providing a Custom Business Calendar
Define a Business Calendar
A custom Business Calendar can be defined as a JSON representation of theorg.overlord.rtgov.reports.mode.Calendarclass. See API documentation for details.Store it in the properties file
Store the calender in a file whose location is referenced using a property called calendar.<CalendarName> in theoverlord-rtgov.propertiesfile.