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

Not able to get process configuration source using plain java API on RTC 6!


Hello ,

I am trying to get the process configuration source xml using java api through the code below:

 
IProcessClientService processClient = (IProcessClientService) teamRepository.getClientLibrary(IProcessClientService.class); 
 URI uri = URI.create(projectArea.replaceAll(" ", "%20")); 
 try { 
 processArea = (IProcessArea) processClient.findProcessArea(uri, null, null); 
 } 
catch (TeamRepositoryException e)
 { 
 e.printStackTrace(); 
 } 
 IProcessItemService processItemService = (IProcessItemService) teamRepository.getClientLibrary(IProcessItemService.class); 
 IWorkingCopyManager workingCopyMgr = processItemService.getWorkingCopyManager(); IProjectAreaWorkingCopy projectAreaCopy = (IProjectAreaWorkingCopy) workingCopyMgr.createPrivateWorkingCopy(processArea);
 IDocument doc = projectAreaCopy.getProcessSpecification();
 String docXml = doc.get();



But, when i print the string returned by 'doc.get()' i get an empty string i.e. ""
I don't see any error or any exceptions anywhere and the user used to log in has access to process specification which i confirmed through the eclipse client.
The same code works with client 5 libraries for RTC 6.0.4 server but not with client 6 libraries. 
Am i missing something or is there something more to be done server side to make it compatible with version 6 libraries? I am quite new to extending RTC so please forgive me if there are any mistakes.

0 votes

Comments

 UPDATE:


When i try to get the xml source with a bit different code as below:

IContentManager icm = teamRepository.contentManager();
Map<?, ?> processData = processArea.getProcessData();
IContent processSource = (IContent)processData.get("com.ibm.team.internal.process.compiled.xml");
OutputStream os = new ByteArrayOutputStream();
 try {
icm.retrieveContent(processSource, os, null);
} catch (TeamRepositoryException e) {
e.printStackTrace();
}


I get exception as below:
com.ibm.team.repository.common.TeamRepositoryException: The following header was missing from the server response: Content-Length.


Accepted answer

Permanent link

Thanks Ralph.

Just to update if anyone else comes around a similar issue, after debugging a little and reading around i found the issue to be similar to this defect: Defect 421308 

Ralph Schoon selected this answer as the correct answer

0 votes


One other answer

Permanent link

I have this snippet lying around. Don't ask me about details.

                            // get it
                            IProjectArea project = (IProjectArea) (repo
                                    .itemManager().fetchCompleteItem(iparenthandle,
                                    IItemManager.DEFAULT, sPm));
                            System.out.println("have parent project name = "
                                    + project.getName());
                            // get the process data
                            @SuppressWarnings("unchecked")
                            Map<string, object=""> pd = ip.getProcessData();
        ////  here is the xml extract
                            // get the process config content object
                            IContent processSource = (IContent) pd.get(keyname);
                            if (processSource != null)
                            {
                                System.out.println("have xml source");
                                saveXMLSource(ip, processSource, icm, sPm);
                            }                             
</string,>

0 votes

Comments
Thank you for your reply.
After trying, i get exception at:

icm.retrieveContent(processSource, os, null);


I get exception as below:
com.ibm.team.repository.common.TeamRepositoryException: The following header was missing from the server response: Content-Length. 

As I said "Don't ask me about details.". I am pretty sure the code has worked. You could also search the SDK for how the code is used in the RTC client. I am not going to remote debug this.

For whatever reason the code you are using seems to miss a header in the REST calls it finally does. Search the SDK for how the calls are used in RTC and in the tests in the SDK.

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

Question asked: Aug 08 '18, 7:41 a.m.

Question was seen: 1,603 times

Last updated: Aug 21 '18, 2:17 a.m.

Confirmation Cancel Confirm