Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How can I count how many times a transition has been visited?

Peter Steibert July 10, 2012

I would like to develop a plugin which counts the times an issue has visited a certain transition. Unfortunately I have no clue how to do this.

Source Code is highly welcome!

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Alex Taylor
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 10, 2012

You don't need that plugin to do this. Instead, you can:

int numberOfTimesInThisStatus = 0;
String nameOfWorkflowStatus = "myStatus";
String previousStatus = "previousStatus";
for (ChangeHistoryItem item : changeHistoryManager.getAllChangeItems(myIssue)) { if (item.getField().equals("status") && item.getTos().containsValue(myStatus) && item.getFroms().containsValue(previousStatus)) { numberOfTimesInThisStatus++; } }

Where "myStatus" is the name of the Workflow step you want to count and "previousStatus" is the name of the step from which the transition to "myStatus" originated. (If you don't care about the specific transition, just delete that line.) "status" in the code is a literal - it's the name of the 'Status' field in the issue.

Peter Steibert July 10, 2012

Thank you! Your answer really helped me.

0 votes
Amrut B
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 10, 2012

Hello Peter,

The suite Utilities Plugin is what you are looking for.

It keeps a tab of number of times the issue has been in a transition and the time spent in the same.

let me know if it helps

Amrut

Peter Steibert July 10, 2012

Thank you for your quick help!

How can I access the data in the "Transition" Tab to use it in Java Source Code?

TAGS
AUG Leaders

Atlassian Community Events