Class RequestAttributeWorkspaceSelector
- java.lang.Object
-
- org.ametys.plugins.repository.provider.RequestAttributeWorkspaceSelector
-
- All Implemented Interfaces:
WorkspaceSelector,Contextualizable,LogEnabled,Serviceable
public class RequestAttributeWorkspaceSelector extends Object implements LogEnabled, Contextualizable, WorkspaceSelector, Serviceable
Workspace selector using a context attribute for selecting the workspace.
-
-
Field Summary
Fields Modifier and Type Field Description private static String__WORKSPACE_ATTRIBUTEprivate Context_contextprivate Logger_loggerprotected Repository_repositoryThe repository.-
Fields inherited from interface org.ametys.plugins.repository.provider.WorkspaceSelector
ROLE
-
-
Constructor Summary
Constructors Constructor Description RequestAttributeWorkspaceSelector()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcontextualize(Context context)voidenableLogging(Logger logger)static StringgetForcedWorkspace(Request request)Retrieves the workspace forced.StringgetWorkspace()Returns the current JCR workspaceString[]getWorkspaces()Returns the all JCR workspacesvoidservice(ServiceManager smanager)static voidsetForcedWorkspace(Request request, String workspaceName)Forces the workspace to use.
-
-
-
Field Detail
-
__WORKSPACE_ATTRIBUTE
private static final String __WORKSPACE_ATTRIBUTE
- See Also:
- Constant Field Values
-
_repository
protected Repository _repository
The repository.
-
-
Constructor Detail
-
RequestAttributeWorkspaceSelector
public RequestAttributeWorkspaceSelector()
-
-
Method Detail
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
enableLogging
public void enableLogging(Logger logger)
- Specified by:
enableLoggingin interfaceLogEnabled
-
setForcedWorkspace
public static void setForcedWorkspace(Request request, String workspaceName)
Forces the workspace to use.- Parameters:
request- the current requestworkspaceName- the workspace name.
-
getForcedWorkspace
public static String getForcedWorkspace(Request request)
Retrieves the workspace forced.- Parameters:
request- the current request- Returns:
- the workspace forced or
nullfor the default one.
-
getWorkspace
public String getWorkspace()
Description copied from interface:WorkspaceSelectorReturns the current JCR workspace- Specified by:
getWorkspacein interfaceWorkspaceSelector- Returns:
- the current JCR workspace
-
getWorkspaces
public String[] getWorkspaces() throws RepositoryException
Description copied from interface:WorkspaceSelectorReturns the all JCR workspaces- Specified by:
getWorkspacesin interfaceWorkspaceSelector- Returns:
- the available workspaces
- Throws:
RepositoryException- if an error occurred
-
-