create timeline api, help
![](http://jazz.net/_images/myphoto/d0f7b0b7bfc90721959d790b8a9bf79f.jpg)
so I am replicating the timeline structure from one project (server a) to another project (server b).
it all 'looks good', but I get an exception, all help appreciated
IProcessItemService devprocessItemClient = (IProcessItemService) devServer
.getClientLibrary(IProcessItemService.class);
// get the modifiable working copy object for the new system
iprja_dev = (IProjectArea) iprja_dev.getWorkingCopy();
// get the development timelines in the production project
IDevelopmentLineHandle[] dlh = iprja_prod.getDevelopmentLines();
// loop thru the timelines (if more than 1)
for(int i=0;i<dlh.length;i++)
{
// get the full info from the prod system
IDevelopmentLine proddl = (IDevelopmentLine) prodauditableClient.fetchCurrentAuditable(dlh[i],
ItemProfile .createFullProfile(IDevelopmentLine.ITEM_TYPE), null);
// create a matching timelineine on dev project
IDevelopmentLine devdl = (IDevelopmentLine) IDevelopmentLine.ITEM_TYPE.createItem();
// set the project area handle
devdl.setProjectArea(iprja_dev);
// fill in the details
//devdl = dl; copy might not work
// copy id, name, start, end, project area
devdl.setStartDate(proddl.getStartDate());
devdl.setEndDate(proddl.getEndDate());
devdl.setId(proddl.getId());
devdl.setName(proddl.getName());
// add this timeline to the dev system
iprja_dev.addDevelopmentLine((IDevelopmentLineHandle) devdl);
if(i==0)
iprja_dev.setProjectDevelopmentLine((IDevelopmentLineHandle) devdl);
// additional code removed for sub iterations
break;
}
devprocessItemClient.save(iprja_dev, null);
com.ibm.team.process.common.service.ProcessDataValidationException: Project area 'project name' references timeline which doesn't exist.
at com.ibm.team.process.internal.service.ProcessService.validateProjectAreaDevelopmentLines(ProcessService.java:494)
Accepted answer
![](http://jazz.net/_images/myphoto/d0f7b0b7bfc90721959d790b8a9bf79f.jpg)
Hi Sam,
when I developed http://rsjazz.wordpress.com/2013/09/18/deploying-templates-and-creating-projects-using-the-plain-java-clients-library/ I had a similar situation, where I had to basically save several items together, if I remember correctly.
I am not sure at what line the error comes up.
when I developed http://rsjazz.wordpress.com/2013/09/18/deploying-templates-and-creating-projects-using-the-plain-java-clients-library/ I had a similar situation, where I had to basically save several items together, if I remember correctly.
I am not sure at what line the error comes up.
Comments
![](http://jazz.net/_images/myphoto/d0f7b0b7bfc90721959d790b8a9bf79f.jpg)
thanks.. I see that now.. it 'seems' I should be able to save all the new items all at once
as the project area changes between iterations, and you have to go get it again, then get the working copy.
thanks for the pointer.. least it doesn't crash now!!
![](http://jazz.net/_images/myphoto/e5e63d5878217b64611c1df9401b7cd3.jpg)
Always happy to help out one of the premium contributors here, if I can. You know so much, so if you have questions they are usually tough ones 8-)
![](http://jazz.net/_images/myphoto/d0f7b0b7bfc90721959d790b8a9bf79f.jpg)
(I hate question editor space on this forum) see next 'answer'
3 other answers
![](http://jazz.net/_images/myphoto/d0f7b0b7bfc90721959d790b8a9bf79f.jpg)
thx.. one other question, general info..
volitility of item handles.
so I create a timeline object. and save its handle. then start thru the process of bulding the iteration tree.
I get the list of timelines in the project.
IDevelopmentLineHandle[] dlh = iprja_prod.getDevelopmentLines();
I need to know if the current timeline is the project timeline.
IDevelopmentLineHandle prodprojectHandle = iprja_prod.getProjectDevelopmentLine();
so, I want to use equals().
if(prodprojectHandle.equals(dlh[i]))
but the handle returned by getProjectDevelopmentLine()
does not match any timeline in the list of timelines. .getDevelopmentLines()
so I am confused, how can that be?
![](http://jazz.net/_images/myphoto/d0f7b0b7bfc90721959d790b8a9bf79f.jpg)
thanks.. javadoc comments on the getProjectDevelopmentLine()
The development line returned by this method is included in the set of lines returned from getDevelopmentLines().
ok, working thru the server code it uses sameItemId()
if(prodprojectHandle.sameItemId(dlh[i])) works.
and you can save the entire array of timelines and iterations in one save() operation.
you have to go back and process them again to handle archived, as there is no 'type', its a repository operation to archive.. ugh..
Comments
sam detweiler
Dec 16 '13, 5:17 p.m.the code for the failure says that the objects appear not to be cross linked properly