How to get list of components from a given project area?
akshay p (15●1●19)
| asked Aug 19 '19, 3:03 a.m.
edited Aug 19 '19, 7:34 a.m. by Ralph Schoon (63.6k●3●36●47)
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.
|
2 answers
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 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:
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?
Try com.ibm.team.scm.common.dto.IComponentSearchCriteria |
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
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.
Comments
What do you mean by "its different versions"? All the baselines of the component?