How to add a new report or portlet (to the Jira TimeTracking Reporting Collection)

This tutorial will show how to add a new report template.
The same procedure can be used when adding a portlet.

Plugin Version

The sample file in this tutorial will only work with TimeTracking Reporting Collection version 0.93 or later

1. Step - editing timetracking.properties

  1. Open the file com/ja/jira/plugin/timetracking/properties/timetracking.properties in a text editor.
  2. Add a new key to the property timetracking.report.keys, for instance timetracking_customfield_n_user. Keys are separated by [;]
  3. Add 3 new properties:

    timetracking.report.name.timetracking_customfield_n_user:timetracking.report.name.timetracking_customfield_n_user
    timetracking.report.file.timetracking_customfield_n_user:com/ja/jira/plugin/timetracking/templates/timetracking_customfield_n_user.vm
    timetracking.report.fileexcel.timetracking_customfield_n_user:com/ja/jira/plugin/timetracking/templates/timetracking_customfield_n_user.vm

    Tip: the 3th property is only necessary if you want an excel version of the report as well.

2. Step - editing timetracking_labels.properties

  1. Open the file com/ja/jira/plugin/timetracking/properties/timetracking_labels.properties in a text editor.
  2. Add 1 new property:

    timetracking.report.name.timetracking_customfield_n_user:My new report

    Notice: My new report will be the name of the report, and you can easily change it. 

3. Step - add a velocity file

Notice: The velocity file decides the design of the report.
Notice: All reports and portlets are respectively instantiated from timetrackingreport.vm and timetrackingportlet.vm
Tip: When designing a new report you are probably better of just to copy/paste an existing file.
Tip: For a detailed instruction on how to use the velocity framework, se this guide, http://velocity.apache.org/engine/devel/user-guide.html

The velocity file most has the same filename and path as used in Step 1.3 for the property timetracking.report.file. timetracking_customfield_n_user, in this example com/ja/jira/plugin/timetracking/templates/timetracking_customfield_n_user.vm (A sample file for this report can be downloaded here)

Notice: That in the sample velocity file you most replace this String customfield_10121 (at line 4), with an ID for a customfield in your Jira instance.

4. Step - Restart

Notice: You most restart Jira.

5. Step - Done! (Did it work?)

The My new report report can now be picked from the Portlet/Report format field from the Report configuration page.

How to add a portlet or a service template instead?

You might have notice that there is two different portlet and two different reports. All are using the same configuration parameters, except for one of the portlets and reports, which also uses a period parameter.

So when adding portlets, reports and service templates we have to difference between these.

In Step 1.2 we added a key to the property timetracking.report.keys. And the key we added we reused in the properties we added in Step 1.3.

When adding a portlet, a period portlet, a period report or a service template we have to do this in a similar way.

Locate one of the following property names:
timetracking.report.keys
timetracking.report.period.keys
timetracking.portlet.keys
timetracking.portlet.period.keys
timetracking.service.keys

Add a new key to one of those properties, like we did in Step 1.2.

Add new properties like we did in Step 1.3. Notice that the key we added to the timetracking.xx.keys property (like in Step 1.2.) most be used as the last token of the new property names.

A report have 3 different properties:
timetracking.report.name.[key]: [The name of the report]
timetracking.report.file.[key]: [The filename for the velocity template]
timetracking.report.fileexcel. [key]: [The filename for the Excel report, if any - this property is NOT mandatory]

A portlet have 3 different properties:
timetracking.portlet.name.[key]:[The name of the portlet]
timetracking.portlet.file.[key]: [The filename for the velocity template]
timetracking.portlet.correspondingreport.[key]:[The key for a matching report]

A service have 3 different properties:
timetracking.service.name.[key]:[The name of the service]
timetracking.service.file.[key]: [The filename for the velocity template]
timetracking.service.mailbody.[key]: [The filename for the velocity template, that defines the mailbody]

What we actual do is that we pair the key for the report, a name for the report (portlet or service) and a velocity file that defines the output of the report. The name of the report will be available from the configuration page of the report.

Note that you can use any name as key, or any filename. It's not recommended to use special characters, spaces and so on - Use A-Z, a-z and 0-9.


 

Labels

plugin plugin Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Apr 25, 2007

    Nicolas Cornaglia says:

    It doesn't seems to work with Cascading Selects custom fields... Would you tell ...

    It doesn't seems to work with Cascading Selects custom fields... Would you tell me how to make it work?

    1. Apr 25, 2007

      Jes A says:

      Nicolas, Please open an issue here:

      Nicolas,

      Please open an issue here: http://developer.atlassian.com/jira/browse/TMRPT

      And maybe you could also be a bit more specific, What is it that doesn't work?

  2. Apr 25, 2007

    Nicolas Cornaglia says:

    I've just posted the issue

    I've just posted the issue, sorry not have been more specific the first time.

  3. Nov 02, 2007

    Martin Duggan says:

    Hi, great portlets, very useful many thanks\! I'm trying to get a few portlets w...

    Hi, great portlets, very useful - many thanks!

    I'm trying to get a few portlets working against various custom fields. I can get your example working fine against a "Select List" custom field but when I try to use it against a "Group Picker" field, the values all come back as 0 (even though the columns and row headers and the totals for the users appear okay). Any thoughts?

    Thanks, Martin

    1. Nov 06, 2007

      Jes A says:

      Hi Martin, When I made this tutorial I thought that it would work with any custo...

      Hi Martin,

      When I made this tutorial I thought that it would work with any custom field, but that is unfortunately not the case. Apparently there is no generic way to retrieve the value form a custom field.

      I know for sure that it works with a select list, number and text fields.

      You could get it working the customfield types you want but then you would have to modify the plugin source.

      Cheers,
      Jes

  4. Jul 15

    yazhouli says:

     Can some guys tell me the problems? Can some people tell me the result, I ...

     Can some guys tell me the problems?

    Can some people tell me the result, I follow this tutorial want to add a report but I don't found the result, can some one

    paste the result is this dashboard?

    The following is my propreties files content:

     timetracking.propreteies:

    timetracking.report.name.timetracking_10020_user:timetracking.report.name.timetracking_10020_user
    timetracking.report.file.timetracking_10020_user:com/ja/jira/plugin/timetracking/templates/timetracking_10020_user.vm
    timetracking.report.fileexcel.timetracking_10020_user:com/ja/jira/plugin/timetracking/templates/timetracking_10020_user.vm

     timetracking_labels.properties:

    timetracking.report.name.timetracking_10020_user: I test the report.

    the fourth line contect:

    #set( $customField = $customFieldManager.getCustomFieldObject("10020"))

     My db content of the jiradb for customField:
     


    1. Aug 03

      Jes A says:

      Did you remember step 1.2 ?

      Did you remember step 1.2 ?

  5. Jul 16

    yazhouli says:

    I beg the proficient's assistance for the problem I listed in the above.

    I beg the proficient's assistance for the problem I listed in the above.