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

How do you get an IIteration object from an IIterationHandle with the Server API?

I've included a part of my code below. I'm trying to create a server extension that can subscribe users based on where a work item is in our plans/sprints so I access to the planned for value. Everything I've found talking about converting the IIterationHandle to an IIteration deals with the client API. How do you do this with the server API?

public void run(AdvisableOperation operation, IProcessConfigurationElement participantConfig,
            IParticipantInfoCollector collector, IProgressMonitor monitor)
            throws TeamRepositoryException
    {
        Object data = operation.getOperationData();
        ISaveParameter saveParameter = null;

        if(!(data instanceof ISaveParameter))
            return;
            
        saveParameter = (ISaveParameter) data;
        
        IAuditable auditable = saveParameter.getNewState();
        IWorkItem workitem = null;
        
        if (auditable instanceof IWorkItem)
            workitem = (IWorkItem) auditable;
        
        if(workitem == null)
            return;
        workitem = (IWorkItem) workitem.getWorkingCopy();
        IIterationHandle plannedForHandle = workitem.getTarget();
        IIteration plannedFor = null;
        if(plannedForHandle != null)
        {
            plannedFor = (IIteration)plannedForHandle.getFullState();
        }

0 votes



One answer

Permanent link

I found the solution for this issue.
I needed to use IRepositoryItemService.fetchItem to retrieve the IIteration object from the IIterationHandle.

Here's the snippets of code I added to my extension:

import com.ibm.team.repository.service.IRepositoryItemService;

    private IRepositoryItemService itemService;

        itemService = getService(IRepositoryItemService.class);

        IIterationHandle plannedForHandle = workitem.getTarget();
        IIteration plannedFor = (IIteration) itemService.fetchItem(plannedForHandle, null);

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

Question asked: Sep 27 '18, 2:14 p.m.

Question was seen: 2,402 times

Last updated: Sep 27 '18, 3:42 p.m.

Confirmation Cancel Confirm