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.
Please help me,thank you.
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
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
Thank you,it's failing to find the matching iteration.
It's only get the currently iteration handle.
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
On Mon, 07 Jun 2010 08:38:06 +0000, codeboy wrote:
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
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
Thank you very much.It's OK.
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
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