create timeline api, help
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
Ralph Schoon (63.3k●3●36●46)
| answered Dec 17 '13, 7:14 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
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. sam detweiler selected this answer as the correct answer
Comments
sam detweiler
commented Dec 17 '13, 7:54 a.m.
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!!
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-)
(I hate question editor space on this forum) see next 'answer'
|
3 other answers
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?
Comments
Ralph Schoon
commented Dec 17 '13, 10:08 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
No idea....
|
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..
|
Welcom to timelines... :)
Comments
Ralph Schoon
commented Dec 17 '13, 10:39 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Oh my, I wanted to build a timeline manager to remove repetitive tasks I so despise for a long time.... I might have to rethink :-)
|
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.
Comments
the code for the failure says that the objects appear not to be cross linked properly