It's all about the answers!

Ask a question

WorkspaceManager's findAllWorkspaceNames() just stream names


Oliver Drees (1333) | asked Aug 03 '11, 10:40 a.m.
Somewhere in the forum I found an example on how to get workspace names of a process area and tried to use it like this:


IProcessArea processArea = getProject(projectName); // a method I wrote to get the the project from RTC
IWorkspaceManager wm = SCMPlatform.getWorkspaceManager(getRepository());
Set workspacesSet = wm.findAllWorkspaceNames(processArea, new MyMonitor());


However the findAllWorkspaceNames methods just returns the stream names of the process area.

When I trie a different approch using workspace search like the following I get no workspace handles back like I would imagine:



IWorkspaceSearchCriteria wsSearchCriteria = WorkspaceSearchCriteria.FACTORY.newInstance();
wsSearchCriteria.setKind(IWorkspaceSearchCriteria.WORKSPACES);
wsSearchCriteria.setExactOwnerName(processArea.getName());
List <IWorkspaceHandle> workspaceHandles = wm.findWorkspaces(wsSearchCriteria, Integer.MAX_VALUE, new MyMonitor());



The resulting List is empty.

I tried with RTC 3.0.1 plainjava API.

Can anybody tell me what I am doing wrong or if there is a bug with the API? Or can anybody point me to some documentation to get further information on this?

Thank you in advance,

- Oliver -

3 answers



permanent link
Geoffrey Clemm (30.1k33035) | answered Aug 04 '11, 12:21 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Workspaces are owned by users, not by project or team areas.

Cheers,
Geoff

On 8/3/2011 10:53 AM, odrees wrote:
Somewhere in the forum I found an example on how to get workspace
names of a process area and tried to use it like this:


IProcessArea processArea = getProject(projectName); // a
method I wrote to get the the project from RTC
IWorkspaceManager wm =
SCMPlatform.getWorkspaceManager(getRepository());
Set workspacesSet = wm.findAllWorkspaceNames(processArea, new
MyMonitor());


However the findAllWorkspaceNames methods just returns the stream
names of the process area.

When I trie a different approch using workspace search like the
following I get no workspace handles back like I would imagine:



IWorkspaceSearchCriteria wsSearchCriteria =
WorkspaceSearchCriteria.FACTORY.newInstance();
wsSearchCriteria.setKind(IWorkspaceSearchCriteria.WORKSPACES);
wsSearchCriteria.setExactOwnerName(processArea.getName());
List<IWorkspaceHandle> workspaceHandles =
wm.findWorkspaces(wsSearchCriteria, Integer.MAX_VALUE, new
MyMonitor());



The resulting List is empty.

I tried with RTC 3.0.1 plainjava API.

Can anybody tell me what I am doing wrong or if there is a bug with
the API? Or can anybody point me to some documentation to get further
information on this?

Thank you in advance,

- Oliver -

permanent link
Oliver Drees (1333) | answered Aug 05 '11, 7:01 a.m.
I see my misunderstanding regarding users and project areas.

But why does

Set workspacesSet = wm.findAllWorkspaceNames(processArea, new

MyMonitor());


gives me the names of the streams and not of the workspaces as the method name says? Is this a bug?

I tried to get all worspace names and wanted to open workspace connections for them to get further information of each workspace.

As far as I now understand I have to create a search criteria for the kind workspaces. With that I get back WorkspaceHandles with all workspaces in the repository. With them I can get IWorkspaceConnection objects to work with further. However I do not see how I can decide on if a workspace belongs to the project area I want to look at.

Is there a way to get the name of the project area from the work space handle?

Best Regards,

- Oliver -

permanent link
Geoffrey Clemm (30.1k33035) | answered Aug 05 '11, 10:06 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
I'm not fluent in the actual API calls, but I can provide some
conceptual guidance.

Under the hood, streams and workspaces have a shared implementation.
This sometimes shows through in the API, where "workspace" means
"workspace or stream".

So that probably is the case for the findAllWorkspaceNames, and since
streams belong to a process area while workspaces do not, that would
explain why you are only getting streams back from your query.

WRT finding out the process area of a stream (as a reminder, a
repository workspace does not belong to a process area), I'll have to
defer that to an API expert. One possibility would be to look at the
owner field.

Cheers,
Geoff

On 8/5/2011 7:08 AM, odrees wrote:
I see my misunderstanding regarding users and project areas.

But why does

Set workspacesSet =
wm.findAllWorkspaceNames(processArea, new
MyMonitor());

gives me the names of the streams and not of the workspaces as the
method name says? Is this a bug?

I tried to get all worspace names and wanted to open workspace
connections for them to get further information of each workspace.

As far as I now understand I have to create a search criteria for the
kind workspaces. With that I get back WorkspaceHandles with all
workspaces in the repository. With them I can get
IWorkspaceConnection objects to work with further. However I do not
see how I can decide on if a workspace belongs to the project area I
want to look at.

Is there a way to get the name of the project area from the work space
handle?

Best Regards,

- Oliver -

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.