Show TOC

Retrieving Workspace PropertiesLocate this document in the navigation structure

Use

The following example illustrates how to retrieve the properties of a specific workspace:

private void retrieveWorkspaceProperties(IPortalComponentRequest request, String workspaceID)
{
// Retrieves workspace directory
IWorkspacesRuntime workspacesRuntime = RuntimeFactory.getWorkspacesRuntime();
IWorkspaceDirectory workspaceDirectory = (IWorkspaceDirectory)workspacesRuntime.getService(IWorkspaceDirectory.class);

List IDs = new LinkedList();
IDs.add(workspaceID);

Map workspacesInfo = workspaceDirectory.getWorkspacesInfo(IDs);

WorkspaceInfo workspaceInfo = (WorkspaceInfo) workspacesInfo.get(workspaceID);

// Retrieve workspace name
String workspaceName = workspaceInfo.getName();

// Retrieve workspace owner
IUser ownerUser = (IUser) workspaceInfo.getOwner();

// Retrieve workspace navigation target URL
String targetURL = workspaceInfo.getNavigationTarget();

//Pass this navigation target to EPCM.doNavigate(navigationTarget)on the client side
}

You can also retrieve the properties of all workspaces of which the current user is a manager or member, as illustrated by the following example:

private void retrieveUserWorkspaces(IPortalComponentRequest request)
{
// Retrieve workspace directory
IWorkspacesRuntime workspacesRuntime = RuntimeFactory.getWorkspacesRuntime();
IWorkspaceDirectory workspaceDirectory = (IWorkspaceDirectory)workspacesRuntime.getService(IWorkspaceDirectory.class);

Object user = request.getUser();

// Retrieve workspaces where the specified user is a manager
WorkspaceInfo[] manageWorkspacesInfo = workspaceDirectory.getWorkspacesInfo(user, WorkspaceRole.MANAGER, SortBy.NAME_ASCENDING, 0, 1000).getWorkspacesInfo();

// Retrieve workspaces where the specified user is a member
WorkspaceInfo[] memberWorkspacesInfo = workspaceDirectory.getWorkspacesInfo(user, WorkspaceRole.MEMBER, SortBy.NAME_ASCENDING, 0, 1000).getWorkspacesInfo();				
}