Skip to end of metadata
Go to start of metadata

Purpose of this Module Type

A report plugin module defines a report within JIRA. A JIRA report can display statistical information based on all elements within JIRA - e.g. issues, projects, users, issue types, etc.Reports have HTML results and (optionally) Excel results as well. These results are rendererd by Velocity templates included with the plugin. A report can also accept parameters selected by the user before running.

Configuration

The root element for the report plugin module is report. It allows the following attributes and child elements for configuration:

Attributes

Name

Required

Description

Default

class

 

The class which implements this plugin module. The class you need to provide depends on the module type. For example, Confluence theme, layout and colour-scheme modules can use classes already provided in Confluence. So you can write a theme-plugin without any Java code. But for macro and listener modules you need to write your own implementing class and include it in your plugin. See the plugin framework guide to creating plugin module instances. The Java class of the component. The class must implement com.atlassian.jira.plugin.report.Report, but we recommend that you extend the convenience class com.atlassian.jira.plugin.report.impl.AbstractReport in your plugin.

 

key

(tick)

The unique identifier of the plugin module. You refer to this key to use the resource from other contexts in your plugin, such as from the plugin Java code or JavaScript resources.

<component-import key="appProps" interface="com.atlassian.sal.api.ApplicationProperties"/>

In the example, appProps is the key for this particular module declaration, for component-import, in this case. That is, the identifier of the component.

N/A

i18n-name-key

 

The localisation key for the human-readable name of the plugin module.

 

name

 

The human-readable name of the plugin module. That is, the human-readable name of the component.

The plugin key.

Elements

Name

Required

Description

description

 

A human-readable description of this report module. May be specified as the value of this element for plain text or with the key attribute to use the value of a key from the i18n system.

label

(tick)

The user-visible name of this report. May be specified as the value of this element for plain text or with the key attribute to use the value of a key from the i18n system.

resource type="velocity"

(tick)

Used to render the report results. The results format is whatever the template can output.

resource type="18n"

 

A Java properties file within the plugin that specifies internationalization values.

properties

 

Used to generate the report's configuration parameters (see Configuring Plugins with Object Configurable Parameters for details on these properties). Note: In JIRA 5.2.3 or later, when navigating to this report via Browser Project, there is are additional URL parameters of projectOrFilterId (project id prefixed with 'project-') and projectOrFilterName (which in this case is the project name). If you have a custom project picker inside your properties / configure page, you should respect these URL parameters pre-select the project.

Description

In order to make a custom report available within JIRA, it is necessary to create a report plugin module. As with all plugin modules, the report plugin will consist of the following components:

  • Java classes encapsulating report logic
  • Resource templates for display of the report
  • Plugin descriptor to enable the report module in JIRA

all contained within a single JAR file.

Report Logic

The Java classes include the necessary logic to retrieve the data used in configuring and displaying the report. The module class can implement the Report interface or it can extend AbstractReport . The main methods of interest are:

  • generateReportHtml - generate HTML view of report
  • generateReportExcel - generate Excel view of report
  • getParams - retrieve the required data to be passed to the view template
  • validate - validate any parameters used in configuring the report

Resource Templates

The second component consists of Velocity templates used to render the report. The templates include:

  • Report view - the actual report view
  • Excel view - an Excel view for the report (optional)

The plugin system parses the atlassian-plugin.xml file for any configuration parameters associated with the report - parameters required in order to display the report. The plugin system constructs a suitable configuration screen requesting the user to specify values for these parameters.

If an Excel view template is provided, users have the ability to view and further manipulate the data through Excel. If the Excel template is provided please ensure that your report also implements the following method:

Internationalisation

It is also possible to include i18n property files to allow other users to easily translate the strings used in the report for different languages.

Example

This example is taken from JIRA's internal time tracking report.

In this example, the report logic is encapsulated in the TimeTrackingReport Java class, the view template location is specified in the templates/plugins/jira/reports/time-tracking-report.vm directory and the internationalisation property files are located at com.atlassian.jira.plugins.reports.timetracking. Following that, the parameters required to configure the report are specifed - in this case, the version, the sort order and a filter.

Notes

(info) For more details, see the tutorial on creating a JIRA report.

  • No labels