It's all about the answers!

Ask a question

How to get list of components from a given project area?


akshay p (15119) | asked Aug 19 '19, 3:03 a.m.
edited Aug 19 '19, 7:34 a.m. by Ralph Schoon (63.6k33647)
How to get list of components from a given project area.

I have a repository and a Project area. I want to get the list of all the components and its different versions from that particular PA.

Please suggest.

Comments
1
Geoffrey Clemm commented Aug 19 '19, 12:47 p.m. | edited Aug 19 '19, 12:50 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

What do you mean by "its different versions"?   All the baselines of the component?


Also note that a component does not belong to a particular project area ... it just can get it access control from a project area.   So a component can be related to a project area, but its data (such as its baselines) are independent of which project area it is associated with.

2 answers



permanent link
akshay p (15119) | answered Aug 20 '19, 1:42 a.m.
for example,

in stream 1, compA has 2 files but in stream2, compA has 3 files.
When i say compA in stream1's context, I should get 2 files. When i say compA in context of stream2, I should get 3 files.

Currently we have a task where we need to filter out the components specific to a project area.
There are lot of comps in a server, but we want only present in some of the PAs

Comments
Ralph Schoon commented Aug 20 '19, 2:33 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Unless you become more precise in what you want to do and why, to achieve what, don't expect too many answers. Also see: How should I ask a question in the Forum if I want to receive useful answers?


Based on your question My answer would be: 
  1. Open the Eclipse client open a project area, navigate to the Source Control node in the team artifacts view associated to the project area.
  2. Open the All Components node to see all components that are owned by the project area. 
  3. Open the stream and see the components. 
  4. View the baselines of the components for the various configurations. 
  5. Open the repository files to see the file versions.


akshay p commented Aug 20 '19, 2:53 a.m.
Hi Ralph, thank you for the response.

We want to programmatically get a list of all components/handle which are present in a PA. Is there any way or API to do so?

Ralph Schoon commented Sep 09 '19, 8:39 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Try com.ibm.team.scm.common.dto.IComponentSearchCriteria 


permanent link
David Lafreniere (4.8k7) | answered Aug 20 '19, 9:50 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
You can query for components that are 'owned' by a project area or team area.
The client-side API for doing this is:

IComponentSearchCriteria criteria= IComponentSearchCriteria.FACTORY.newInstance();
criteria.getFilterByOwnerOptional().add(projectAreaHandle);
IWorkspaceManager wm = SCMPlatform.getWorkspaceManager(repo);
List<IComponentHandle> componentsInProjectArea = wm.findComponents(criteria, maxResults, monitor)

Note: If you also want to include all child team areas of the project area, you would have to add each one as well.
You can iterate across IProjectArea.getTeamAreas() and add them to the owner filter.

Note: Just because a component is owned by ProjectAreaA, does not mean it can't be used in StreamB that is 'owned' by ProjectAreaB. Components are not 'tied to a particular project really. Components can also be owned by contributors (users), and also used in a Project Area.

The component owner is really used to determine who can modify properties of the component (ex: visibility, custom attributes on it, etc.) - this can be restricted to a contributor (user), or a Project Area or Team Area. The component visibility can be used to control who can see the component (and all the change sets inside it).

Given this, re-think if your question still makes sense... perhaps you want to get the list of streams in a given project area, and look inside all the components (without caring who owns the component). In which case you would look at this API: IWorkspaceSearchCriteria.getFilterByOwnerOptional.add(projectAreaHandle).

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.