Hello Team
i am Creating Iterations automatically using client libraries .
I want to generate 2 iteartion at a time ,i am able to create one iteartion successfully when it tries to create the second iteration it throws me an error :
Exception in thread "main" com.ibm.team.repository.common.StaleDataException: CRJAZ0223I The following item has been changed by another operation:
Input: com.ibm.team.process.internal.common.impl.DevelopmentLineImpl@3fb40234 (stateId: [UUID _lTUeM-FtEeaiosrJ0FhAzA], itemId: [UUID _bSq88AanEeS0iaGUWBwblA], origin: <unset>, immutable: true) (contextId: [UUID _ltV88T_eEeO3W9y9iL4-mw], modified: 2017-01-23 14:12:25.235, workingCopy: <unset>) (mergePredecessor: null, workingCopyPredecessor: <unset>, workingCopyMergePredecessor: <unset>, predecessor: [UUID _SyzJUOFtEeaiosrJ0FhAzA]) (name: Development Timeline, id: Function Team 1, descSummary: , archived: false, internalStartDate: null, internalEndDate: null)
Current: com.ibm.team.process.internal.common.impl.DevelopmentLineImpl@87319ec (stateId: [UUID _lQ74keFtEeaiosrJ0FhAzA], itemId: [UUID _bSq88AanEeS0iaGUWBwblA], origin: <unset>, immutable: true) (contextId: [UUID _ltV88T_eEeO3W9y9iL4-mw], modified: 2017-01-23 14:12:24.985, workingCopy: <unset>) (mergePredecessor: null, workingCopyPredecessor: <unset>, workingCopyMergePredecessor: <unset>, predecessor: [UUID _SyzJUOFtEeaiosrJ0FhAzA]) (name: Development Timeline, id: Function Team 1, descSummary: , archived: false, internalStartDate: null, internalEndDate: null)
below is my code used to create itearation :
IProcessItemService service = (IProcessItemService)AutoIteration.teamRepository
.getClientLibrary(IProcessItemService.class);
IIteration newIteration = (IIteration) IIteration.ITEM_TYPE
.createItem();
IdCreator idcreator=new IdCreator();
String[] details= idcreator.getIdDetails();
newIteration.setName(details[0]);
newIteration.setId(details[0]+details[1]);
try {
newIteration.setStartDate(sdf.parse(details[1]));
} catch (ParseException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
newIteration.setEndDate(sdf.parse(details[2]));
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
IIterationHandle iIterationHandle1 = newIteration;
AutoIteration.developmentLine.insertIterationAfter(newIteration, iIterationHandle1);
AutoIteration.developmentLine.addIteration((IIterationHandle) newIteration
.getItemHandle());
newIteration.setDevelopmentLine(AutoIteration.developmentLine);
IProgressMonitor monitor = null;
service.save(new IProcessItem[] { AutoIteration.developmentLine, newIteration },
(org.eclipse.core.runtime.IProgressMonitor) monitor);