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

Java API: setting workspace visibility to project area scope

 Hi,

What is the proper way, with the java API 4.0.3, to set the visibility of a repository workspace to scoped to a particular project area.

I tried something like the code below, with different combinations of parameters including with IScmService.NOOP_OWNER or IScmService.DEFAULT_VISIBILITY but it fails with different exceptions like "Invalid scope for Contributor owner", "Workspace may only have contributor owners" etc.

IWorkspaceConnection targetFlow = ...;
IWorkspaceConnection workspace = workspaceManager
.createWorkspace(repo.loggedInContributor(), "workspace name",
"description", targetFlow, targetFlow,
NULL_PROGRESS_MONITOR);
IProcessAreaHandle area = targetFlow
.getProcessArea(NULL_PROGRESS_MONITOR);
ProcessAreaScope scope = (ProcessAreaScope) IReadScope.FACTORY
        .createProcessAreaScope();
scope.setProcessArea(area);
workspace.setOwnerAndVisibility(?,
?, NULL_PROGRESS_MONITOR);


0 votes


Accepted answer

Permanent link
Using IScmService.NOOP_OWNER is correct since you don't want to change the owner. If you do change the owner, it must be a contributor for your repository workspace.

For the visibility, you want to change the scope to a project area so don't use the IScmService.DEFAULT_VISIBILITY. To define a new scope, use IReadScope.FACTORY.createContributorDeferringScope() to get an instance of a new scope. Then set the scope on it to your project area. This scope instance is what you pass in for the IWorkspaceConnection.setOwnerAndVisibility(...) call.
Oscar Picasso selected this answer as the correct answer

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,941

Question asked: Jan 21 '14, 10:22 a.m.

Question was seen: 3,788 times

Last updated: Jan 21 '14, 11:07 a.m.

Confirmation Cancel Confirm