Package org.opencms.ui.apps
Class CmsWorkplaceAppManager
- java.lang.Object
-
- org.opencms.ui.apps.CmsWorkplaceAppManager
-
public class CmsWorkplaceAppManager extends java.lang.Object
The workplace app manager.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CmsWorkplaceAppManager.ConfigurationComparator<T extends I_CmsHasOrder>
Comparator for configuration objects implementing I_CmsHasOrder.static class
CmsWorkplaceAppManager.NavigationState
Wrapper for the navigation state.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ADMINISTRATION_CATEGORY_ID
The administration category id.static java.lang.String
LEGACY_CATEGORY_ID
The legacy category id.protected static org.apache.commons.logging.Log
LOG
The logger for this class.static java.lang.String
MAIN_CATEGORY_ID
The main category id.static java.lang.String
TOOLBAR_CSS
The toolbar.css resource name.static java.lang.String
WORKPLACE_APP_SETTINGS_KEY
The workplace app settings additional info key.static java.lang.String
WORKPLACE_CSS_PARAM
The workplace CSS module parameter name.
-
Constructor Summary
Constructors Modifier Constructor Description protected
CmsWorkplaceAppManager()
Constructor for testing only.CmsWorkplaceAppManager(CmsObject adminCms)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Collection<java.lang.String>
getAdditionalStyleSheets()
Returns the additional style sheets provided by I_CmsWorkplaceStylesheetProvider services.I_CmsWorkplaceAppConfiguration
getAppConfiguration(java.lang.String appId)
Returns the app configuration with the given id.java.util.List<I_CmsWorkplaceAppConfiguration>
getAppConfigurations(java.lang.String... appIds)
Returns the app configuration instances for the given ids.<T extends I_CmsAppSettings>
TgetAppSettings(CmsObject cms, java.lang.Class<T> type)
Returns the user app setting of the given type.java.util.Collection<I_CmsAppCategory>
getCategories()
Returns the configured categories.I_CmsDefaultAction
getDefaultAction(I_CmsDialogContext context)
Returns the default action for the given context if available.I_CmsDefaultAction
getDefaultAction(I_CmsDialogContext context, I_CmsContextMenuItemProvider menuItemProvider)
Returns the default action for the given context if available.java.util.List<I_CmsWorkplaceAppConfiguration>
getDefaultQuickLaunchConfigurations()
Gets all configured quick launch apps, independent of the current user.I_CmsEditor
getEditorForResource(CmsObject cms, CmsResource resource, boolean plainText)
Returns the editor for the given resource.I_CmsEditor
getEditorForType(I_CmsResourceType type, boolean plainText)
Returns the editor for the given resource type.I_CmsContextMenuItemProvider
getMenuItemProvider()
Gets the menu item provider for the workplace.java.util.List<I_CmsWorkplaceAppConfiguration>
getQuickLaunchConfigurations(CmsObject cms)
Gets the configured quick launch apps which are visible for the current user.CmsUserIconHelper
getUserIconHelper()
Returns the user icon helper.protected java.util.List<I_CmsWorkplaceAppConfiguration>
getUserQuickLauchConfigurations(CmsObject cms)
Returns the quick launch apps set for the current user.java.util.Collection<I_CmsWorkplaceAppConfiguration>
getWorkplaceApps()
Returns all available workplace apps.java.util.Collection<java.lang.String>
getWorkplaceCssUris()
Returns the additional workplace CSS URIs.void
initWorkplaceCssUris(CmsModuleManager moduleManager)
Initializes the additional workplace CSS URIs.void
loadApps()
Loads the workplace apps.protected void
setUserQuickLaunchApps(CmsObject cms, java.util.List<java.lang.String> apps)
Writes the user quick launch apps setting to the user additional info.void
storeAppSettings(CmsObject cms, java.lang.Class<? extends I_CmsAppSettings> type, I_CmsAppSettings appSettings)
Stores the given app setting within the users additional info.
-
-
-
Field Detail
-
ADMINISTRATION_CATEGORY_ID
public static final java.lang.String ADMINISTRATION_CATEGORY_ID
The administration category id.- See Also:
- Constant Field Values
-
LEGACY_CATEGORY_ID
public static final java.lang.String LEGACY_CATEGORY_ID
The legacy category id.- See Also:
- Constant Field Values
-
MAIN_CATEGORY_ID
public static final java.lang.String MAIN_CATEGORY_ID
The main category id.- See Also:
- Constant Field Values
-
TOOLBAR_CSS
public static final java.lang.String TOOLBAR_CSS
The toolbar.css resource name.- See Also:
- Constant Field Values
-
WORKPLACE_APP_SETTINGS_KEY
public static java.lang.String WORKPLACE_APP_SETTINGS_KEY
The workplace app settings additional info key.
-
WORKPLACE_CSS_PARAM
public static java.lang.String WORKPLACE_CSS_PARAM
The workplace CSS module parameter name.
-
LOG
protected static org.apache.commons.logging.Log LOG
The logger for this class.
-
-
Constructor Detail
-
CmsWorkplaceAppManager
public CmsWorkplaceAppManager(CmsObject adminCms) throws CmsException
Constructor.- Parameters:
adminCms
- the admin cms context- Throws:
CmsException
- in case initializing the cms object fails
-
CmsWorkplaceAppManager
protected CmsWorkplaceAppManager()
Constructor for testing only.
-
-
Method Detail
-
getAdditionalStyleSheets
public java.util.Collection<java.lang.String> getAdditionalStyleSheets()
Returns the additional style sheets provided by I_CmsWorkplaceStylesheetProvider services.- Returns:
- the additional style sheets
-
getAppConfiguration
public I_CmsWorkplaceAppConfiguration getAppConfiguration(java.lang.String appId)
Returns the app configuration with the given id.- Parameters:
appId
- the app id- Returns:
- the app configuration
-
getAppConfigurations
public java.util.List<I_CmsWorkplaceAppConfiguration> getAppConfigurations(java.lang.String... appIds)
Returns the app configuration instances for the given ids.- Parameters:
appIds
- the app ids- Returns:
- the app configurations
-
getAppSettings
public <T extends I_CmsAppSettings> T getAppSettings(CmsObject cms, java.lang.Class<T> type) throws java.lang.InstantiationException, java.lang.IllegalAccessException
Returns the user app setting of the given type.- Parameters:
cms
- the cms contexttype
- the app setting type- Returns:
- the app setting
- Throws:
java.lang.InstantiationException
- in case instantiating the settings type failsjava.lang.IllegalAccessException
- in case the settings default constructor is not accessible
-
getCategories
public java.util.Collection<I_CmsAppCategory> getCategories()
Returns the configured categories.- Returns:
- the app categories
-
getDefaultAction
public I_CmsDefaultAction getDefaultAction(I_CmsDialogContext context)
Returns the default action for the given context if available.- Parameters:
context
- the dialog context- Returns:
- the default action
-
getDefaultAction
public I_CmsDefaultAction getDefaultAction(I_CmsDialogContext context, I_CmsContextMenuItemProvider menuItemProvider)
Returns the default action for the given context if available.- Parameters:
context
- the dialog contextmenuItemProvider
- the menu item provider- Returns:
- the default action
-
getDefaultQuickLaunchConfigurations
public java.util.List<I_CmsWorkplaceAppConfiguration> getDefaultQuickLaunchConfigurations()
Gets all configured quick launch apps, independent of the current user.- Returns:
- the quick launch apps
-
getEditorForResource
public I_CmsEditor getEditorForResource(CmsObject cms, CmsResource resource, boolean plainText)
Returns the editor for the given resource.- Parameters:
cms
- the CMS contextresource
- the resource to editplainText
- if plain text editing is required- Returns:
- the editor
-
getEditorForType
public I_CmsEditor getEditorForType(I_CmsResourceType type, boolean plainText)
Returns the editor for the given resource type.- Parameters:
type
- the resource type to editplainText
- if plain text editing is required- Returns:
- the editor
-
getMenuItemProvider
public I_CmsContextMenuItemProvider getMenuItemProvider()
Gets the menu item provider for the workplace.- Returns:
- the menu item provider
-
getQuickLaunchConfigurations
public java.util.List<I_CmsWorkplaceAppConfiguration> getQuickLaunchConfigurations(CmsObject cms)
Gets the configured quick launch apps which are visible for the current user.- Parameters:
cms
- the current CMS context- Returns:
- the list of available quick launch apps
-
getUserIconHelper
public CmsUserIconHelper getUserIconHelper()
Returns the user icon helper.- Returns:
- the user icon helper
-
getWorkplaceApps
public java.util.Collection<I_CmsWorkplaceAppConfiguration> getWorkplaceApps()
Returns all available workplace apps.- Returns:
- the available workpllace apps
-
getWorkplaceCssUris
public java.util.Collection<java.lang.String> getWorkplaceCssUris()
Returns the additional workplace CSS URIs.- Returns:
- the additional workplace CSS URIs
-
initWorkplaceCssUris
public void initWorkplaceCssUris(CmsModuleManager moduleManager)
Initializes the additional workplace CSS URIs.They will be taken from the module parameter 'workplace-css' if present in any module.
- Parameters:
moduleManager
- the module manager instance
-
loadApps
public void loadApps()
Loads the workplace apps.
-
storeAppSettings
public void storeAppSettings(CmsObject cms, java.lang.Class<? extends I_CmsAppSettings> type, I_CmsAppSettings appSettings)
Stores the given app setting within the users additional info.- Parameters:
cms
- the cms contexttype
- the app setting type, used as the settings keyappSettings
- the settings to store
-
getUserQuickLauchConfigurations
protected java.util.List<I_CmsWorkplaceAppConfiguration> getUserQuickLauchConfigurations(CmsObject cms)
Returns the quick launch apps set for the current user.- Parameters:
cms
- the cms context- Returns:
- the quick launch app configurations
-
setUserQuickLaunchApps
protected void setUserQuickLaunchApps(CmsObject cms, java.util.List<java.lang.String> apps) throws java.lang.Exception
Writes the user quick launch apps setting to the user additional info.- Parameters:
cms
- the cms contextapps
- the app ids- Throws:
java.lang.Exception
- in case writing the user fails
-
-