Class CmsWorkplaceManager

    • 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​(javax.servlet.http.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
      • addAccountInfo

        public void addAccountInfo​(java.lang.String field,
                                   java.lang.String addInfoKey,
                                   java.lang.String editable)
        Adds an account info.

        Parameters:
        field - the field
        addInfoKey - the additional info key
        editable - the editable flag
      • addDialogHandler

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

        Parameters:
        clazz - the instantiated dialog handler to add
      • addEditorCssHandler

        public void addEditorCssHandler​(java.lang.String editorCssHandlerClassName)
        Adds an editor CSS handler class to the list of handlers.

        Parameters:
        editorCssHandlerClassName - full class name of the css handler class
      • addEditorCssHandlerToHead

        public void addEditorCssHandlerToHead​(java.lang.String editorCssHandlerClassName)
        Adds an editor CSS handler class at the first position of the list of handlers.

        Parameters:
        editorCssHandlerClassName - full class name of the css handler class
      • 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​(java.lang.String uri,
                                   java.lang.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​(java.lang.String uri)
        Adds a folder to the list of labeled folders.

        Parameters:
        uri - the folder uri to add
      • addLocalizedFolder

        public void addLocalizedFolder​(java.lang.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
      • addPreEditorConditionDefinition

        public void addPreEditorConditionDefinition​(java.lang.String resourceTypeName,
                                                    java.lang.String preEditorConditionDefinitionClassName)
        Adds a condition definition class for a given resource type name that is triggered before opening the editor.

        Parameters:
        resourceTypeName - the name of the resource type
        preEditorConditionDefinitionClassName - full class name of the condition definition class
      • addSynchronizeExcludePattern

        public void addSynchronizeExcludePattern​(java.lang.String pattern)
        Adds a pattern to be excluded in VFS synchronization.

        Parameters:
        pattern - a java regex to applied on the file name
      • autoLockResources

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

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

        public void checkWorkplaceRequest​(javax.servlet.http.HttpServletRequest request,
                                          CmsObject cms)
        Checks whether the workplace is accessed through the workplace server, and sends an error message otherwise.

        Parameters:
        request - the request to check
        cms - the CmsObject to use
      • createTempFile

        public java.lang.String createTempFile​(CmsObject cms,
                                               java.lang.String resourceName,
                                               CmsUUID currentProjectId)
                                        throws CmsException
        Creates a temporary file which is needed while working in an editor with preview option.

        Note: This method is synchronized to avoid rare issues that might be caused by double requests fired by some browser/OS combinations.

        Parameters:
        cms - the cms context
        resourceName - the name of the resource to copy
        currentProjectId - the id of the project to work with
        Returns:
        the file name of the temporary file
        Throws:
        CmsException - if something goes wrong
      • flushMessageCache

        public void flushMessageCache()
        Flushes the cached workplace messages.

      • getAcaciaUnlock

        public java.lang.String getAcaciaUnlock()
        Gets the value of the acacia-unlock configuration option (null if not set explicitly).

        Returns:
        the value of the acacia-unlock configuration option
      • getCategoryFolder

        public java.lang.String getCategoryFolder()
        Returns the name of the local category folder(s).

        Returns:
        the name of the local category folder(s)
      • getDefaultLocale

        public java.util.Locale getDefaultLocale()
        Returns the Workplace default locale.

        Returns:
        the Workplace default locale
      • getDefaultNamePattern

        public java.lang.String getDefaultNamePattern​(java.lang.String type)
        Gets the default name pattern for the given type.

        Parameters:
        type - the type name
        Returns:
        the default name pattern for the type
      • getDialogHandler

        public java.util.Map<java.lang.String,​I_CmsDialogHandlergetDialogHandler()
        Returns all instantiated dialog handlers for the workplace.

        Returns:
        all instantiated dialog handlers for the workplace
      • getDialogHandler

        public I_CmsDialogHandler getDialogHandler​(java.lang.String key)
        Returns the instantiated 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 instantiated dialog handler class for the key
      • getEncoding

        public java.lang.String getEncoding()
        Returns the configured workplace encoding.

        Returns:
        the configured workplace encoding
      • getExplorerTypeSetting

        public CmsExplorerTypeSettings getExplorerTypeSetting​(java.lang.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 java.util.List<CmsExplorerTypeSettingsgetExplorerTypeSettings()
        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
      • getExplorerTypesForView

        public java.util.List<CmsExplorerTypeSettingsgetExplorerTypesForView​(java.lang.String viewName)
        Gets the explorer types for the given view name.

        Parameters:
        viewName - the view name
        Returns:
        the explorer names for the given view names
      • getExplorerTypeViews

        public java.util.Map<CmsUUID,​CmsElementViewgetExplorerTypeViews()
        Gets the element views generated from explorer types.

        Returns:
        the map of element views from the explorer types
      • getExportPoints

        public java.util.Set<CmsExportPointgetExportPoints()
        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
      • getGalleries

        public java.util.Map<java.lang.String,​A_CmsAjaxGallerygetGalleries()
        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
      • getGalleryDefaultScopeString

        public java.lang.String getGalleryDefaultScopeString()
        Gets the configured gallery default scope as a string.

        Returns:
        the gallery default scope as a string
      • getGroupTranslationClass

        public java.lang.String getGroupTranslationClass()
        Returns the configured class name for translating group names.

        Returns:
        the group translation class name
      • getLabelSiteFolders

        public java.util.List<java.lang.String> getLabelSiteFolders()
        Returns a list of site folders which generate labeled links.

        Returns:
        a list of site folders which generate labeled links
      • getLocales

        public java.util.List<java.util.Locale> 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 java.util.List<java.lang.String> getLocalizedFolders()
        Returns the configured list of localized workplace folders.

        Returns:
        the configured list of localized workplace folders
      • getMessages

        public CmsWorkplaceMessages getMessages​(java.util.Locale locale)
        Returns the CmsWorkplaceMessages for the given locale.

        The workplace messages are a collection of resource bundles, containing the messages for all OpenCms core bundles and of all initialized modules.

        Please note that the message objects are cached internally. The returned message object should therefore never be modified directly in any way.

        Parameters:
        locale - the locale to get the messages for
        Returns:
        the CmsWorkplaceMessages for the given locale
      • getPreEditorConditionDefinition

        public I_CmsPreEditorActionDefinition getPreEditorConditionDefinition​(I_CmsResourceType resourceType)
        Returns the condition definition for the given resource type that is triggered before opening the editor.

        Parameters:
        resourceType - the resource type
        Returns:
        the condition definition for the given resource type class name or null if none is found
      • getSitemapConfigEditRole

        public java.lang.String getSitemapConfigEditRole()
        Gets the name of the role necessary for editing the sitemap configuration.
        Returns:
        the name of the role necessary for editing the sitemap configuration
      • getSynchronizeExcludePatterns

        public java.util.ArrayList<java.util.regex.Pattern> getSynchronizeExcludePatterns()
        Returns Regex patterns that should be excluded from synchronization.

        Returns:
        the exclude patterns
      • getTempFileProjectId

        public CmsUUID 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
      • getUploadHook

        public java.lang.String getUploadHook​(CmsObject cms,
                                              java.lang.String uploadFolder)
        Gets the upload hook URI which should be opened for an upload to a given folder.

        This method will return null if no upload hook should be used for the given upload folder.

        The API for this upload hook is as follows: The upload hook will be called with the following parameters: resources (required): a comma separated list of the structure ids of the uploaded resources if this is omitted closelink (optional): a link which should be opened once the upload hook has finished whatever it is doing

        Parameters:
        cms - the current CMS context
        uploadFolder - the folder for which the upload hook should be found
        Returns:
        the URI of the upload hook or null
      • getUserListModeString

        public java.lang.String getUserListModeString()
        Returns the user list mode as a string.

        Returns:
        the user list mode as a string
      • getViews

        public java.util.List<CmsWorkplaceViewgetViews()
        Returns the map of configured workplace views.

        Returns:
        the map of configured workplace views
      • getWorkplaceLocale

        public java.util.Locale getWorkplaceLocale​(CmsObject cms)
        Returns the workplace locale from the current user's settings.

        Parameters:
        cms - the current cms object
        Returns:
        the workplace locale
      • getWorkplaceLocale

        public java.util.Locale getWorkplaceLocale​(CmsRequestContext requestContext)
        Gets the workplace locale for the given request context.

        Parameters:
        requestContext - the request context
        Returns:
        the workplace locale for the request context
      • getWorkplaceLocale

        public java.util.Locale getWorkplaceLocale​(CmsUser user)
        Returns the workplace locale for the user.
        Parameters:
        user - the user to get the workplace locale for.
        Returns:
        the workplace locale for the user.
      • isDefaultPropertiesOnStructure

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

        Returns:
        the default property editing mode on resources
      • isDisplayCategoriesByRepository

        public boolean isDisplayCategoriesByRepository()
        Returns a flag, indicating if the categories should be displayed separated by repository in the category selection dialog.
        Returns:
        a flag, indicating if the categories should be displayed separated by repository in the category selection dialog.
      • isDisplayCategorySelectionCollapsed

        public boolean isDisplayCategorySelectionCollapsed()
        Returns a flag, indicating if the category selection dialog should have all entries completely collapsed when opened.
        Returns:
        a flag, indicating if the category selection dialog should have all entries completely collapsed when opened.
      • isEnableAdvancedPropertyTabs

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

        Returns:
        true if tabs should be enabled, otherwise false
      • isKeepAlive

        public boolean isKeepAlive()
        Returns true if "keep alive" mode is active.
        Returns:
        true if the session should be kept alive
      • isKeepAlive

        public java.lang.Boolean isKeepAlive​(boolean useDefault)
        Returns true if the session should be kept alive.

        Parameters:
        useDefault - if true, the default value will be returned if the "keep alive" setting is not explicitly configured
        Returns:
        True if the "keep alive" mode is active
      • isXmlContentAutoCorrect

        public boolean isXmlContentAutoCorrect()
        Returns if XML content is automatically corrected when opened with the editor.

        Returns:
        true if XML content is automatically corrected when opened with the editor, otherwise false
      • lazyUserListsEnabled

        public boolean lazyUserListsEnabled()
        Returns if lazy user lists are enabled.

        Returns:
        true if lazy user lists are enabled
      • 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
      • setAcaciaUnlock

        public void setAcaciaUnlock​(java.lang.String value)
        Sets the value of the acacia-unlock configuration option.

        Parameters:
        value - the value of the acacia-unlock configuration option
      • setAutoLock

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

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

        public void setCategoryDisplayOptions​(java.lang.String displayCategoriesByRepository,
                                              java.lang.String displayCategorySelectionCollapsed)
        Sets the category display options that affect how the category selection dialog is shown.
        Parameters:
        displayCategoriesByRepository - if true, the categories are shown separated by repository.
        displayCategorySelectionCollapsed - if true, the selection dialog opens showing only the top-level categories (or the various repositories) in collapsed state.
      • setCategoryFolder

        public void setCategoryFolder​(java.lang.String categoryFolder)
        Sets the name of the local category folder(s).

        Parameters:
        categoryFolder - the name of the local category folder(s)
      • setDefaultLocale

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

        Parameters:
        locale - the locale to set
      • setDefaultPropertiesOnStructure

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

        Parameters:
        defaultPropertiesOnStructure - the default property editing mode on resources
      • setElementDeleteMode

        public void setElementDeleteMode​(java.lang.String deleteMode)
        Sets the element delete mode.

        Parameters:
        deleteMode - the element delete mode
      • setEnableAdvancedPropertyTabs

        public void setEnableAdvancedPropertyTabs​(java.lang.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​(java.lang.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
      • setGalleryDefaultScope

        public void setGalleryDefaultScope​(java.lang.String galleryDefaultScope)
        Sets the gallery default scope.

        Parameters:
        galleryDefaultScope - the gallery default scope
      • setGroupTranslationClass

        public void setGroupTranslationClass​(java.lang.String translationClassName)
        Sets the group translation class name.

        Parameters:
        translationClassName - the group translation class name
      • setKeepAlive

        public void setKeepAlive​(java.lang.String keepAlive)
        Sets the "keep alive" mode.

        Parameters:
        keepAlive - the keep-alive mode
      • setSitemapConfigEditRole

        public void setSitemapConfigEditRole​(java.lang.String roleName)
        Sets the name of the role necessary for editing the sitemap configuration.
        Parameters:
        roleName - the name of the role necessary for editing the sitemap configuration
      • setToolManager

        public void setToolManager​(CmsToolManager toolManager)
        Sets the tool Manager object.

        Parameters:
        toolManager - the tool Manager object to set
      • setUserListMode

        public void setUserListMode​(java.lang.String mode)
        Sets the user list mode.

        Parameters:
        mode - the user list mode
      • setUserManagementEnabled

        public void setUserManagementEnabled​(java.lang.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
      • setXmlContentAutoCorrect

        public void setXmlContentAutoCorrect​(java.lang.String xmlContentAutoCorrect)
        Sets the auto correction of XML contents when they are opened with the editor.

        Parameters:
        xmlContentAutoCorrect - if "true", the content will be corrected without notification, otherwise a confirmation is needed
      • shouldAcaciaUnlock

        public boolean shouldAcaciaUnlock()
        Returns true if the Acacia editor in standalone mode should automatically unlock resources.

        Returns:
        true if resources should be automatically unlocked in standalone mode
      • 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
      • supportsLazyUserLists

        public boolean supportsLazyUserLists()
        Returns true if lazy user lists should be used.

        Returns:
        true if lazy user lists should be used
      • translateGroupName

        public java.lang.String translateGroupName​(java.lang.String groupName,
                                                   boolean keepOu)
        Translates a group name using the configured I_CmsGroupNameTranslation.

        Parameters:
        groupName - the group name
        keepOu - if true, the OU will be appended to the translated name
        Returns:
        the translated group name