public abstract class AbstractUserWorkspaceImpl extends Object implements UserWorkspaceService, CollectionLocationService
UnrestrictedSessionRunner
while creating UserWorkspaces
and associated resourcesModifier and Type | Class and Description |
---|---|
protected class |
AbstractUserWorkspaceImpl.UnrestrictedUserWorkspaceFinder |
Modifier and Type | Field and Description |
---|---|
protected static char |
ESCAPE_CHAR |
protected static String |
ESCAPED_CHARS |
protected int |
maxsize |
protected String |
targetDomainName |
Constructor and Description |
---|
AbstractUserWorkspaceImpl() |
Modifier and Type | Method and Description |
---|---|
protected String |
buildUserWorkspaceTitle(String userName) |
protected String |
computePathUserWorkspaceRoot(CoreSession userCoreSession,
String usedUsername) |
protected DocumentModel |
createDefaultCollectionsRoot(CoreSession session,
DocumentModel userWorkspace) |
protected DocumentModel |
createFavorites(CoreSession session,
DocumentModel userWorkspace) |
protected String |
digest(String username,
int maxsize) |
protected abstract DocumentModel |
doCreateUserWorkspace(CoreSession unrestrictedSession,
PathRef wsRef,
String username) |
protected abstract DocumentModel |
doCreateUserWorkspacesRoot(CoreSession unrestrictedSession,
PathRef rootRef) |
protected String |
escape(String string)
Bijective escaping for user names.
|
protected void |
generateCandidates(List<String> names,
String username,
int max) |
List<String> |
getCandidateUserWorkspaceNames(String username)
Finds the list of potential names for the user workspace.
|
protected UserWorkspaceServiceImplComponent |
getComponent() |
DocumentModel |
getCurrentUserPersonalWorkspace(CoreSession userCoreSession)
Gets the current user personal workspace.
|
DocumentModel |
getCurrentUserPersonalWorkspace(CoreSession userCoreSession,
DocumentModel context)
Deprecated.
since 9.3
|
protected DocumentModel |
getCurrentUserPersonalWorkspace(NuxeoPrincipal principal,
String userName,
CoreSession userCoreSession)
This method handles the UserWorkspace creation with a Principal or a username.
|
DocumentModel |
getCurrentUserPersonalWorkspace(String userName,
DocumentModel currentDocument)
Gets the current user personal workspace from a lower level.
|
protected String |
getDomainName(CoreSession userCoreSession) |
protected PathRef |
getExistingUserWorkspace(CoreSession session,
PathRef rootref,
NuxeoPrincipal principal,
String username) |
protected PathRef |
getExistingUserWorkspaceRoot(CoreSession session,
String username) |
protected Locale |
getLocale(CoreSession session) |
DocumentModel |
getUserDefaultCollectionsRoot(CoreSession session)
Provide the default document where will be stored collections.
|
DocumentModel |
getUserFavorites(CoreSession session)
Provide the default favorites document.
|
protected String |
getUserName(NuxeoPrincipal principal,
String username)
Gets the base username to use to determine a user's workspace.
|
DocumentModel |
getUserPersonalWorkspace(NuxeoPrincipal principal,
DocumentModel context)
Gets a detached user workspace of a specified user depending of the passed principal.
|
DocumentModel |
getUserPersonalWorkspace(String userName,
DocumentModel context)
Gets a detached user workspace of a specified user.
|
protected DocumentModel |
initCreateFavorites(CoreSession session,
DocumentModel favorites) |
protected abstract DocumentModel |
initCreateUserWorkspace(CoreSession unrestrictedSession,
DocumentModel doc,
String username) |
protected abstract DocumentModel |
initCreateUserWorkspacesRoot(CoreSession unrestrictedSession,
DocumentModel doc) |
protected DocumentModel |
initDefaultCollectionsRoot(CoreSession session,
DocumentModel collectionsRoot) |
void |
invalidate()
Invalidates the user workspace service and force re-computation of user workspace root location.
|
boolean |
isUnderUserWorkspace(NuxeoPrincipal principal,
String username,
DocumentModel doc)
Checks whether the passed document is under the user's workspace (or is the workspace itself).
|
protected void |
notifyEvent(CoreSession coreSession,
DocumentModel document,
NuxeoPrincipal principal,
String eventId,
Map<String,Serializable> properties) |
protected static final char ESCAPE_CHAR
protected static final String ESCAPED_CHARS
protected volatile String targetDomainName
protected final int maxsize
public AbstractUserWorkspaceImpl()
protected String getDomainName(CoreSession userCoreSession)
protected String getUserName(NuxeoPrincipal principal, String username)
public List<String> getCandidateUserWorkspaceNames(String username)
protected String escape(String string)
Escapes some chars not allowed in a path segment or URL. The escaping character is a ~
followed by the
one-byte hex value of the character.
protected void generateCandidates(List<String> names, String username, int max)
protected String computePathUserWorkspaceRoot(CoreSession userCoreSession, String usedUsername)
public DocumentModel getCurrentUserPersonalWorkspace(String userName, DocumentModel currentDocument)
UserWorkspaceService
If this personal workspace does not exist then a new one will be created for the user who is represented by first argument.
getCurrentUserPersonalWorkspace
in interface UserWorkspaceService
userName
- the current usercurrentDocument
- the current document on which the user was onpublic DocumentModel getCurrentUserPersonalWorkspace(CoreSession userCoreSession)
UserWorkspaceService
If this personal workspace does not exist then a new one will be created for the user owning the core session.
getCurrentUserPersonalWorkspace
in interface UserWorkspaceService
userCoreSession
- the user core sessionpublic DocumentModel getCurrentUserPersonalWorkspace(CoreSession userCoreSession, DocumentModel context)
getCurrentUserPersonalWorkspace
in interface UserWorkspaceService
protected DocumentModel getCurrentUserPersonalWorkspace(NuxeoPrincipal principal, String userName, CoreSession userCoreSession)
protected PathRef getExistingUserWorkspaceRoot(CoreSession session, String username)
protected PathRef getExistingUserWorkspace(CoreSession session, PathRef rootref, NuxeoPrincipal principal, String username)
public DocumentModel getUserPersonalWorkspace(NuxeoPrincipal principal, DocumentModel context)
UserWorkspaceService
getUserPersonalWorkspace
in interface UserWorkspaceService
principal
- of the wanted user's workspace ownercontext
- is a document to determine the domainpublic DocumentModel getUserPersonalWorkspace(String userName, DocumentModel context)
UserWorkspaceService
getUserPersonalWorkspace
in interface UserWorkspaceService
userName
- is the username of the wanted user's workspace ownercontext
- is a document to determine the domainpublic boolean isUnderUserWorkspace(NuxeoPrincipal principal, String username, DocumentModel doc)
UserWorkspaceService
isUnderUserWorkspace
in interface UserWorkspaceService
principal
- the userusername
- the username, if principal is not availabledoc
- the documenttrue
if the document is under the user's workspaceprotected String buildUserWorkspaceTitle(String userName)
protected void notifyEvent(CoreSession coreSession, DocumentModel document, NuxeoPrincipal principal, String eventId, Map<String,Serializable> properties)
protected UserWorkspaceServiceImplComponent getComponent()
protected abstract DocumentModel doCreateUserWorkspacesRoot(CoreSession unrestrictedSession, PathRef rootRef)
protected abstract DocumentModel initCreateUserWorkspacesRoot(CoreSession unrestrictedSession, DocumentModel doc)
protected abstract DocumentModel doCreateUserWorkspace(CoreSession unrestrictedSession, PathRef wsRef, String username)
protected abstract DocumentModel initCreateUserWorkspace(CoreSession unrestrictedSession, DocumentModel doc, String username)
public void invalidate()
UserWorkspaceService
invalidate
in interface UserWorkspaceService
public DocumentModel getUserDefaultCollectionsRoot(CoreSession session)
CollectionLocationService
getUserDefaultCollectionsRoot
in interface CollectionLocationService
session
- the core sessionpublic DocumentModel getUserFavorites(CoreSession session)
CollectionLocationService
getUserFavorites
in interface CollectionLocationService
session
- the core sessionprotected Locale getLocale(CoreSession session)
protected DocumentModel createFavorites(CoreSession session, DocumentModel userWorkspace)
protected DocumentModel initCreateFavorites(CoreSession session, DocumentModel favorites)
protected DocumentModel createDefaultCollectionsRoot(CoreSession session, DocumentModel userWorkspace)
protected DocumentModel initDefaultCollectionsRoot(CoreSession session, DocumentModel collectionsRoot)
Copyright © 2019 Nuxeo. All rights reserved.