Skip to end of metadata
Go to start of metadata

Overview

The swizzle jira report tool is easy to run. Just download swizzle-jirareport-1.2.1-dep.jar and run it from the command line:

java -jar swizzle-jirareport-1.2.1-dep.jar <template> <templateParams>

  • template can be a built-in template name, a template on the local file system, or even a URL to the template.
  • templateParams any properties that a template requires. Specified as -D<name>=<value>

See the Jira Report Reference page for a terse set of non-tutorial style documentation.

Basic template using RSS data

This is about as simple as it gets. You can take any RSS feed from jira and report that data to your liking.

There are a couple ways to get RSS URLs from Jira:

  1. You do your search in JIRA via it's "Find Issues" page where you can fill in all your query parameters. Then when you get the results page, you simply copy the URL from the "XML" link at the top.
  2. Each issue page also has an "XML" link on it and those URLs work too.

You can take a template like this one, replace the RSS URL and you're off and running.

jirarss.vm

$ java -jar swizzle-jirareport-1.1-dep.jar jirarss.vm

[SWIZZLE-1] Unit Test Summary
    - project:  SWIZZLE
    - id:  40099
    - type:  New Feature
    - priority:  Blocker
    - affectsVersions:  []
    - fixVersions:  [Test Version]
    - components:  [jira client]
    - status:  Closed
    - resolution:  Fixed
    - created:  Fri Aug 04 18:05:13 PDT 2006
    - updated:  Fri Aug 04 19:33:48 PDT 2006
    - duedate:  Sat Aug 05 22:00:00 PDT 2006
    - reporter:  David Blevins
    - assignee:  David Blevins
    - votes:  1
    - environment:  Unit Test Environment
    - description:  Unit Test Description
    - http://jira.codehaus.org/browse/SWIZZLE-1

Basic template using XML-RPC

Same template as the above with the exception this one gets the data via XML-RPC.

Notice, we need to specify a username and password to connect to the JIRA server. That's kind of a bummer, but the advantage of using XML-RPC is that you can get more data about the issues, versions, components, users and the other projects in the server. One big thing you can't get via RSS is the "Affects Version/s" for an issue. Don't ask me why but they left that out, so if you need that info you'll have to use XML-RPC.

There is a way to mix RSS and XML-RPC and it's not too hard, take a look at the "fill" method on the Jira class if you need such a feature.

jiraxmlrpc.vm

$ java -jar swizzle-jirareport-1.1-dep.jar jiraxmlrpc.vm

[SWIZZLE-1] Unit Test Summary
    - project:  SWIZZLE
    - id:  40099
    - type:  New Feature
    - priority:  Blocker
    - affectsVersions:  [Test Version]
    - fixVersions:  [Test Version]
    - components:  [jira client]
    - status:  Closed
    - resolution:  Fixed
    - created:  Fri Aug 04 20:05:13 PDT 2006
    - updated:  Fri Aug 04 21:33:48 PDT 2006
    - duedate:  Sun Aug 06 00:00:00 PDT 2006
    - reporter:  David Blevins
    - assignee:  David Blevins
    - votes:  1
    - environment:  Unit Test Environment
    - description:  Unit Test Description

Sorting

That gets us through the basics. Now the fun stuff. Probably right away you are going to want to sort your issues to your liking. You can do that very easily.

Every list of objects we return has some nifty methods that you can use to return a sorted version of that list. The following methods are available:

  • list.descending(fieldName) // sorts high to low
  • list.ascending(fieldName) // sorts low to high
  • list.sort(fieldName) // a synonym for 'descending'

Where list is the collection you wish to sort and fieldName is the "attribute" you wish to sort by. These can even be chained for primary, secondary, etc. sorting. Here are a couple short examples before we show the complete example.

  • $issues.sort("key")
  • $issues.sort("assignee").sort("status")
  • $issues.components.ascending("name")
  • $issues.affectsVersions.descending("sequence")
votes.vm

$ java -jar swizzle-jirareport-1.1-dep.jar votes.vm

Issue sorted by votes

 3 votes -- Fix the toilet  (SWIZZLE-6)
 2 votes -- Beer fridge for the garage  (SWIZZLE-10)
 1 votes -- Put a TV in the bathroom  (SWIZZLE-7)
 0 votes -- Clean the pool  (SWIZZLE-9)
 0 votes -- Make sure the smoke alarms work  (SWIZZLE-11)
 0 votes -- Get more colored lights for the disco ball  (SWIZZLE-8)
 0 votes -- Fix whole in the wall  (SWIZZLE-12)

Filtering

The next basic need is to not want all the issues, but to somehow filter them down to a smaller set. That's easy enough too. There are a few different methods for that. These all create and return new, filtered, lists:

  • list.equals(fieldName, value) // creates a sublist of objects who's field value is identical the one specified. Uses Object.equals()
  • list.greater(fieldName, value) // uses java's Comparator to filter out every object who's field is less than or equal to the specified.
  • list.less(fieldName, value) // uses java's Comparator to filter out every object who's field is greater than or equal to the specified.
  • list.contains(fieldName, string) // uses String.indexOf to filter out every object who's field does not contain the specified String.
  • list.matches(fieldName, regex) // uses java's regex package to filter out every object who's field does not match the specified regular expression.
by-type.vm

$ java -jar swizzle-jirareport-1.1-dep.jar by-type.vm

New Features:

  * [SWIZZLE-10] Beer fridge for the garage

Improvements:

  * [SWIZZLE-8] Get more colored lights for the disco ball

Bugs:

  * [SWIZZLE-6] Fix the toilet
  * [SWIZZLE-12] Fix whole in the wall

Tasks:

  * [SWIZZLE-9] Clean the pool

Sum and Average

There aren't a lot of data types in the Jira object model that are truly numerical, but for those that are there are a couple list methods at your disposal. These both return an int rather than a list like the above Filters.

  • list.sum(fieldName) // returns the numerical total of all the values in specified field of each object
  • list.average(fieldName) // returns the average int value of all the values in specified field of each object

Issue Subtasks

subtasks.vm

$ java -jar swizzle-jirareport-1.1-dep.jar subtasks.vm

Issues with Sub-tasks

[SWIZZLE-2] Need Wilhemina to get some things from the store
  -  SWIZZLE-3: a loaf of bread
  -  SWIZZLE-4: a container of milk
  -  SWIZZLE-5: a stick of butter

Dynamic Attributes

attributes.vm

$ java -jar swizzle-jirareport-1.1-dep.jar attributes.vm

Issues by Score (votes x affect versions)


 9 -- Beer fridge for the garage  (SWIZZLE-10)
 8 -- Put a TV in the bathroom  (SWIZZLE-7)
 8 -- Fix the toilet  (SWIZZLE-6)
 4 -- Make sure the smoke alarms work  (SWIZZLE-11)
 2 -- Fix whole in the wall  (SWIZZLE-12)
 2 -- Get more colored lights for the disco ball  (SWIZZLE-8)
 1 -- Clean the pool  (SWIZZLE-9)
Labels
  • None