org.opencms.workplace
Class CmsWorkplaceManager

java.lang.Object
  extended by org.opencms.workplace.CmsWorkplaceManager
All Implemented Interfaces:
I_CmsLocaleHandler

public final class CmsWorkplaceManager
extends Object
implements I_CmsLocaleHandler

Manages the global OpenCms workplace settings for all users.

This class reads the settings from the "opencms.properties" and stores them in member variables. For each setting one or more get methods are provided.

Since:
6.0.0
Version:
$Revision: 1.73 $
Author:
Andreas Zahner

Field Summary
static String DEFAULT_WORKPLACE_ENCODING
          The default encoding for the workplace (UTF-8).
static String PARAM_LOGIN_REQUESTED_RESOURCE
          The id of the "requestedResource" parameter for the OpenCms login form.
static String SESSION_WORKPLACE_SETTINGS
          Key name for the session workplace settings.
 
Constructor Summary
CmsWorkplaceManager()
          Creates a new instance for the workplace manager, will be called by the workplace configuration manager.
 
Method Summary
 void addDialogHandler(I_CmsDialogHandler clazz)
          Adds a dialog handler instance to the list of configured dialog handlers.
 void addExplorerTypeSetting(CmsExplorerTypeSettings settings)
          Adds an explorer type setting object to the list of type settings.
 void addExplorerTypeSettings(CmsModule module)
          Adds the list of explorer type settings from the given module.
 void addExportPoint(String uri, String destination)
          Adds newly created export point to the workplace configuration.
 void addLabeledFolder(String uri)
          Adds a folder to the list of labeled folders.
 void addLocalizedFolder(String uri)
          Adds a new folder to the list of localized workplace folders.
 boolean autoLockResources()
          Returns if the autolock resources feature is enabled.
 CmsExplorerTypeAccess getDefaultAccess()
          Gets the access object of the type settings.
 Locale getDefaultLocale()
          Returns the Workplace default locale.
 CmsDefaultUserSettings getDefaultUserSettings()
          Returns the Workplace default user settings.
 Map getDialogHandler()
          Returns all instanciated dialog handlers for the workplace.
 Object getDialogHandler(String key)
          Returns the instanciated dialog handler class for the key or null, if there is no mapping for the key.
 I_CmsEditorActionHandler getEditorActionHandler()
          Returns the instanciated editor action handler class.
 CmsEditorDisplayOptions getEditorDisplayOptions()
          Returns the instanciated editor display option class.
 I_CmsEditorHandler getEditorHandler()
          Returns the instanciated editor handler class.
 String getEncoding()
          Returns the configured workplace encoding.
 CmsExplorerTypeSettings getExplorerTypeSetting(String type)
          Returns the explorer type settings for the specified resource type.
 List getExplorerTypeSettings()
          Returns the list of explorer type settings.
 Set getExportPoints()
          Returns the set of configured export points for the workplace.
 long getFileBytesMaxUploadSize(CmsObject cms)
          Returns the value (in bytes) for the maximum file upload size of the current user.
 int getFileMaxUploadSize()
          Returns the value (in kb) for the maximum file upload size.
 CmsRfsFileViewer getFileViewSettings()
          Returns the system-wide file view settings for the workplace.
 Map getGalleries()
          Returns a collection of all available galleries.
 CmsI18nInfo getI18nInfo(HttpServletRequest req, CmsUser user, CmsProject project, String resource)
          Returns the i18n information to use in the request context.
 List getLabelSiteFolders()
          Returns a list of site folders which generate labeled links.
 List getLocales()
          Returns the list of available workplace locales, sorted ascending.
 List getLocalizedFolders()
          Returns the configured list of localized workplace folders.
 CmsMessages getMessages(Locale locale)
          Returns the workplace messages for the given locale.
 int getTempFileProjectId()
          Returns the id of the temporary file project required by the editors.
 CmsToolManager getToolManager()
          Returns the tool manager.
 List getViews()
          Returns the map of configured workplace views.
 CmsWorkplaceEditorManager getWorkplaceEditorManager()
          Returns the instanciated workplace editor manager class.
 void initHandler(CmsObject cms)
          Will be called during system startup.
 void initialize(CmsObject cms)
          Initializes the workplace manager with the OpenCms system configuration.
 boolean isDefaultPropertiesOnStructure()
          Returns the default property editing mode on resources.
 boolean isEnableAdvancedPropertyTabs()
          Returns if tabs in the advanced property dialog are enabled.
 boolean isEnableWorkflowMessages()
          Returns if messages should be includes in workflow mails.
static boolean isWorkplaceUser(HttpServletRequest req)
          Returns true if the provided request was done by a Workplace user.
 void removeExplorerTypeSettings(CmsModule module)
          Removes the list of explorer type settings from the given module.
 void setAutoLock(String value)
          Sets if the autolock resources feature is enabled.
 void setDefaultAccess(CmsExplorerTypeAccess access)
          Sets the access object of the type settings.
 void setDefaultLocale(String locale)
          Sets the Workplace default locale.
 void setDefaultPropertiesOnStructure(String defaultPropertiesOnStructure)
          Sets the default property editing mode on resources.
 void setDefaultUserSettings(CmsDefaultUserSettings defaultUserSettings)
          Sets the Workplace default user settings.
 void setEditorAction(I_CmsEditorActionHandler clazz)
          Sets the editor action class.
 void setEditorDisplayOptions(CmsEditorDisplayOptions clazz)
          Sets the editor display option class.
 void setEditorHandler(I_CmsEditorHandler clazz)
          Sets the editor handler class.
 void setEnableAdvancedPropertyTabs(String enableAdvancedPropertyTabs)
          Sets if tabs in the advanced property dialog are enabled.
 void setFileMaxUploadSize(String value)
          Sets the value (in kb) for the maximum file upload size.
 void setFileViewSettings(CmsObject cms, CmsRfsFileViewer fileViewSettings)
          Sets the system-wide file view settings for the workplace.
 void setUserManagementEnabled(String value)
          Controls if the user/group icon in the administration view should be shown.
 void setWorkflowMessage(String workflowMessage)
          Sets if workflow message emails contain the message text.
 boolean showUserGroupIcon()
          Returns if the user/group icon in the administration view should be shown.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_WORKPLACE_ENCODING

public static final String DEFAULT_WORKPLACE_ENCODING
The default encoding for the workplace (UTF-8).

See Also:
Constant Field Values

PARAM_LOGIN_REQUESTED_RESOURCE

public static final String PARAM_LOGIN_REQUESTED_RESOURCE
The id of the "requestedResource" parameter for the OpenCms login form.

See Also:
Constant Field Values

SESSION_WORKPLACE_SETTINGS

public static final String SESSION_WORKPLACE_SETTINGS
Key name for the session workplace settings.

See Also:
Constant Field Values
Constructor Detail

CmsWorkplaceManager

public CmsWorkplaceManager()
Creates a new instance for the workplace manager, will be called by the workplace configuration manager.

Method Detail

isWorkplaceUser

public static boolean isWorkplaceUser(HttpServletRequest req)
Returns true if the provided request was done by a Workplace user.

Parameters:
req - the request to check
Returns:
true if the provided request was done by a Workplace user

addDialogHandler

public void addDialogHandler(I_CmsDialogHandler clazz)
Adds a dialog handler instance to the list of configured dialog handlers.

Parameters:
clazz - the instanciated dialog handler to add

addExplorerTypeSetting

public void addExplorerTypeSetting(CmsExplorerTypeSettings settings)
Adds an explorer type setting object to the list of type settings.

Parameters:
settings - the explorer type settings

addExplorerTypeSettings

public void addExplorerTypeSettings(CmsModule module)
Adds the list of explorer type settings from the given module.

Parameters:
module - the module witch contains the explorer type settings to add

addExportPoint

public void addExportPoint(String uri,
                           String destination)
Adds newly created export point to the workplace configuration.

Parameters:
uri - the export point uri
destination - the export point destination

addLabeledFolder

public void addLabeledFolder(String uri)
Adds a folder to the list of labeled folders.

Parameters:
uri - the folder uri to add

addLocalizedFolder

public void addLocalizedFolder(String uri)
Adds a new folder to the list of localized workplace folders.

Parameters:
uri - a new folder to add to the list of localized workplace folders

autoLockResources

public boolean autoLockResources()
Returns if the autolock resources feature is enabled.

Returns:
true if the autolock resources feature is enabled, otherwise false

getDefaultAccess

public CmsExplorerTypeAccess getDefaultAccess()
Gets the access object of the type settings.

Returns:
access object of the type settings

getDefaultLocale

public Locale getDefaultLocale()
Returns the Workplace default locale.

Returns:
the Workplace default locale

getDefaultUserSettings

public CmsDefaultUserSettings getDefaultUserSettings()
Returns the Workplace default user settings.

Returns:
the Workplace default user settings

getDialogHandler

public Map getDialogHandler()
Returns all instanciated dialog handlers for the workplace.

Returns:
all instanciated dialog handlers for the workplace

getDialogHandler

public Object getDialogHandler(String key)
Returns the instanciated dialog handler class for the key or null, if there is no mapping for the key.

Parameters:
key - the key whose associated value is to be returned
Returns:
the instanciated dialog handler class for the key

getEditorActionHandler

public I_CmsEditorActionHandler getEditorActionHandler()
Returns the instanciated editor action handler class.

Returns:
the instanciated editor action handler class

getEditorDisplayOptions

public CmsEditorDisplayOptions getEditorDisplayOptions()
Returns the instanciated editor display option class.

Returns:
the instanciated editor display option class

getEditorHandler

public I_CmsEditorHandler getEditorHandler()
Returns the instanciated editor handler class.

Returns:
the instanciated editor handler class

getEncoding

public String getEncoding()
Returns the configured workplace encoding.

Returns:
the configured workplace encoding

getExplorerTypeSetting

public CmsExplorerTypeSettings getExplorerTypeSetting(String type)
Returns the explorer type settings for the specified resource type.

Parameters:
type - the resource type for which the settings are required
Returns:
the explorer type settings for the specified resource type

getExplorerTypeSettings

public List getExplorerTypeSettings()
Returns the list of explorer type settings.

These settings provide information for the new resource dialog and the context menu appearance.

Returns:
the list of explorer type settings

getExportPoints

public Set getExportPoints()
Returns the set of configured export points for the workplace.

Returns:
the set of configured export points for the workplace

getFileBytesMaxUploadSize

public long getFileBytesMaxUploadSize(CmsObject cms)
Returns the value (in bytes) for the maximum file upload size of the current user.

Parameters:
cms - the initialized CmsObject
Returns:
the value (in bytes) for the maximum file upload size

getFileMaxUploadSize

public int getFileMaxUploadSize()
Returns the value (in kb) for the maximum file upload size.

Returns:
the value (in kb) for the maximum file upload size

getFileViewSettings

public CmsRfsFileViewer getFileViewSettings()
Returns the system-wide file view settings for the workplace.

Note that this instance may not modified (invocation of setters) directly or a CmsRuntimeException will be thrown. It has to be cloned first and then may be written back to the workplace settings using method setFileViewSettings(CmsObject, org.opencms.util.CmsRfsFileViewer).

Returns:
the system-wide file view settings for the workplace

getGalleries

public Map getGalleries()
Returns a collection of all available galleries.

The Map has the gallery type name as key and an instance of the gallery class (not completely initialized) as value.

Returns:
a collection of all available galleries

getI18nInfo

public CmsI18nInfo getI18nInfo(HttpServletRequest req,
                               CmsUser user,
                               CmsProject project,
                               String resource)
Description copied from interface: I_CmsLocaleHandler
Returns the i18n information to use in the request context.

Specified by:
getI18nInfo in interface I_CmsLocaleHandler
Parameters:
req - the current http request
user - the current user
project - the current project
resource - the URI of the requested resource (with full site root added)
Returns:
the i18n information to use for the given request context
See Also:
I_CmsLocaleHandler.getI18nInfo(javax.servlet.http.HttpServletRequest, org.opencms.file.CmsUser, org.opencms.file.CmsProject, java.lang.String)

getLabelSiteFolders

public List getLabelSiteFolders()
Returns a list of site folders which generate labeled links.

Returns:
a list of site folders which generate labeled links

getLocales

public List getLocales()
Returns the list of available workplace locales, sorted ascending.

Please note: Be careful not to modify the returned Set as it is not a clone.

Returns:
the set of available workplace locales

getLocalizedFolders

public List getLocalizedFolders()
Returns the configured list of localized workplace folders.

Returns:
the configured list of localized workplace folders

getMessages

public CmsMessages getMessages(Locale locale)
Returns the workplace messages for the given locale.

The workplace messages are a collection of resource bundles, one for the basic workplace, and (optionally) one for each initialized module.

Parameters:
locale - the locale to get the messages for
Returns:
the workplace messages for the given locale

getTempFileProjectId

public int getTempFileProjectId()
Returns the id of the temporary file project required by the editors.

Returns:
the id of the temporary file project required by the editors

getToolManager

public CmsToolManager getToolManager()
Returns the tool manager.

Returns:
the tool manager

getViews

public List getViews()
Returns the map of configured workplace views.

Returns:
the map of configured workplace views

getWorkplaceEditorManager

public CmsWorkplaceEditorManager getWorkplaceEditorManager()
Returns the instanciated workplace editor manager class.

Returns:
the instanciated workplace editor manager class

initHandler

public void initHandler(CmsObject cms)
Description copied from interface: I_CmsLocaleHandler
Will be called during system startup.

Specified by:
initHandler in interface I_CmsLocaleHandler
Parameters:
cms - an initialized cms permission context for VFS access
See Also:
I_CmsLocaleHandler.initHandler(org.opencms.file.CmsObject)

initialize

public void initialize(CmsObject cms)
                throws CmsException,
                       CmsRoleViolationException
Initializes the workplace manager with the OpenCms system configuration.

Parameters:
cms - an OpenCms context object that must have been initialized with "Admin" permissions
Throws:
CmsRoleViolationException - if the provided OpenCms user context does not have CmsRole.WORKPLACE_MANAGER role permissions
CmsException - if something goes wrong

isDefaultPropertiesOnStructure

public boolean isDefaultPropertiesOnStructure()
Returns the default property editing mode on resources.

Returns:
the default property editing mode on resources

isEnableAdvancedPropertyTabs

public boolean isEnableAdvancedPropertyTabs()
Returns if tabs in the advanced property dialog are enabled.

Returns:
true if tabs should be enabled, otherwise false

isEnableWorkflowMessages

public boolean isEnableWorkflowMessages()
Returns if messages should be includes in workflow mails.

Returns:
true if messages should be includes, otherwise false

removeExplorerTypeSettings

public void removeExplorerTypeSettings(CmsModule module)
Removes the list of explorer type settings from the given module.

Parameters:
module - the module witch contains the explorer type settings to remove

setAutoLock

public void setAutoLock(String value)
Sets if the autolock resources feature is enabled.

Parameters:
value - "true" if the autolock resources feature is enabled, otherwise false

setDefaultAccess

public void setDefaultAccess(CmsExplorerTypeAccess access)
Sets the access object of the type settings.

Parameters:
access - access object

setDefaultLocale

public void setDefaultLocale(String locale)
Sets the Workplace default locale.

Parameters:
locale - the locale to set

setDefaultPropertiesOnStructure

public void setDefaultPropertiesOnStructure(String defaultPropertiesOnStructure)
Sets the default property editing mode on resources.

Parameters:
defaultPropertiesOnStructure - the default property editing mode on resources

setDefaultUserSettings

public void setDefaultUserSettings(CmsDefaultUserSettings defaultUserSettings)
Sets the Workplace default user settings.

Parameters:
defaultUserSettings - the user settings to set

setEditorAction

public void setEditorAction(I_CmsEditorActionHandler clazz)
Sets the editor action class.

Parameters:
clazz - the editor action class to set

setEditorDisplayOptions

public void setEditorDisplayOptions(CmsEditorDisplayOptions clazz)
Sets the editor display option class.

Parameters:
clazz - the editor display option class to set

setEditorHandler

public void setEditorHandler(I_CmsEditorHandler clazz)
Sets the editor handler class.

Parameters:
clazz - the editor handler class to set

setEnableAdvancedPropertyTabs

public void setEnableAdvancedPropertyTabs(String enableAdvancedPropertyTabs)
Sets if tabs in the advanced property dialog are enabled.

Parameters:
enableAdvancedPropertyTabs - true if tabs should be enabled, otherwise false

setFileMaxUploadSize

public void setFileMaxUploadSize(String value)
Sets the value (in kb) for the maximum file upload size.

Parameters:
value - the value (in kb) for the maximum file upload size

setFileViewSettings

public void setFileViewSettings(CmsObject cms,
                                CmsRfsFileViewer fileViewSettings)
                         throws CmsRoleViolationException
Sets the system-wide file view settings for the workplace.

Parameters:
cms - the CmsObject for ensuring security constraints.
fileViewSettings - the system-wide file view settings for the workplace to set
Throws:
CmsRoleViolationException - if the current user does not own the administrator role (CmsRole.ADMINISTRATOR)

setUserManagementEnabled

public void setUserManagementEnabled(String value)
Controls if the user/group icon in the administration view should be shown.

Parameters:
value - "true" if the user/group icon in the administration view should be shown, otherwise false

setWorkflowMessage

public void setWorkflowMessage(String workflowMessage)
Sets if workflow message emails contain the message text.

Parameters:
workflowMessage - true if messages should be includes, otherwise false

showUserGroupIcon

public boolean showUserGroupIcon()
Returns if the user/group icon in the administration view should be shown.

Returns:
true if the user/group icon in the administration view should be shown, otherwise false