It's all about the answers!

Ask a question

How to change plannedFor attribute programmatically?


Annie Lozano (3121) | asked Nov 25 '08, 3:26 a.m.
I have problem with setting plannedFor attribute for example on "aaa".
I know that I need IIterationHandle but how to set it?

Thanks

6 answers



permanent link
Johannes Rieken (1.2k1) | answered Nov 25 '08, 8:18 a.m.
bliq158 wrote:
I have problem with setting plannedFor attribute for example on
"aaa".
I know that I need IIterationHandle but how to set it?

Hi

You are probably looking for
com.ibm.team.workitem.common.model.IWorkItem.setTarget(IIterationHandle)


--
Cheers, Johannes
Agile Planning Team

permanent link
Annie Lozano (3121) | answered Nov 25 '08, 8:26 a.m.
But from where can I get IIterationHandle?

permanent link
Johannes Rieken (1.2k1) | answered Nov 25 '08, 11:28 a.m.
bliq158 wrote:
But from where can I get IIterationHandle?


A general entry point would be

com.ibm.team.process.common.IProjectArea.getDevelopmentLines()

It will give you all development lines for a given project area. From a
development line you can get (child-)iterations.

--
Cheers, Johannes
Agile Planning Team

permanent link
Annie Lozano (3121) | answered Nov 26 '08, 4:34 a.m.
I tried something like that:

IIterationHandle iteration = null;
IDevelopmentLineHandle[] iDevelopmentLineHandle = projectArea.getDevelopmentLines();

//I know that iDevelopmentLine.length =0
for(int i = 0; i < iDevelopmentLineHandle.length;i++)
{
IDevelopmentLine iDevelopmentLine = (IDevelopmentLine)iDevelopmentLineHandle;
iteration= iDevelopmentLine.getCurrentIteration();
}

IAttribute plannedFor= workItemClient.findAttribute(project,IWorkItem.TARGET_PROPERTY, monitor);

workItem.setValue(plannedFor, iteration);



I get:
java.lang.ClassCastException: com.ibm.team.process.internal.common.impl.DevelopmentLineHandleImpl incompatible with com.ibm.team.process.common.IDevelopmentLine


What did I do wrong?

permanent link
Patrick Streule (4.9k21) | answered Nov 26 '08, 6:18 a.m.
JAZZ DEVELOPER
IDevelopmentLine iDevelopmentLine =
(IDevelopmentLine)iDevelopmentLineHandle;

You can't cast an IDevelopmentLineHandle to an IDevelopmentLine, you have
to resolve the handle to get the IDevelopmentLine.

For that, you can either use
IAuditableCommon#resolveAuditable(handle, profile, monitor)
or
IItemManager#fetch*Item(...)

--
Regards,
Patrick
Jazz Work Item Team

permanent link
Annie Lozano (3121) | answered Nov 26 '08, 8:21 a.m.
Thank you, for all your help :)

Your answer


Register or to post your answer.