how to fetch streams and display its name on console using server side API
Hi All,
I want to fetch all the streams of a project area and display their names on console using server side API.
IWorkspaceManager workspaceManager = SCMPlatform.getWorkspaceManager(teamRepository);
IWorkspaceSearchCriteria wsSearchCriteria = WorkspaceSearchCriteria.FACTORY.newInstance();
wsSearchCriteria.setKind(IWorkspaceSearchCriteria.STREAMS);
wsSearchCriteria.setPartialOwnerNameIgnoreCase(projectAreaName);
List <IWorkspaceHandle> workspaceHandles = workspaceManager.findWorkspaces(wsSearchCriteria, Integer.MAX_VALUE, monitor);
IWorkspaceConnection workspaceConnection = workspaceManager.getWorkspaceConnection(workspaceHandles.get(0),monitor);
String obj="";
obj=workspaceConnection.getName();
System.out.println(obj);
this code does the task on client side.
How this can be done using server side API ?
Thank You.
Accepted answer
com.ibm.team.scm.common.dto.IWorkspaceSearchCriteria most likely does not belong there. You most likely have to add another service e.g. com.ibm.team.scm.common.IScmService
Your extension class also has to most likely extend AbstractScmService rather than AbstractService. See https://rsjazz.wordpress.com/2012/11/01/restrict-delivery-of-changesets-to-workitem-types-advisordelivery-of-changesets-associated-to-wrong-work-item-types-advisor/ for an example that works on an SCM operation.
Your extension class also has to most likely extend AbstractScmService rather than AbstractService. See https://rsjazz.wordpress.com/2012/11/01/restrict-delivery-of-changesets-to-workitem-types-advisordelivery-of-changesets-associated-to-wrong-work-item-types-advisor/ for an example that works on an SCM operation.
2 other answers
Hi,
you have to use com.ibm.team.scm.common.internal.IScmQueryService instead of IWorkspaceManager. This service have a findWorkspace method that accepts IWorkspaceCriteria.
Of course you have to obtain the service after you've defined it in the plugin.xml as requiredservice.
Comments
showing 5 of 6
show 1 more comments
I could not paste it in comment.
Here is my plugin.xml
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="com.ibm.team.process.service.operationParticipants">
<operationParticipant
class="com.datamato.displaystream.DisplayStream"
id="com.datamato.displaystream.operationParticipant1"
name="Show Stream Name IN WIE"
operationId="com.ibm.team.workitem.operation.workItemSave">
<extensionService
componentId="com.datamato.displaystream.extensionService1"
implementationClass="com.datamato.displaystream.DisplayStream">
<prerequisites>
<requiredservice interface="com.ibm.team.workitem.service.IWorkItemServer"/>
<requiredservice interface="com.ibm.team.workitem.common.IWorkItemCommon"/>
<requiredservice interface="com.ibm.team.scm.common.internal.IScmQueryService"/>
<requiredservice interface="com.ibm.team.scm.common.dto.IWorkspaceSearchCriteria"/>
</prerequisites>
</extensionService>
</operationParticipant>
</extension>
</plugin>
Here is my plugin.xml
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="com.ibm.team.process.service.operationParticipants">
<operationParticipant
class="com.datamato.displaystream.DisplayStream"
id="com.datamato.displaystream.operationParticipant1"
name="Show Stream Name IN WIE"
operationId="com.ibm.team.workitem.operation.workItemSave">
<extensionService
componentId="com.datamato.displaystream.extensionService1"
implementationClass="com.datamato.displaystream.DisplayStream">
<prerequisites>
<requiredservice interface="com.ibm.team.workitem.service.IWorkItemServer"/>
<requiredservice interface="com.ibm.team.workitem.common.IWorkItemCommon"/>
<requiredservice interface="com.ibm.team.scm.common.internal.IScmQueryService"/>
<requiredservice interface="com.ibm.team.scm.common.dto.IWorkspaceSearchCriteria"/>
</prerequisites>
</extensionService>
</operationParticipant>
</extension>
</plugin>
Comments
sam detweiler
Aug 03 '15, 7:43 a.m.vikrant kamble
Aug 03 '15, 8:17 a.m.sam detweiler
Aug 03 '15, 8:30 a.m.vikrant kamble
Aug 03 '15, 8:42 a.m.vikrant kamble
Aug 03 '15, 8:47 a.m.sam detweiler
Aug 03 '15, 8:52 a.m.