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

How do I find the Current Iteration of a Project Area with the Java Server API?

I'm looking to be able to make changes to a workitem and linked workitems whenever the workitem is moved into our current iteration. Is there anything in the APIs that can find what the project's current iteration is?

0 votes


Accepted answer

Permanent link
I solved the issue by just casting an IProcessArea as an IProjectArea.

IProjectArea projectArea = (IProjectArea) operation.getProcessArea();

I added this line to the beginning of the run method of my extension and then was able to use IProjectArea's getDevelopmentLines() and IDevelopmentLine's getCurrentIteration() calls to get the current iteration.
Ralph Schoon selected this answer as the correct answer

1 vote


One other answer

Permanent link
Relevant code to answer your question:
  • IProjectArea has .getDevelopmentLines() and .getProjectDevelopmentLine()
  • IDevelopmentLine has .getCurrentIteration() which returns the current iteration.
  • IIteration has .getDevelopmentLine()

1 vote

Comments

I'm able to get the IProjectAreaHandle from workitem.getProjectArea() but when I try to use the IRepositoryItemService.fetchItem() to get the full item from the handle, I get a null value. How do I actually get an IProjectArea object to begin that chain?

IProjectArea projectArea = (IProjectArea) repositoryItemService.fetchItem(workItem.getProjectArea(), IRepositoryItemService.COMPLETE);

Per the Javadoc, the return value 'cannot' be null... so perhaps you are calling a different method. Note: It can however throw one of several Exceptions (is it possible you are just catching that and continuing?),

Ex:

     * @return the item for the given item handle; the item has all its
              properties set of <em>properties</em> is <code>COMPLETE</code>;
    
         otherwise, the item is partial with the specified properties set;
              the item is immutable; never <code>null</code>
     * @throws PermissionDeniedException
    
             if authenticated contributor is not authorized to read this
                  item from the repository
     * @throws ItemNotFoundException
    
             if the item was not found

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,937
× 411
× 58

Question asked: Nov 28 '18, 1:37 p.m.

Question was seen: 2,889 times

Last updated: Dec 07 '18, 1:48 p.m.

Confirmation Cancel Confirm