Reputation: 311
I am working an automation for IBM Rational Team Concert (IBM aka Jazz RTC).
How may one a list all components owned by a specific project area? Which are the required API calls?
I could not find any getters in the IProjectArea
instance, nor service or client instances with such methods. And I could not figure out how to use IComponentSearchCriteria
for this purpose.
Upvotes: 1
Views: 533
Reputation: 311
The components owned by a project area may be queried using IComponentSearchCriteria
. However, the API is not quite clear how to specify the owning project area.
IWorkspaceManager
from the ITeamRepository
, which contains the findComponents
method.IProjectAreaHandle
for your project area. I you have only the project area name, check this question to learn how to get the IProjectAreaHandle for the project area name.IComponentSearchCriteria
and set the filterByOwnerOptional
to your IProjectAreaHandle
instance.IWorkspaceManager.findComponents(...)
to get a list of IComponentHandles
. The first parameter is the search criteria. Se second parameter is the maximum number of results (which I set to IWorkspaceManager.MAX_QUERY_SIZE
, which is 512. The third parameter is the progress monitor, which may be null
.IItemManager.fetchCompleteItems(...)
fetch the full IComponent
instances.Here is an example in Groovy:
List<IComponentHandle> listComponents(String projectAreaName) {
final manager = repositoty.getClientLibrary(IWorkspaceManager) as IWorkspaceManager;
final criteria = IComponentSearchCriteria.FACTORY.newInstance();
final IProjectArea projectArea = findProjectAreaByName(projectAreaName)
criteria.filterByOwnerOptional.add(projectArea)
final List<IComponentHandle> handles = manager.findComponents(criteria, IWorkspaceManager.MAX_QUERY_SIZE, null)
final itemManager = repositoty.itemManager()
return itemManager.fetchCompleteItems(handles, IItemManager.DEFAULT, null) as List<IComponent>
}
Upvotes: 2