It's all about the answers!

Ask a question

How to find a IComponentHandle by name in a stream?


silencehill wu (5022632) | asked Dec 11 '12, 5:22 a.m.

How find a IComponentHandle by name in a stream?

I can use  findComponents of IWorkspaceManager  to get component, but if two streams have same component with name, how can I tell it?

Of course, I can use IWorkspaceConnection to filter stream, and get all components of IWorkspaceConnection. Then loop all component to filter the component out. But it cost too much time to compare all comopoent in stream.

So if any other easy method/api can be called to find out component by component name in a stream directly?

One answer



permanent link
Tim Mok (6.6k38) | answered Dec 11 '12, 9:50 a.m.
JAZZ DEVELOPER
edited Dec 11 '12, 9:53 a.m.
I can use findComponents of IWorkspaceManager to get component, but if two streams have same component with name, how can I tell it?
I assume you mean the components are not the same (different UUID) but have the same name.

I don't think there's any useful API for finding a component by name in this instance. It's more reliable to refer to a component by its UUID.

If you're only starting with the component name, you'll have to fetch all the components in the stream and do the processing client-side.

Another possibility is using the findComponents call and get all the components from the stream then running a comparison check on the UUID. This might be faster depending on the number of components with the same name and if the findComponents result doesn't have multiple components in the stream.

Your answer


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.