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

How to set iteration type using RTC JAVA API for iteration

  Hi,


I am trying to set iteration type using RTC JAVA API using below code where I am not able to set iteration type for iteration being getting created or updated.

NullProgressMonitor monitor = new NullProgressMonitor();
List<IIteration> newOnes = new ArrayList<IIteration>();
IProcessItemService service = (IProcessItemService) TeamRepository().getClientLibrary(IProcessItemService.class);
IProjectArea projectArea  = (IProjectArea) service.getMutableCopy(projectArea);
IDeliverable deliverable = null;
IIteration newIteration = null;
IItemManager itemManager = TeamRepository().itemManager();
itemManager.fetchCompleteItem(projectArea.getProjectDevelopmentLine(), IItemManager.REFRESH, monitor);
Object obj1 = itemManager.fetchCompleteItem(projectArea.getProjectDevelopmentLine(), ItemManager.REFRESH,monitor);

if (obj1 instanceof IDevelopmentLine) {
developmentLine = (IDevelopmentLine) obj1;
}

IDevelopmentLine workingDevLine = (IDevelopmentLine) developmentLine.getWorkingCopy();

IWorkItemClient workItemClient = (IWorkItemClient) clientUtil.getTeamRepository().getClientLibrary(IWorkItemClient.class);

newIteration = (IIteration) IIteration.ITEM_TYPE.createItem();
newIteration.setName("iterationName");

newIteration.setIterationType(); //not able to set by sending user parameter as method argument

newIteration.setStartDate(iterationStartDate);
newIteration.setEndDate(iterationEndDate);
newIteration.setDevelopmentLine(workingDevLine);
workingDevLine.addIteration((IIterationHandle) newIteration.getItemHandle());
newIteration.setDevelopmentLine(workingDevLine);

newOnes.add(newIteration);

newIteration.setId(newIteration.getItemId().getUuidValue());

List<IProcessItem> processItems = new ArrayList<IProcessItem>();
processItems.add(workingDevLine);
processItems.addAll(newOnes);

try {
service.save(processItems.toArray(new IProcessItem[] {}), null);
} catch (TeamRepositoryException e) {
}

Can anybody help me to resolve this?

Thanks

0 votes



One answer

Permanent link

 The, not so surprising answer is, that com.ibm.team.process.common.IIteration.setIterationType(IIterationTypeHandle)  requires an com.ibm.team.process.common.IIterationTypeHandle (or com.ibm.team.process.common.IIterationType) as parameter and not a user.


com.ibm.team.process.common.IIteration.getIterationType() provides a list of iteration types that are available.
 

This should be clear even if looking at how to edit iterations in the UI. You have to define an iteration type and set that. Users are not involved in that. 

0 votes

Comments
IIterationTypeHandle ith = newIteration.getIterationType();

I tried this but it is giving me as null.

But when I am cheking it form UI, in combo box it is giving me 2 values for type which I am not able to get it using JAVA API

Why would the new iteration have any type set by default (other than null)?

Consider rereading my answer. 

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

Question asked: Sep 26 '18, 4:50 a.m.

Question was seen: 1,553 times

Last updated: Sep 26 '18, 10:56 a.m.

Confirmation Cancel Confirm