It's all about the answers!

Ask a question

IIterationTypeHandle is null ???


Kim Soederhamn (1.5k24247) | asked Jul 15 '10, 8:14 a.m.
Hey Everyone,

We are trying to make a custom precondition to prevent saving certain workitem types on certain iteration types.

Now we run into the problem that even though our Iteration found on the workitem for sure has a defined iteration type the IiterationTypeHandle returned is null.

Our code:

			if (auditable instanceof IWorkItem) 

{

IWorkItem aWorkItem = (IWorkItem) auditable;

String workitemtype = aWorkItem.getWorkItemType();

if ( aWorkItem.getTarget()!=null)
{
IAuditable anAuditable = auditableCommon.resolveAuditable(aWorkItem.getTarget(), ItemProfile.ITERATION_DEFAULT, monitor);
IIteration anIteration = (IIteration) anAuditable;
IIterationTypeHandle anIterationTypeHandle = anIteration.getIterationType();


anIterationTypeHandle is always null anyone knows why ?

One answer



permanent link
Kim Soederhamn (1.5k24247) | answered Jul 15 '10, 8:27 a.m.
Hey Everyone,

We are trying to make a custom precondition to prevent saving certain workitem types on certain iteration types.

Now we run into the problem that even though our Iteration found on the workitem for sure has a defined iteration type the IiterationTypeHandle returned is null.

Our code:

			if (auditable instanceof IWorkItem) 

{

IWorkItem aWorkItem = (IWorkItem) auditable;

String workitemtype = aWorkItem.getWorkItemType();

if ( aWorkItem.getTarget()!=null)
{
IAuditable anAuditable = auditableCommon.resolveAuditable(aWorkItem.getTarget(), ItemProfile.ITERATION_DEFAULT, monitor);
IIteration anIteration = (IIteration) anAuditable;
IIterationTypeHandle anIterationTypeHandle = anIteration.getIterationType();


anIterationTypeHandle is always null anyone knows why ?


We found the solution using the full item profile:
			if (auditable instanceof IWorkItem) 

{

IWorkItem aWorkItem = (IWorkItem) auditable;

String workitemtype = aWorkItem.getWorkItemType();

if ( aWorkItem.getTarget()!=null)
{
//IAuditable anAuditable = auditableCommon.resolveAuditable(aWorkItem.getTarget(), ItemProfile.ITERATION_DEFAULT, monitor);
IAuditable anAuditable = auditableCommon.resolveAuditable(aWorkItem.getTarget(), ItemProfile.createFullProfile(aWorkItem.getTarget().getItemType()), monitor);
IIteration anIteration = (IIteration) anAuditable;
IIterationTypeHandle anIterationTypeHandle = anIteration.getIterationType();

Your answer


Register or to post your answer.