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

how to retrieve the name of all Streams of a project area?

Hi,

i need retrieve the name of all streams of a project area x, using API JAVA LIB. how to do this?

my code is this:

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);



thanks!

0 votes



5 answers

Permanent link
did u look at the build system toolkit for apis? this provides additional classes for accessing streams and their content

0 votes


Permanent link
did u look at the build system toolkit for apis? this provides additional classes for accessing streams and their content


may indicate a link to documentation or an example

0 votes


Permanent link
Hi,

i need retrieve the name of all streams of a project area x, using API JAVA LIB. how to do this?

my code is this:

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);

thanks!


Hi,

You are on the right track.
That code you have will give you the handles of the streams, however you now have to fetch them from the repository so that you can get the most recent name.

do this from where you left off (Not tested, but should be mostly right):


List<String> streamNames = new ArrayList<String>(workspaceHandles.size());

IFetchResult fetchResults = teamRepository.itemManager().fetchCompleteItemsPermissionAware(workspaceHandles, IItemManager.REFRESH, monitor);
List<Object> retrievedStreams = fetchResults.getRetrievedItems();

for (Object fetchedObject : retrievedStreams) {
if (fetchedObject instanceof IWorkspace) {
IWorkspace stream = (IWorkspace) fetchedObject;
streamNames.add(stream.getName());
}
}


Note: using IItemManager.REFRESH will take longer but will give you the up-to-date names of the streams in the repository. Or you could use IItemManager.DEFAULT to have it possibly run quicker, giving you the names that are from the local cache (but there's a small chance that they could be stale if someone were to rename the streams)

Also, at a quick glance, if the first part that you have doesn't work (due to wsSearchCriteria.setPartialOwnerNameIgnoreCase()) , do this;

List<IProcessArea> processAreas = new ArrayList<IProcessArea>();
...
add the process areas you care about.
...
...
wsSearchCriteria.getFilterByOwnerOptional().addAll(processAreas);
...

0 votes


Permanent link
Is it possible to do this in attribute customization (Javascript) to create dependent enumerations based on selected project area?

Thanks.

0 votes


Permanent link
Is it possible to do this in attribute customization (Javascript) to create dependent enumerations based on selected project area?

Thanks.


That I have no idea. Hopefully someone else who reads this can provide some insight.

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
× 10,938

Question asked: Apr 14 '12, 8:16 p.m.

Question was seen: 5,758 times

Last updated: Apr 14 '12, 8:16 p.m.

Confirmation Cancel Confirm