Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Version sequence number is incorrectly reported by Jira Java API?

Gustav Taxen September 16, 2018

I'm trying to create an ordered list of all versions by querying the Jira Server Java API. I'm using 

VersionManager.getAllVersions()

to get a Collection of Version objects. Then, for each Version instance in the Collection I call

Version.getSequence()

to obtain the sequence number.

My problem is that this sequence number is the same regardless of how the issues are sorted in the Project configuration page, nor does it seem to make a difference what start or end dates the Versions have.

Is there a way to get a list of all versions in the correct (any?) order?

1 answer

0 votes
Alexey Matveev
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.
September 16, 2018

Hello,

What order do you want? You can always sort the array of versions as you want, after you got the array.

Gustav Taxen September 16, 2018

Ideally, I would like them in the same order as they appear in the Project configuration page.

The getSequence() method is undocumented, but I assumed that it would return that order. (It seems as if it returns the order in which the Versions were created.)

Alexey Matveev
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.
September 16, 2018

I guess, you have to use the getSequence() or order by id. I guess it will be the same.

Gustav Taxen September 17, 2018

I'm still wondering why the getSequence() order is the same as the ID number ordering, though? Do you know what sequence it refers to?

Too bad the method isn't documented! :-/

Alexey Matveev
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.
September 17, 2018

I just had a look at the source code. You need to use the getSequence() to order versions.

Gustav Taxen September 17, 2018 edited

Thank you!

Do you have any idea why getSequence() returns the same values for me regardless of how I order the versions on the Project settings page?

Could this be a bug?

Suggest an answer

Log in or Sign up to answer