It's all about the answers!

Ask a question

How to find all categories which belongs to a team


Thomas Becker (152) | asked Nov 03 '22, 10:37 a.m.

 I have a EWM (RTC) PA with hundreds of teams and categories. Some times a team must be removed due to a company re-organization. Before I archive the team, I have to make sure that all categories which belongs to this team are either archived or mapped to any other team. Therefore I'm looking for a possibility to see all categories and only theses categories which belongs to a specific team. 


How can I do that?  

2 answers



permanent link
Davyd Norris (2.0k115) | answered Nov 03 '22, 7:39 p.m.
You can do this via OSLC, but it'll need a couple of jumps - I wrote a little Javascript file to do it but you could do it in Python or whatever language

To get all the categories and associated team areas for a project, use the call:

https://<server>/ccm/oslc/categories?oslc_cm.query=rtc_cm:projectArea="<project area ID>" and rtc_cm:archived=false

project area ID is the ID of the project area - you can see this if you go into "Manage This Project Area"

I use Accept: application/json to fetch it as a JSON document. If you have hundreds of categories then you'll also need to pay attention to the size of the result set and potentially fetch multiple pages. Look for the oslc_cm:next entry in the response, which will give you the next page of values.

This call will return each category in the following format:

{
    "rtc_cm:projectArea": {
      "rdf:resource": "https:\/\/<server>\/ccm\/oslc\/projectareas\/<project area ID>"
    },
    "dc:description": "",
    "rtc_cm:archived": false,
    "rdf:resource": "https:\/\/<server>\/ccm\/resource\/itemOid\/com.ibm.team.workitem.Category\/_d_Na0M8HEeu3pbGmws67-Q",
    "dc:title": "BM3 CRD",
    "rtc_cm:defaultTeamArea": {
      "rdf:resource": "https:\/\/<server>\/ccm\/oslc\/teamareas\/_VhBiAGE0EeuS46GN6T1p0A"
    },
    "rtc_cm:teamAreas": null,
    "rtc_cm:hierarchicalName": "Projects - Internal\/BLah\/Blah Blah\/BM3 CRD",
    "rtc_cm:depth": 3
  }

A second call on the defaultTeamArea URL will get the team area info. My code fetches the team area result and uses that in an array, and then I add the category info underneath that. I then look up the team area in the array and add it if it doesn't exist


Comments
Thomas Becker commented Nov 09 '22, 6:03 a.m.

 I was more looking for a kind of tool or widget instead of a description of principles. But anyway, I was able to extract the team IDs from the results. Just creating a script which collects all the results and extracts what I want to see is a problem for me. 


Anyway, this brings me a step forward. 
Thanks a lot. 


Davyd Norris commented Nov 09 '22, 6:03 p.m.
That wasn't a description of principles - it was an explicit answer to your question because there is no out of the box widget.

But now you can build your own!

Thomas Becker commented Nov 10 '22, 5:32 a.m.

Yes, that's what I mean. And it's very helpful. 


But it's surprising for me, that there is no out of the box solution. This problem should have been identified by many other users before and I am surprised that everyone has to build an own script.

<o:p> </o:p>


Ralph Schoon commented Nov 10 '22, 5:37 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

My answer is, that very few project areas I have seen so far have hundreds of teams and categories. So this is a highly custom use case. This probably also requires caching and other optimization to keep the system performant that was not available in the beginning.


There are a multitude of such highly custom requests that look to be useful but happen to only be useful for few users. My blog https://rsjazz.wordpress.com/ is full of examples that I have collected over time, and the Java API related to it.


Davyd Norris commented Nov 10 '22, 5:32 p.m.
I agree with Ralph - it is *extremely* rare to have a single project area with hundreds of teams and categories.

I have seen only three in all my clients and probably only one was justified, and it was the one with the smallest larger number. Another was a client trying to implement a horrible process workflow that should have been redesigned, and the last was just plain wrong and was them trying to do everything in a single PA when they should have used 6-8

permanent link
Ralph Schoon (62.3k33643) | answered Nov 03 '22, 11:26 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 I would write a Plain Java Client Library application that uses com.ibm.team.workitem.common.IWorkItemCommon.findCategoriesOfProcessArea(IProcessAreaHandle, ItemProfile<ICategory>, IProgressMonitor) to find the categories and to analyze whatever I need to be analyzed.


It might be possible that there are other APIs like the reportable REST API or the Foundation API that could be used.
I think the Plain Java Client Libraries would be fastest for me, because I have most experience with it.

Your answer


Register or to post your answer.