How can I get the currentIteration from a server-side participant?
I'm trying to set the PlannedFor based on the current iteration during auto-generation of a workitem from a server-side participant. I am struggling getting the currentIteration on the server side (I have plenty of code that gets it on the client side).
I can get the IDevelopmentLineHandle from the project are of the work item, but then I hit issues getting down to the currentIteration: IDevelopmentLineHandle devLine = ipa.getProjectDevelopmentLine(); IDevelopmentLine dev = (IDevelopmentLine)itemService.fetchItem((IItemHandle)devLine, null); IIterationHandle ciHandle = dev.getCurrentIteration(); IIteration iter = (IIteration)itemService.fetchItem((IItemHandle)dev, null); ..that last line gives an error so I can't actually get the information for the currentIteration. |
Accepted answer
Jared Burns (4.5k●2●9)
| answered Aug 04 '14, 5:01 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER edited Aug 04 '14, 5:02 p.m.
There's a typo in your code, so you should currently be getting a ClassCastException. The last line should be:
IIteration iter = (IIteration)itemService.fetchItem((IItemHandle)ciHandle, null); Jared Burns selected this answer as the correct answer
|
2 other answers
is there only one timeline (getProjectDevelopmentLine gets the one set as the Project timeline, but there doesn't HAVE to be one set that way)
also, just the picky in me... fetchItem() takes a list of properties or RepositoryItemService.COMPLETE if all I know RepositoryItemService.COMPLETE= null.. but Comments
sam detweiler
commented Aug 04 '14, 2:58 p.m.
also, you do source level debug your plugins, right? SO much easier..
Susan Hanson
commented Aug 04 '14, 3:24 p.m.
Yes, only one timeline per project area. And yes, I run them in Jetty while developing so that I can look at variable, println them, etc.
sam detweiler
commented Aug 04 '14, 4:10 p.m.
and dev is not null? (handle of current iteration in the project timeline.)
|
I know little about your case. But if you want to set Planned For to the current iteration for a workitem, I believe you should firstly figure out what team area owns this workitem because different team area can be working on different timeline. You can use IProcessServerService.getDevelopmentLine(IProcessArea) to get the timeline for a given process area and then find the current iteration in this timeline.
However, if you are not using team area or all the team areas are working on the same project development timeline, please ignore what I mentioned above.
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.