use of org.nuxeo.ecm.platform.userworkspace.api.UserWorkspaceService in project nuxeo-drive-server by nuxeo.
the class UserSyncRootParentFactory method getVirtualFolderItem.
/*------------------- VirtualFolderItemFactory ------------------- */
@Override
public FolderItem getVirtualFolderItem(Principal principal) {
RepositoryManager repositoryManager = Framework.getService(RepositoryManager.class);
// TODO: handle multiple repositories
try (CloseableCoreSession session = CoreInstance.openCoreSession(repositoryManager.getDefaultRepositoryName(), principal)) {
UserWorkspaceService userWorkspaceService = Framework.getService(UserWorkspaceService.class);
DocumentModel userWorkspace = userWorkspaceService.getCurrentUserPersonalWorkspace(session);
if (userWorkspace == null) {
throw new NuxeoException(String.format("No personal workspace found for user %s.", principal.getName()));
}
return (FolderItem) getFileSystemItem(userWorkspace);
}
}
use of org.nuxeo.ecm.platform.userworkspace.api.UserWorkspaceService in project nuxeo-drive-server by nuxeo.
the class UserWorkspaceTopLevelFactory method getTopLevelFolderItem.
/*----------------------- TopLevelFolderItemFactory ---------------------*/
@Override
public FolderItem getTopLevelFolderItem(Principal principal) {
RepositoryManager repositoryManager = Framework.getService(RepositoryManager.class);
// TODO: handle multiple repositories
try (CloseableCoreSession session = CoreInstance.openCoreSession(repositoryManager.getDefaultRepositoryName(), principal)) {
UserWorkspaceService userWorkspaceService = Framework.getService(UserWorkspaceService.class);
DocumentModel userWorkspace = userWorkspaceService.getCurrentUserPersonalWorkspace(session);
if (userWorkspace == null) {
throw new NuxeoException(String.format("No personal workspace found for user %s.", principal.getName()));
}
return (FolderItem) getFileSystemItem(userWorkspace);
}
}
Aggregations