Documentation for JIRA 4.2. Documentation for other versions of JIRA is available too.
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.
The root element for the report plugin module is report
. It allows the following attributes and child elements for configuration:
名前 |
必須 |
説明 |
既定 |
---|---|---|---|
クラス |
|
[Unable to render {include} The included page could not be found. ({include} をレンダリングできません。ページが見つかりませんでした)] を選択し、 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. |
|
鍵 (キー) |
|
[Unable to render {include} The included page could not be found. ({include} をレンダリングできません。ページが見つかりませんでした)] を選択し、 I.e. the identifier of the component. |
N/A |
i18n-name-key |
|
[Unable to render {include} The included page could not be found. ({include} をレンダリングできません。ページが見つかりませんでした)] を選択し、 |
|
name |
|
[Unable to render {include} The included page could not be found. ({include} をレンダリングできません。ページが見つかりませんでした)] を選択し、 I.e. the human-readable name of the component. |
The plugin key. |
名前 |
必須 |
説明 |
---|---|---|
description |
|
A human-readable description of this report module. May be specified as the value of this element for plain text or with the |
ラベル |
|
The user-visible name of this portlet. May be specified as the value of this element for plain text or with the |
resource type="velocity" |
|
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. |
プロパティ |
|
Used to generate the report's configuration parameters (see Configuring Plugins with Object Configurable Parameters for details on these properties). |
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:
all contained within a single JAR file.
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:
The second component consists of Velocity templates used to render the report. The templates include:
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:
public boolean isExcelViewSupported() { return true; }
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.
This example is taken from JIRA's internal time tracking report.
<report key="time-tracking" name="Time Tracking Report" class="com.atlassian.jira.plugin.report.impl.TimeTrackingReport"> <description key="report.timetracking.description"> This report shows the time tracking details for a specific project. </description> <!-- the label of this report, which the user will use to select it --> <label key="report.timetracking.label" /> <!-- the 'view' template is used to render the HTML result --> <resource type="velocity" name="view" location="templates/plugins/jira/reports/time-tracking-report.vm" /> <!-- The 'excel' template is used to render an Excel result. The 'Excel view' of the report will only be visible if this template exists for the plugin module --> <resource type="velocity" name="excel" location="templates/plugins/jira/reports/time-tracking-report-excel.vm" /> <!-- this is a .properties file containing the i18n keys for this report --> <resource type="i18n" name="i18n" location="com.atlassian.jira.plugins.reports.timetracking" /> <!-- the properties of this report which the user must select before running it --> <properties> <property> <key>versionId</key> <name>common.concepts.version</name> <description>report.timetracking.version.description</description> <!-- valid types are string, text, long, select, date --> <type>select</type> <!-- the values generator is a class which will generate values for this select list --> <values class="com.atlassian.jira.portal.VersionOptionalValuesGenerator"/> </property> <property> <key>sortingOrder</key> <name>report.timetracking.sortingorder</name> <description>report.timetracking.sortingorder.description</description> <type>select</type> <values class="com.atlassian.jira.portal.SortingValuesGenerator"/> </property> <property> <key>completedFilter</key> <name>report.timetracking.filter</name> <description>report.timetracking.filter.description</description> <type>select</type> <values class="com.atlassian.jira.portal.FilterValuesGenerator"/> </property> </properties> </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.
For more details, see the tutorial on creating a JIRA report.