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.
Accepted answer
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
One other answer
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,>
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.
Comments
Prathamesh Dharangutte
Aug 09 '18, 7:37 a.m.UPDATE: