It's all about the answers!

Ask a question

jazz Java APIs did not find process parent-child relationship if the two project areas are in different CCMs


Rick Liu (111) | asked Sep 26 '17, 5:26 p.m.
edited Sep 27 '17, 4:07 p.m. by Geoffrey Clemm (30.1k33035)

Hello all,

I tried to use below jazz Java APIs to get process parent-child relationship among project areas in RTC; and found out that if the parent project area is in different CCM, the APIs treated the child project area as a regular project (no parent relationship). RTC Web GUI allows users to create such parent-child relationship.

Could anyone advise how to solve this issue?

Thanks,

Rick

import org.eclipse.core.runtime.IProgressMonitor;
import
com.ibm.team.repository.client.IItemManager;

import
com.ibm.team.repository.client.ITeamRepository;
import
com.ibm.team.repository.client.TeamPlatform;
import
com.ibm.team.repository.common.IContent;

import
com.ibm.team.repository.common.TeamRepositoryException;
import
com.ibm.team.process.client.*;
import
com.ibm.team.process.common.IProjectArea;

import
com.ibm.team.process.common.IProjectAreaHandle;
import
com.ibm.team.process.internal.common.ProjectArea;


Comments
Rick Liu commented Sep 27 '17, 8:52 a.m. | edited Sep 27 '17, 4:05 p.m.

Hi Ralph/Amy,

How is the parent-child relationship stored in RTC? Can we get this data by querying RTC database; or searching XML or any other data files?

Thanks,

Rick


Geoffrey Clemm commented Sep 27 '17, 4:09 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 Just to confirm, if you ask a given project area for its process parent project area, it returns nothing if the process parent project area is in another repository?   Or is it that if you ask a given project area for all its process child project areas, it only returns the process child project areas that are in the same repository?  (Or both?)


Rick Liu commented Sep 28 '17, 8:59 a.m. | edited Sep 28 '17, 3:23 p.m.

Hi Geoffrey,

The issue is: if I ask a given project area for its process parent project area, it returns nothing if the process parent project area is in another repository.

Here are the procedures:
1. Login the repo: ITeamRepository repo = getRepo(url);
2. Get list of projects: List<IProjectArea> projectList = getProjectArea(repo, sPm, projType);
3. Process each project to find its parent project:
for (int i = 0; i < projectList.size(); i++) {
IProjectArea ip = projectList.get(i);
Map<Object, Object> pd = ip.getProcessData();
// get the process config content object
IContent processSource = (IContent) pd.get(keyName); (keyName = "com.ibm.team.internal.process.compiled.xml")

If the process parent project area is in another repo, processSource is null.
How did you treat the process parent project areas differently when they are in the same repo or diiferent repo? Do you have different methods to handle this case in IContent, IProjectArea, or other classes?

Thanks,

Rick


Ralph Schoon commented Sep 28 '17, 9:05 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 The API you are using is not the API I was using in https://rsjazz.wordpress.com/2014/11/28/the-process-sharing-api/


Have you tried if that API works?


Geoffrey Clemm commented Sep 28 '17, 3:28 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 First a disclaimer ... I don't know that code, so all I am doing now is speculating.   My speculation is that the API you are using (to obtain the process content) only works if the process content is located on the same server.   If you want process content that is located on another server, you need to use code like Ralph's to first obtain the process provider, and then access the process content from that provider.

2 answers



permanent link
Ralph Schoon (63.3k33646) | answered Sep 27 '17, 8:59 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Sep 27 '17, 9:11 a.m.

Dang,

I missed the point here. I saw parent child. Parent child only exists as links between work items.

What this seems to be about is Process Sharing, where a project area provides the process that is shared. This works across ccm's. Sorry for the misunderstanding.

If you want to follow that in the API I have explained that in https://rsjazz.wordpress.com/2014/11/28/the-process-sharing-api/

I did not look into cross CCM's back then. I have looked into working with multiple CCM's in another context and I think you can do it by having multiple logins using separate ITeamRepository objects (one for each CCM you talk to). However, as I have not tried that myself, I can not tell how to do that in this context.



Comments
Amy Silberbauer commented Sep 27 '17, 9:01 a.m.
JAZZ DEVELOPER

Thanks, Ralph :)


permanent link
Rick Liu (111) | answered Sep 29 '17, 2:46 p.m.

I saw that if the process content is located in another repo, the  project area data populated:
internalRemoteProcessProviderUrl: https://rtc.nam.nsroot.net/rbcasa1/process/project-areas/_kInBAcqLEeW9kJcCKCKgdA
Is there a method to get the name of that process?
I tried below code; and got error.

else { // check if the parent project is in a remote repo
      IProcessProviderCacheItemHandle ichandle = ((ProjectArea) ipi).getRemoteProcessProvider();
      if (ichandle != null) {
         String rurl = ((ProjectArea) ipi).getRemoteProcessProviderUrl();
         // rurl = https://rtc.nam.nsroot.net/rbcasa1/process/project-areas/_kInBAcqLEeW9kJcCKCKgdA
         rurl = "https://rtc.nam.nsroot.net/rbcasa1"; (hard code to test below methods)
         if (loginRepo (rurl, userID, passWd, sPm) != null) {
             // get the repository object where we are connecting
             ITeamRepository repo2 = getRepo(rurl);
             IProjectArea pProject = (IProjectArea) (repo2
                               .itemManager().fetchCompleteItem(ichandle,
                                 IItemManager.DEFAULT, sPm));
             System.out.println("have parent project name = "
                                   + pProject.getName());
 ....
}


Comments
Ralph Schoon commented Oct 04 '17, 4:08 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 I think I have shared what I can in my comment. The code above is missing too much e.g. so no one can even understand what it is doing.


My comment:

If you want to follow that in the API I have explained that in https://rsjazz.wordpress.com/2014/11/28/the-process-sharing-api/ I have looked into working with multiple CCM's in another context and I think you can do it by having multiple logins using separate ITeamRepository objects (one for each CCM you talk to). 



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.