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

RTC SCM API : Identify Streams which doesnt belong to folder

Dear Team,

rtc version: 6.0.6.1

we are using RTC Feature of Folders to group our Streams to avoid crowding of streams.
this is currently working well for us and colleagues directly to their folders to see relevant streams for Project.

This permission is not given to users, as this has to be at project area level.
as there will be lot of streams created and we would like to help users to add this relevant folder without coming to us.

But problem here, we do not have option to really check which streams are added to folder and not. For this we  have manually check.

Could you please provide some examples or options, how i can get such information.

for example :
Stream name, Folder name
Stream x, ab14
Stream y,  no folder assigned.

We would like to use such a report and do for ones which are not under any folder.

0 votes

Comments
Dear team,

can any one of you update on this?

Thanks


Accepted answer

Permanent link
You will have to write your own plain-Java code to go fetch all the 'folders' in a given Project Area, and then to the fetch the items in those folders (ex: to see if they contain the stream you are interested in). As you traverse the folder hierarchy, you can build up your own data structure in what ever form is easiest to address your use cases.
Note: A stream could exist in multiple folders.


Here is some sample client-side code to do this (server-side code can be seen in IItemContainerService):

IItemContainerHandle rootNode; // Note: All Project Areas have an invisible 'rootNode'
IItemContainerService folderService = SCMPlatform.getWorkspaceManager(getRepository()).getItemContainerService();
        rootNode= folderService.getRootContainer(IWorkspaceManager.ROOT_FOLDER_ID, getProjectAreaHandle(), IItemContainerService.FLAG_NONE);

IItemContainerQueryResult queryResult = runContainerQuery(rootNode, monitor);
// queryResult.getItems() gives a list of IItemHandle (you can safely cast them to this)... if you know the stream itemId then you can just check if it exists in this returned list
// some of the items in this list could be streams (IWorkspaceHandle) or folders (ItemContainerHandle), and potentially other types...
...

    private IItemContainerQueryResult runContainerQuery(IItemContainerHandle parent, IProgressMonitor monitor) throws TeamRepositoryException {
        SubMonitor progress = SubMonitor.convert(monitor, 100);
        ItemContainerQueryParams queryParams = DtoFactory.eINSTANCE.createItemContainerQueryParams();
        queryParams.setContainer(parent);
        queryParams.setFlags(IItemContainerService.QUERY_CHECK_ACCESSIBLE);
        IItemContainerService folderService = SCMPlatform.getWorkspaceManager(getRepository()).getItemContainerService();
        IItemContainerQueryResult result = folderService.getChildren(queryParams);
        progress.done();
        return result;
    }




vinitha dsouza selected this answer as the correct answer

0 votes

Comments
let us give a try and come back :)
thank you

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

Question asked: Jan 20 '21, 7:40 a.m.

Question was seen: 958 times

Last updated: Feb 15 '21, 7:49 a.m.

Confirmation Cancel Confirm