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_ATTRIBUTE
private Context
_context
private Logger
_logger
protected Repository
_repository
The 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 void
contextualize(Context context)
void
enableLogging(Logger logger)
static String
getForcedWorkspace(Request request)
Retrieves the workspace forced.String
getWorkspace()
Returns the current JCR workspaceString[]
getWorkspaces()
Returns the all JCR workspacesvoid
service(ServiceManager smanager)
static void
setForcedWorkspace(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:
service
in interfaceServiceable
- Throws:
ServiceException
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
enableLogging
public void enableLogging(Logger logger)
- Specified by:
enableLogging
in 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
null
for the default one.
-
getWorkspace
public String getWorkspace()
Description copied from interface:WorkspaceSelector
Returns the current JCR workspace- Specified by:
getWorkspace
in interfaceWorkspaceSelector
- Returns:
- the current JCR workspace
-
getWorkspaces
public String[] getWorkspaces() throws RepositoryException
Description copied from interface:WorkspaceSelector
Returns the all JCR workspaces- Specified by:
getWorkspaces
in interfaceWorkspaceSelector
- Returns:
- the available workspaces
- Throws:
RepositoryException
- if an error occurred
-
-