It's all about the answers!

Ask a question

How can I get the currentIteration from a server-side participant?


Susan Hanson (1.6k2201194) | asked Aug 04 '14, 2:32 p.m.
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


permanent link
Jared Burns (4.5k29) | 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



permanent link
Qiong Feng Huang (76911610) | answered Aug 05 '14, 3:32 a.m.
JAZZ DEVELOPER
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.

permanent link
sam detweiler (12.5k6195201) | answered Aug 04 '14, 2:56 p.m.
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..
I start ny server in debug mode all the time, then use an Eclipse remote app debug profile, and make changes from web or other eclipse  so that I can walk thru the code and look at variables..  better than system.out.println to the console or looking in the log


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.

Also when I put RepositoryItemService.COMPLETE in for the properties, I get that the usage is discouraged because it is Internal.


sam detweiler commented Aug 04 '14, 4:10 p.m.

and dev is not null? (handle of current iteration in the project timeline.)

from the UI is there a 'current iteration' in that project's project timeline? (check the properties of the timeline)

Your answer


Register or to post 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.