Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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.

0 votes


Accepted answer

Permanent link
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

1 vote


2 other answers

Permanent link
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

0 votes

Comments

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

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.

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)


Permanent link
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.

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,927

Question asked: Aug 04 '14, 2:32 p.m.

Question was seen: 4,364 times

Last updated: Aug 05 '14, 3:32 a.m.

Confirmation Cancel Confirm