Class CmsUserSettings

java.lang.Object
org.opencms.db.CmsUserSettings
Direct Known Subclasses:
CmsDefaultUserSettings

public class CmsUserSettings extends Object
Object to conveniently access and modify the users workplace settings.

Since:
6.0.0
  • Field Details

  • Constructor Details

    • CmsUserSettings

      public CmsUserSettings()
      Creates an empty new user settings object.

    • CmsUserSettings

      Creates a user settings object with initialized settings of the current user.

      Parameters:
      cms - the OpenCms context
    • CmsUserSettings

      public CmsUserSettings(CmsUser user)
      Creates a user settings object with initialized settings of the user.

      Some default settings will not be set, if no cms object is given.

      Parameters:
      user - the current CmsUser
      See Also:
  • Method Details

    • getAdditionalPreference

      public static String getAdditionalPreference(CmsObject cms, String key, boolean useDefault)
      Gets a configured preference.

      Parameters:
      cms - the cms context
      key - the settings key
      useDefault - true if we want the default value if no value is configured
      Returns:
      the preference value
    • setAdditionalPreference

      public static void setAdditionalPreference(CmsObject cms, String key, String value)
      Sets a configured preference.

      Parameters:
      cms - the Cms context
      key - the setting name
      value - the value
    • getAdditionalPreference

      public String getAdditionalPreference(String name, boolean useDefault)
      Gets the value for a user defined preference.

      Parameters:
      name - the name of the preference
      useDefault - true if the default value should be returned in case the preference is not set
      Returns:
      the preference value
    • getDialogCopyFileMode

      Gets the default copy mode when copying a file of the user.

      Returns:
      the default copy mode when copying a file of the user
    • getDialogCopyFolderMode

      Gets the default copy mode when copying a folder of the user.

      Returns:
      the default copy mode when copying a folder of the user
    • getDialogDeleteFileMode

      Returns the default setting for file deletion.

      Returns:
      the default setting for file deletion
    • getDialogExpandInheritedPermissions

      Returns the default setting for expanding inherited permissions in the dialog.

      Returns:
      true if inherited permissions should be expanded, otherwise false
    • getDialogExpandUserPermissions

      Returns the default setting for expanding the users permissions in the dialog.

      Returns:
      true if the users permissions should be expanded, otherwise false
    • getDialogPermissionsInheritOnFolder

      Returns the default setting for inheriting permissions on folders.

      Returns:
      true if permissions should be inherited on folders, otherwise false
    • getDialogPublishSiblings

      public boolean getDialogPublishSiblings()
      Returns the default setting for direct publishing.

      Returns:
      the default setting for direct publishing: true if siblings should be published, otherwise false
    • getDialogShowExportSettings

      public boolean getDialogShowExportSettings()
      Determines if the export part of the secure/export dialog should be shown.

      Returns:
      true if the export dialog is shown, otherwise false
    • getDialogShowLock

      public boolean getDialogShowLock()
      Determines if the lock dialog should be shown.

      Returns:
      true if the lock dialog is shown, otherwise false
    • getDirectEditButtonStyle

      Returns the style of the direct edit buttons of the user.

      Returns:
      the style of the direct edit buttons of the user
    • getEditorButtonStyle

      public int getEditorButtonStyle()
      Returns the style of the editor buttons of the user.

      Returns:
      the style of the editor buttons of the user
    • getEditorSettings

      Returns the editor settings of the user.

      Returns:
      the editor settings of the user
    • getExplorerButtonStyle

      public int getExplorerButtonStyle()
      Returns the style of the explorer buttons of the user.

      Returns:
      the style of the explorer buttons of the user
    • getExplorerFileEntries

      public int getExplorerFileEntries()
      Returns the number of displayed files per page of the user.

      Returns:
      the number of displayed files per page of the user
    • getExplorerFileEntryOptions

      Returns the explorerFileEntryOptions.

      Returns:
      the explorerFileEntryOptions
    • getExplorerSettings

      public int getExplorerSettings()
      Returns the explorer start settings.

      Returns:
      the explorer start settings
    • getListAllProjects

      public boolean getListAllProjects()
      Returns if all projects should be listed or only the ones in the current ou.

      Returns:
      true if all projects should be listed, otherwise false
    • getLocale

      public Locale getLocale()
      Returns the locale of the user.

      Returns:
      the locale of the user
    • getNewFolderCreateIndexPage

      Returns Boolean.TRUE if the "create index page" check box in the new folder dialog should be initially be checked.

      Returns:
      Boolean.TRUE if the "create index page" check box in the new folder dialog should be initially be checked.
    • getNewFolderEditProperties

      Returns Boolean.TRUE if the "edit properties" check box in the new folder dialog should be initially be checked.

      Returns:
      Boolean.TRUE if the "edit properties" check box in the new folder dialog should be initially be checked.
    • getPreferredEditor

      public String getPreferredEditor(String resourceType)
      Returns the preferred editor for the given resource type of the user.

      Parameters:
      resourceType - the resource type
      Returns:
      the preferred editor for the resource type or null, if not specified
    • getPublishButtonAppearance

      Returns:
      the appearance of the "publish project" button
    • getRestrictExplorerView

      public boolean getRestrictExplorerView()
      Sets if the explorer view is restricted to the defined site and folder.

      Returns:
      true if the explorer view is restricted, otherwise false
    • getShowFileUploadButton

      public boolean getShowFileUploadButton()
      Returns true if the file upload button should be shown or false otherwise.

      Returns:
      the showFileUpload
    • getShowPublishNotification

      public boolean getShowPublishNotification()
      Returns if the publish notifications should be shown or not.

      Returns:
      true if the publish notifications should be shown, otherwise false
    • getShowUploadTypeDialog

      Returns Boolean.TRUE if the resource type selection dialog should be shown in the file upload process (non - applet version).

      Returns:
      Boolean.TRUE if the resource type selection dialog should be shown in the file upload process (non - applet version).
    • getStartFolder

      Returns the start folder of the user.

      Returns:
      the start folder of the user
    • getStartGalleriesSettings

      The start galleries settings of the user.

      Returns:
      the start galleries settings of the user
    • getStartGallery

      public String getStartGallery(String galleryType)
      Returns the path to the start gallery of the user.

      Parameters:
      galleryType - the type of the gallery
      Returns:
      the path to the start gallery or null, if no key
    • getStartGallery

      public String getStartGallery(String galleryType, CmsObject cms)
      Returns the root site path to the start gallery of the user or the constant CmsPreferences.INPUT_DEFAULT.

      Parameters:
      galleryType - the type of the gallery
      cms - Cms object
      Returns:
      the root site path to the start gallery or the default key, null if "not set"
    • getStartProject

      Returns the start project of the user.

      Returns:
      the start project of the user
    • getStartSite

      public String getStartSite()
      Returns the start site of the user.

      Returns:
      the start site of the user
    • getStartView

      public String getStartView()
      Returns the current start view of the user.

      Returns:
      the current start view of the user
    • getSynchronizeSettings

      Returns the (optional) workplace synchronize settings.

      Returns:
      the (optional) workplace synchronize settings
    • getTimeWarp

      public long getTimeWarp()
      Returns the current users time warp time, or CmsContextInfo.CURRENT_TIME if this feature is disabled and the current time is used for each user request.

      Returns:
      the current users time warp time, or CmsContextInfo.CURRENT_TIME if this feature is disabled
    • getUploadAppletClientFolder

      Returns the folder path of the upload applet on the client machine.

      Returns:
      the folder path of the upload applet on the client machine
    • getUploadVariant

      Returns the uploadVariant.

      Returns:
      the uploadVariant
    • getUser

      public CmsUser getUser()
      Returns the current user for the settings.

      Returns:
      the CmsUser
    • getWorkplaceButtonStyle

      Returns the style of the workplace buttons of the user.

      Returns:
      the style of the workplace buttons of the user
    • getWorkplaceReportType

      Returns the type of the report (simple or extended) of the user.

      Returns:
      the type of the report (simple or extended) of the user
    • getWorkplaceSearchIndexName

      Returns the name of the search index to use in the workplace.

      Returns:
      the name of the search index to use in the workplace
    • getWorkplaceSearchViewStyle

      Returns the workplace search result list view style.

      Returns:
      the workplace search result list view style
    • init

      public void init(CmsUser user)
      Initializes the user settings with the given users setting parameters.

      Parameters:
      user - the current CmsUser
    • save

      public void save(CmsObject cms) throws CmsException
      Saves the changed settings of the user to the users CmsUser.getAdditionalInfo() map.

      If the given CmsObject is null, the additional user infos are only updated in memory and not saved into the database.

      Parameters:
      cms - the CmsObject needed to write the user to the db
      Throws:
      CmsException - if user cannot be written to the db
    • setAdditionalPreference

      public void setAdditionalPreference(String name, String value)
      Sets an additional preference value.

      Parameters:
      name - the additional preference name
      value - the preference value
    • setAdditionalPreferencesFrom

      public void setAdditionalPreferencesFrom(CmsUserSettings userSettings)
      Sets this settings object's additional preferences to that of another one.

      Parameters:
      userSettings - the user settings
    • setDialogCopyFileMode

      Sets the default copy mode when copying a file of the user.

      Parameters:
      mode - the default copy mode when copying a file of the user
    • setDialogCopyFolderMode

      Sets the default copy mode when copying a folder of the user.

      Parameters:
      mode - the default copy mode when copying a folder of the user
    • setDialogDeleteFileMode

      Sets the default setting for file deletion.

      Parameters:
      mode - the default setting for file deletion
    • setDialogExpandInheritedPermissions

      public void setDialogExpandInheritedPermissions(boolean dialogShowInheritedPermissions)
      Sets the default setting for expanding inherited permissions in the dialog.

      Parameters:
      dialogShowInheritedPermissions - the default setting for expanding inherited permissions in the dialog
    • setDialogExpandUserPermissions

      public void setDialogExpandUserPermissions(boolean dialogShowUserPermissions)
      Sets the default setting for expanding the users permissions in the dialog.

      Parameters:
      dialogShowUserPermissions - the default setting for expanding the users permissions in the dialog
    • setDialogPermissionsInheritOnFolder

      public void setDialogPermissionsInheritOnFolder(boolean dialogPermissionsInheritOnFolder)
      Sets the default setting for inheriting permissions on folders.

      Parameters:
      dialogPermissionsInheritOnFolder - the default setting for inheriting permissions on folders
    • setDialogPublishSiblings

      public void setDialogPublishSiblings(boolean publishSiblings)
      Sets the default setting for direct publishing.

      Parameters:
      publishSiblings - the default setting for direct publishing: true if siblings should be published, otherwise false
    • setDialogShowExportSettings

      public void setDialogShowExportSettings(boolean show)
      Sets if the export setting part of the secure/export dialog should be shown.

      Parameters:
      show - true if the export dialog should be shown, otherwise false
    • setDialogShowLock

      public void setDialogShowLock(boolean show)
      Sets if the lock dialog should be shown.

      Parameters:
      show - true if the lock dialog should be shown, otherwise false
    • setDirectEditButtonStyle

      public void setDirectEditButtonStyle(int style)
      Sets the style of the direct edit buttons of the user.

      Parameters:
      style - the style of the direct edit buttons of the user
    • setEditorButtonStyle

      public void setEditorButtonStyle(int style)
      Sets the style of the editor buttons of the user.

      Parameters:
      style - the style of the editor buttons of the user
    • setEditorSettings

      public void setEditorSettings(Map<String,String> settings)
      Sets the editor settings of the user.

      Parameters:
      settings - the editor settings of the user
    • setExplorerButtonStyle

      public void setExplorerButtonStyle(int style)
      Sets the style of the explorer buttons of the user.

      Parameters:
      style - the style of the explorer buttons of the user
    • setExplorerFileEntries

      public void setExplorerFileEntries(int entries)
      Sets the number of displayed files per page of the user.

      Parameters:
      entries - the number of displayed files per page of the user
    • setExplorerFileEntryOptions

      public void setExplorerFileEntryOptions(String explorerFileEntryOptions)
      Sets the explorerFileEntryOptions.

      Parameters:
      explorerFileEntryOptions - the explorerFileEntryOptions to set
    • setExplorerSettings

      public void setExplorerSettings(int settings)
      Sets the explorer start settings.

      Parameters:
      settings - explorer start settings to use
    • setListAllProjects

      public void setListAllProjects(boolean listAllProjects)
      Sets if all the projects should be shown or not.

      Parameters:
      listAllProjects - true if all the projects should be shown, otherwise false
    • setLocale

      public void setLocale(Locale locale)
      Sets the locale of the user.

      Parameters:
      locale - the locale of the user
    • setNewFolderCreateIndexPage

      public void setNewFolderCreateIndexPage(Boolean setting)
      Sets if the "create index page" check box in the new folder dialog should be initially be checked or not.

      Parameters:
      setting - if the "create index page" check box in the new folder dialog should be initially be checked or not.
    • setNewFolderEditPropertes

      public void setNewFolderEditPropertes(Boolean setting)
      Sets if the "edit properties" check box in the new folder dialog should be initially be checked or not.

      Parameters:
      setting - if the "edit properties" check box in the new folder dialog should be initially be checked or not.
    • setPreferredEditor

      public void setPreferredEditor(String resourceType, String editorUri)
      Sets the preferred editor for the given resource type of the user.

      Parameters:
      resourceType - the resource type
      editorUri - the editor URI
    • setPublishButtonAppearance

      public void setPublishButtonAppearance(String publishButtonAppearance)
      Parameters:
      publishButtonAppearance - the appearance of the "publish project" button
    • setRestrictExplorerView

      public void setRestrictExplorerView(boolean restrict)
      Sets if the explorer view is restricted to the defined site and folder.

      Parameters:
      restrict - true if the explorer view is restricted, otherwise false
    • setShowExplorerFileDateCreated

      public void setShowExplorerFileDateCreated(boolean show)
      Sets if the file creation date should be shown in explorer view.

      Parameters:
      show - true if the file creation date should be shown, otherwise false
    • setShowExplorerFileDateExpired

      public void setShowExplorerFileDateExpired(boolean show)
      Sets if the file expire date should be shown in explorer view.

      Parameters:
      show - true if the file expire date should be shown, otherwise false
    • setShowExplorerFileDateLastModified

      public void setShowExplorerFileDateLastModified(boolean show)
      Sets if the file last modified date state should be shown in explorer view.

      Parameters:
      show - true if the file last modified date should be shown, otherwise false
    • setShowExplorerFileDateReleased

      public void setShowExplorerFileDateReleased(boolean show)
      Sets if the file release date should be shown in explorer view.

      Parameters:
      show - true if the file release date should be shown, otherwise false
    • setShowExplorerFileLockedBy

      public void setShowExplorerFileLockedBy(boolean show)
      Sets if the file locked by should be shown in explorer view.

      Parameters:
      show - true if the file locked by should be shown, otherwise false
    • setShowExplorerFileNavText

      public void setShowExplorerFileNavText(boolean show)
      Sets if the file navtext should be shown in explorer view.

      Parameters:
      show - true if the file navtext should be shown, otherwise false
    • setShowExplorerFilePermissions

      public void setShowExplorerFilePermissions(boolean show)
      Sets if the file permissions should be shown in explorer view.

      Parameters:
      show - true if the file permissions should be shown, otherwise false
    • setShowExplorerFileSize

      public void setShowExplorerFileSize(boolean show)
      Sets if the file size should be shown in explorer view.

      Parameters:
      show - true if the file size should be shown, otherwise false
    • setShowExplorerFileState

      public void setShowExplorerFileState(boolean show)
      Sets if the file state should be shown in explorer view.

      Parameters:
      show - true if the state size should be shown, otherwise false
    • setShowExplorerFileTitle

      public void setShowExplorerFileTitle(boolean show)
      Sets if the file title should be shown in explorer view.

      Parameters:
      show - true if the file title should be shown, otherwise false
    • setShowExplorerFileType

      public void setShowExplorerFileType(boolean show)
      Sets if the file type should be shown in explorer view.

      Parameters:
      show - true if the file type should be shown, otherwise false
    • setShowExplorerFileUserCreated

      public void setShowExplorerFileUserCreated(boolean show)
      Sets if the file creator should be shown in explorer view.

      Parameters:
      show - true if the file creator should be shown, otherwise false
    • setShowExplorerFileUserLastModified

      public void setShowExplorerFileUserLastModified(boolean show)
      Sets if the file last modified by should be shown in explorer view.

      Parameters:
      show - true if the file last modified by should be shown, otherwise false
    • setShowFileUploadButton

      public void setShowFileUploadButton(boolean flag)
      Controls whether to display a file upload icon or not.

      Parameters:
      flag - true or false to flag the use of the file upload button
    • setShowPublishNotification

      public void setShowPublishNotification(boolean showPublishNotification)
      Sets if the publish notifications should be shown or not.

      Parameters:
      showPublishNotification - true if the publish notifications should be shown, otherwise false
    • setShowUploadTypeDialog

      public void setShowUploadTypeDialog(Boolean showUploadTypeDialog)
      Sets if the resource type selection dialog should be shown in the file upload process (non - applet version) or not.

      Parameters:
      showUploadTypeDialog - if the resource type selection dialog should be shown in the file upload process (non - applet version)
    • setStartFolder

      public void setStartFolder(String folder)
      Sets the start folder of the user.

      Parameters:
      folder - the start folder of the user
    • setStartGalleriesSetting

      public void setStartGalleriesSetting(Map<String,String> settings)
      Sets the start galleries settings of the user.

      Parameters:
      settings - the start galleries setting of the user
    • setStartGallery

      public void setStartGallery(String galleryType, String galleryUri)
      Sets the path to the start gallery of the user or removes the entry from user settings if no path is null.

      Parameters:
      galleryType - the type of the gallery
      galleryUri - the gallery URI
    • setStartProject

      public void setStartProject(String project)
      Sets the start project of the user.

      Parameters:
      project - the start project name of the user
    • setStartSite

      public void setStartSite(String site)
      Sets the start site of the user.

      Parameters:
      site - the start site of the user
    • setStartView

      public void setStartView(String view)
      Sets the current start view of the user.

      Parameters:
      view - the current start view of the user
    • setSynchronizeSettings

      public void setSynchronizeSettings(CmsSynchronizeSettings synchronizeSettings)
      Sets the (optional) workplace synchronize settings.

      Parameters:
      synchronizeSettings - the (optional) workplace synchronize settings to set
    • setTimeWarp

      public void setTimeWarp(long timewarp)
      Sets the user specific custom "time warp" time.

      Use CmsContextInfo.CURRENT_TIME to disable this feature, ie. enable the current time for each new request.

      If this value is set, auto time warping will be disabled: Clicking on a resource that has not been released at the given time or is already expired at the given time will not be shown - an error message will pop up ("out of time window").

      Parameters:
      timewarp - the time warp time to set
    • setUploadAppletClientFolder

      public void setUploadAppletClientFolder(String uploadAppletClientFolder)
      Sets the folder path of the upload applet on the client machine.

      Parameters:
      uploadAppletClientFolder - the folder path of the upload applet on the client machine
    • setUploadVariant

      public void setUploadVariant(String uploadVariant)
      Sets the upload variant.

      Parameters:
      uploadVariant - the upload variant as String
    • setUploadVariant

      public void setUploadVariant(CmsUserSettings.UploadVariant uploadVariant)
      Sets the upload variant.

      Parameters:
      uploadVariant - the upload variant
    • setUser

      public void setUser(CmsUser user)
      Sets the current user for the settings.

      Parameters:
      user - the CmsUser
    • setWorkplaceButtonStyle

      public void setWorkplaceButtonStyle(int style)
      Sets the style of the workplace buttons of the user.

      Parameters:
      style - the style of the workplace buttons of the user
    • setWorkplaceReportType

      public void setWorkplaceReportType(String type)
      Sets the type of the report (simple or extended) of the user.

      Parameters:
      type - the type of the report (simple or extended) of the user
    • setWorkplaceSearchIndexName

      public void setWorkplaceSearchIndexName(String workplaceSearchIndexName)
      Sets the name of the search index to use in the workplace.

      Parameters:
      workplaceSearchIndexName - the name of the search index to use in the workplace to set
    • setWorkplaceSearchViewStyle

      public void setWorkplaceSearchViewStyle(CmsUserSettings.CmsSearchResultStyle workplaceSearchViewStyle)
      Sets the workplace search result list view style.

      Parameters:
      workplaceSearchViewStyle - the workplace search result list view style to set
    • showExplorerFileDateCreated

      public boolean showExplorerFileDateCreated()
      Determines if the file creation date should be shown in explorer view.

      Returns:
      true if the file creation date should be shown, otherwise false
    • showExplorerFileDateExpired

      public boolean showExplorerFileDateExpired()
      Determines if the file date expired should be shown in explorer view.

      Returns:
      true if the file date expired should be shown, otherwise false
    • showExplorerFileDateLastModified

      Determines if the file last modified date should be shown in explorer view.

      Returns:
      true if the file last modified date should be shown, otherwise false
    • showExplorerFileDateReleased

      public boolean showExplorerFileDateReleased()
      Determines if the file date released should be shown in explorer view.

      Returns:
      true if the file date released should be shown, otherwise false
    • showExplorerFileLockedBy

      public boolean showExplorerFileLockedBy()
      Determines if the file locked by should be shown in explorer view.

      Returns:
      true if the file locked by should be shown, otherwise false
    • showExplorerFileNavText

      public boolean showExplorerFileNavText()
      Determines if the file navigation text should be shown in explorer view.

      Returns:
      true if the file navigation text should be shown, otherwise false
    • showExplorerFilePermissions

      public boolean showExplorerFilePermissions()
      Determines if the file permissions should be shown in explorer view.

      Returns:
      true if the file permissions should be shown, otherwise false
    • showExplorerFileSize

      public boolean showExplorerFileSize()
      Determines if the file size should be shown in explorer view.

      Returns:
      true if the file size should be shown, otherwise false
    • showExplorerFileState

      public boolean showExplorerFileState()
      Determines if the file state should be shown in explorer view.

      Returns:
      true if the file state should be shown, otherwise false
    • showExplorerFileTitle

      public boolean showExplorerFileTitle()
      Determines if the file title should be shown in explorer view.

      Returns:
      true if the file title should be shown, otherwise false
    • showExplorerFileType

      public boolean showExplorerFileType()
      Determines if the file type should be shown in explorer view.

      Returns:
      true if the file type should be shown, otherwise false
    • showExplorerFileUserCreated

      public boolean showExplorerFileUserCreated()
      Determines if the file creator should be shown in explorer view.

      Returns:
      true if the file creator should be shown, otherwise false
    • showExplorerFileUserLastModified

      Determines if the file last modified by should be shown in explorer view.

      Returns:
      true if the file last modified by should be shown, otherwise false