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

How to get the IIterationHandle by Iteration's name?

I want to get the IIterationHandle(target_handle) of the given Iteration(name:ABCDEFG) via list code,But I failed.


boolean ismatch = false;
IIterationHandle target_handle = null;
for (int i = 0; i < fImpHandle.fIdevlopLineHandlelist.length;i++)
{
IDevelopmentLineHandle iDevlopLineHandle = fImpHandle.fIdevlopLineHandlelist[i];
IDevelopmentLine iDevlopLine = null;
iDevlopLine = (IDevelopmentLine) fImpHandle.fTeamRepository.itemManager().fetchCompleteItem(iDevlopLineHandle, IDevelopmentLine.DEVELOPMENT_LINE, monitor);
IIterationHandle[] iIterHandleList = iDevlopLine.getIterations();
for (int j=0;j<iIterHandleList.length;j++)
{
IIterationHandle iterationhandle = iIterHandleList[i];
IIteration iIteration = (IIteration) fImpHandle.fTeamRepository.itemManager().fetchCompleteItem(iterationhandle, IIteration.ITERATION, monitor);
if (iIteration.getName().trim().equals("ABCDEFG"))
{
ismatch = true;
target_handle = iterationhandle;
break;
}
}
if (ismatch)
{
break;
}
}


Please help me,thank you.

0 votes



4 answers

Permanent link
I want to get the IIterationHandle(target_handle) of the given Iteration(name:ABCDEFG) via list code,But I failed.


boolean ismatch = false;
IIterationHandle target_handle = null;
for (int i = 0; i < fImpHandle.fIdevlopLineHandlelist.length;i++)
{
IDevelopmentLineHandle iDevlopLineHandle = fImpHandle.fIdevlopLineHandlelist[i];
IDevelopmentLine iDevlopLine = null;
iDevlopLine = (IDevelopmentLine) fImpHandle.fTeamRepository.itemManager().fetchCompleteItem(iDevlopLineHandle, IDevelopmentLine.DEVELOPMENT_LINE, monitor);
IIterationHandle[] iIterHandleList = iDevlopLine.getIterations();
for (int j=0;j<iIterHandleList.length;j++)
{
IIterationHandle iterationhandle = iIterHandleList[i];
IIteration iIteration = (IIteration) fImpHandle.fTeamRepository.itemManager().fetchCompleteItem(iterationhandle, IIteration.ITERATION, monitor);
if (iIteration.getName().trim().equals("ABCDEFG"))
{
ismatch = true;
target_handle = iterationhandle;
break;
}
}
if (ismatch)
{
break;
}
}


Please help me,thank you.


Hi,

Is it failing to find the matching iteration or failing with an exception? If it is failing with an exception can you please provide the stack trace?

I would suggest using iteration.getLabel() method to fetch the name of the iteration as it automatically handles null value for iteration name.

Thanks,
Sridevi
Jazz Process Team

0 votes


Permanent link
Thank you,it's failing to find the matching iteration.

It's only get the currently iteration handle.



Hi,

Is it failing to find the matching iteration or failing with an exception? If it is failing with an exception can you please provide the stack trace?

I would suggest using iteration.getLabel() method to fetch the name of the iteration as it automatically handles null value for iteration name.

Thanks,
Sridevi
Jazz Process Team

0 votes


Permanent link
On Mon, 07 Jun 2010 08:38:06 +0000, codeboy wrote:

I want to get the IIterationHandle(target_handle) of the given
Iteration(name:ABCDEFG) via list code,But I failed.


boolean ismatch = false; IIterationHandle target_handle =
null; for (int i = 0; i
fImpHandle.fIdevlopLineHandlelist.length;i++) {
IDevelopmentLineHandle iDevlopLineHandle =
fImpHandle.fIdevlopLineHandlelist;
IDevelopmentLine iDevlopLine = null; iDevlopLine =
(IDevelopmentLine)
fImpHandle.fTeamRepository.itemManager().fetchCompleteItem
(iDevlopLineHandle,
IDevelopmentLine.DEVELOPMENT_LINE, monitor);
IIterationHandle[] iIterHandleList =
iDevlopLine.getIterations();
for (int j=0;j<iIterHandleList.length;j++) {
IIterationHandle iterationhandle =
iIterHandleList
;
IIteration iIteration = (IIteration)
fImpHandle.fTeamRepository.itemManager().fetchCompleteItem
(iterationhandle,
IIteration.ITERATION, monitor);
if
(iIteration.getName().trim().equals("ABCDEFG"))
{
ismatch = true;
target_handle = iterationhandle;
break;
}
}
if (ismatch)
{
break;
}
}


Please help me,thank you.

There are a couple problems with this code.

First, the code that's fetching the items is passing in a bad "flags"
parameter to the item manager. IDevelopmentLine.DEVELOPMENT_LINE and
IIteration.ITERATION are type constants. They're not valid parameters to
this method. Instead, you should use IItemManager.DEFAULT or
IItemManager.REFRESH.

Second, the method IDevelopmentLine.getIterations() will only return you
the top-level iterations. If you want to traverse the whole hierarchy of
iterations in the development line, you'll need to start walking
IIteration.getChildren() as well.

- Jared
---------------------
Jazz Team Process

0 votes


Permanent link
Thank you very much.It's OK.


On Mon, 07 Jun 2010 08:38:06 +0000, codeboy wrote:

I want to get the IIterationHandle(target_handle) of the given
Iteration(name:ABCDEFG) via list code,But I failed.


boolean ismatch = false; IIterationHandle target_handle =
null; for (int i = 0; i
fImpHandle.fIdevlopLineHandlelist.length;i++) {
IDevelopmentLineHandle iDevlopLineHandle =
fImpHandle.fIdevlopLineHandlelist;
IDevelopmentLine iDevlopLine = null; iDevlopLine =
(IDevelopmentLine)
fImpHandle.fTeamRepository.itemManager().fetchCompleteItem
(iDevlopLineHandle,
IDevelopmentLine.DEVELOPMENT_LINE, monitor);
IIterationHandle[] iIterHandleList =
iDevlopLine.getIterations();
for (int j=0;j<iIterHandleList.length;j++) {
IIterationHandle iterationhandle =
iIterHandleList
;
IIteration iIteration = (IIteration)
fImpHandle.fTeamRepository.itemManager().fetchCompleteItem
(iterationhandle,
IIteration.ITERATION, monitor);
if
(iIteration.getName().trim().equals("ABCDEFG"))
{
ismatch = true;
target_handle = iterationhandle;
break;
}
}
if (ismatch)
{
break;
}
}


Please help me,thank you.

There are a couple problems with this code.

First, the code that's fetching the items is passing in a bad "flags"
parameter to the item manager. IDevelopmentLine.DEVELOPMENT_LINE and
IIteration.ITERATION are type constants. They're not valid parameters to
this method. Instead, you should use IItemManager.DEFAULT or
IItemManager.REFRESH.

Second, the method IDevelopmentLine.getIterations() will only return you
the top-level iterations. If you want to traverse the whole hierarchy of
iterations in the development line, you'll need to start walking
IIteration.getChildren() as well.

- Jared
---------------------
Jazz Team Process

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,943

Question asked: Jun 07 '10, 4:25 a.m.

Question was seen: 7,100 times

Last updated: Jun 07 '10, 4:25 a.m.

Confirmation Cancel Confirm