It's all about the answers!

Ask a question

How to get the IIterationHandle by Iteration's name?


DAVID GUO (3539) | asked Jun 07 '10, 4:25 a.m.
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.

4 answers



permanent link
Sridevi Sangaiah (59179) | answered Jun 07 '10, 10:07 a.m.
JAZZ DEVELOPER
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

permanent link
DAVID GUO (3539) | answered Jun 07 '10, 10:45 a.m.
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

permanent link
Jared Burns (4.5k29) | answered Jun 07 '10, 11:01 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
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

permanent link
DAVID GUO (3539) | answered Jun 07 '10, 10:59 p.m.
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

Your answer


Register or to post your answer.