It's all about the answers!

Ask a question

list of streams in a project area?


Leandro Leal (14614245) | asked Apr 16 '12, 2:44 p.m.
I have this configuration:

1 Project Area: APP00001_Aplicacion1
4 Streams: Aplicacion1_Calidad, Aplicacion1_Desarrollo, Aplicacion1_Integracion,Aplicacion1_Produccion

how I can create a list of streams for the project area "APP00001_Aplicacion1" using Java Lib Plain API which results:

Aplicacion1_Calidad
Aplicacion1_Desarrollo
Aplicacion1_Integracion
Aplicacion1_Produccion

this is my code but dont work:

IProgressMonitor monitor = new NullProgressMonitor();
IWorkspaceManager wm = SCMPlatform.getWorkspaceManager(teamRepository);
IWorkspaceSearchCriteria wsSearchCriteria = IWorkspaceSearchCriteria.FACTORY.newInstance();
wsSearchCriteria.setKind(IWorkspaceSearchCriteria.STREAMS);
wsSearchCriteria.setPartialOwnerNameIgnoreCase(ProjectArea);
List <IWorkspaceHandle> workspaceHandles = wm.findWorkspaces(wsSearchCriteria, Integer.MAX_VALUE, monitor);

in this post https://jazz.net/forums/viewtopic.php?t=14261&highlight= also recommend the use of IScmQueryService, but I can not find the method cancommonData.getScmQueryService(); in the documentation and I have no idea that as I

public static IWorkspace findStream( String streamName,
SportServiceData commonData )
throws TeamRepositoryException
{
IScmQueryService scmQueryService = commonData.getScmQueryService();
IRepositoryItemService repositoryItemService = commonData
.getRepositoryItemService();
IWorkspaceSearchCriteria criteria = IWorkspaceSearchCriteria.FACTORY
.newInstance();
criteria.setKind( IWorkspaceSearchCriteria.STREAMS );
criteria.setExactName( streamName );
List<IWorkspaceHandle> workspaceHandles = scmQueryService
.findWorkspaces( criteria, Integer.MAX_VALUE, null )
.getItemHandles();
if (workspaceHandles.size() > 1)
{
throw new TeamRepositoryException( workspaceHandles.size() + " \""
+ streamName + "\" streams found" );
}
if (!workspaceHandles.isEmpty())
{
IWorkspaceHandle workspaceHandle = workspaceHandles.get( 0 );
return (workspaceHandle.hasFullState())
? (IWorkspace)(workspaceHandle.getFullState())
: (IWorkspace)(repositoryItemService.fetchItem(
workspaceHandle, IRepositoryItemService.COMPLETE ));
}
return null;
}

Be the first one to answer this question!


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.