It's all about the answers!

Ask a question

create timeline api, help


2
1
sam detweiler (12.5k6195201) | asked Dec 16 '13, 4:43 p.m.
edited Dec 16 '13, 5:37 p.m.
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)

Comments
sam detweiler commented Dec 16 '13, 5:17 p.m.

the code for the failure says that the objects appear not to be cross linked properly


private void validateProjectAreaDevelopmentLines(IProjectArea area) throws TeamRepositoryException {
IDevelopmentLineHandle[] devLineHandles = area.getDevelopmentLines();
IFetchResult fetchResult = getService(IRepositoryItemService.class).fetchItemsPermissionAware(devLineHandles, IRepositoryItemService.COMPLETE);
if (fetchResult.getNotFoundItems().size() > 0) { 

but I don't see the missing or wrong data

Accepted answer


permanent link
Ralph Schoon (63.1k33646) | 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!!
 


Ralph Schoon commented Dec 17 '13, 8:03 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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-)


sam detweiler commented Dec 17 '13, 9:51 a.m. | edited Dec 17 '13, 9:51 a.m.

(I hate question editor space on this forum)  see next 'answer'



3 other answers



permanent link
sam detweiler (12.5k6195201) | answered Dec 17 '13, 9:51 a.m.
 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....


permanent link
sam detweiler (12.5k6195201) | answered Dec 17 '13, 10:33 a.m.
edited Jan 01 '14, 3:46 p.m.
 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.. 

permanent link
Rod Brandt (2613) | answered Dec 17 '13, 10:35 a.m.
 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


Register or 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.