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

How to query for projects that contain empty components

I'm currently on RTC 3, but this is a question for 5, which we will upgrade to soon.

I'm looking for a way to search across all our projects(or just all of RTC repository) for Empty Components, to see which projects are not effectively checking in code, or components that just aren't in use.

Is there way to do this simply?

0 votes



One answer

Permanent link
Hi Michael,

I am not aware a simple way on RTC except writing a simple code with SDK. With using SDK, you can count the number of change sets in a component. If it is zero that means there is no changesets in a component. I hope it might help you.

private static int countChangesets(IProjectArea projectArea) throws TeamRepositoryException {
IProgressMonitor monitor = new NullProgressMonitor();
ITeamRepository repository = (ITeamRepository)projectArea.getOrigin(); 
IWorkspaceManager workspaceManager = SCMPlatform.getWorkspaceManager(repository);
IWorkspaceSearchCriteria wsSearchCriteria = WorkspaceSearchCriteria.FACTORY.newInstance();
wsSearchCriteria.setKind(IWorkspaceSearchCriteria.ALL);
wsSearchCriteria.setPartialOwnerNameIgnoreCase(projectArea.getName());
IChangeSetSearchCriteria changesetCriteria = IChangeSetSearchCriteria.FACTORY.newInstance(); 
int numberOfChangesets = 0;
List <IWorkspaceHandle> workspaceHandles = workspaceManager.findWorkspaces(wsSearchCriteria, Integer.MAX_VALUE, monitor);
for (IWorkspaceHandle workspaceHandle: workspaceHandles) {
IWorkspaceConnection workspaceConnection = workspaceManager.getWorkspaceConnection(workspaceHandle, null);
List componentList = workspaceConnection.getComponents();
for (Object obj : componentList) {
IComponentHandle componentHandle = (IComponentHandle)obj;
IComponent component = (IComponent)repository.itemManager().fetchCompleteItem(componentHandle, IItemManager.DEFAULT, monitor);
changesetCriteria.setComponent(component);
List<IChangeSetHandle> changeSetList = SCMPlatform.getWorkspaceManager(repository).findChangeSets(changesetCriteria, IWorkspaceManager.MAX_QUERY_SIZE, null); 
numberOfChangesets = numberOfChangesets + changeSetList.size();
}
}
return numberOfChangesets;
}

0 votes

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
× 12,029
× 201

Question asked: Sep 24 '15, 5:47 p.m.

Question was seen: 3,599 times

Last updated: Sep 24 '15, 8:06 p.m.

Confirmation Cancel Confirm