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

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)

1

2 votes

Comments

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

0 votes

Comments

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

Permanent link
 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? 

0 votes

Comments

No idea....


Permanent link
 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.. 

0 votes


Permanent link
 Welcom to timelines... :)

0 votes

Comments

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

Question asked: Dec 16 '13, 4:43 p.m.

Question was seen: 6,344 times

Last updated: Jan 01 '14, 3:46 p.m.

Confirmation Cancel Confirm