Class DefaultUIConfigurationService
- java.lang.Object
-
- de.hybris.platform.cockpit.services.impl.AbstractServiceImpl
-
- de.hybris.platform.cockpit.services.config.impl.DefaultUIConfigurationService
-
- All Implemented Interfaces:
UIConfigurationService
,org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
public class DefaultUIConfigurationService extends AbstractServiceImpl implements UIConfigurationService, org.springframework.context.ApplicationContextAware
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
DefaultUIConfigurationService.MyEnumerationInvalidationListener
-
Field Summary
-
Fields inherited from class de.hybris.platform.cockpit.services.impl.AbstractServiceImpl
modelService, typeService
-
-
Constructor Summary
Constructors Constructor Description DefaultUIConfigurationService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
protected CockpitConfigurationService
getCockpitConfigurationService()
<T extends UIComponentConfiguration>
TgetComponentConfiguration(ObjectTemplate template, java.lang.String code, java.lang.Class<T> expectedClass)
Returns a UI component configuration for the given parameters and usesthe session role
as role.<T extends UIComponentConfiguration>
TgetComponentConfiguration(UIRole role, ObjectTemplate objectTemplate, java.lang.String code, java.lang.Class<T> expectedClass)
Returns a UI component configuration for the given role, object template code and type.ConfigurationPersistingStrategy
getDefaultPersistingStrategy()
UIRole
getFallbackRole()
The ultimate role for ui configuration lookupsMediaService
getMediaService()
java.util.List<UIRole>
getPossibleRoles()
Returns all roles of the session user for which there are ui components available.java.util.List<UIRole>
getPossibleRoles(UserModel user)
Returns all roles of the given user for which there are ui components available.UIRole
getSessionRole()
The role to look up ui configurations by default (if no role is given).protected SessionService
getSessionService()
protected java.util.List<ObjectType>
getTypePath(ObjectTemplate template)
protected UserService
getUserService()
void
init()
void
initPersistingStrategies()
void
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
void
setCockpitConfigurationService(CockpitConfigurationService cockpitConfigurationService)
void
setDefaultPersistingStrategy(ConfigurationPersistingStrategy defaultPersistingStrategy)
void
setFallbackRoleName(java.lang.String roleName)
<T extends UIComponentConfiguration>
voidsetLocalComponentConfiguration(T configuration, UserModel user, ObjectTemplate objectTemplate, java.lang.String code, java.lang.Class<T> expectedClass)
Stores given UI configuration for given user and given parameters.void
setLoginService(LoginService loginService)
void
setMediaService(MediaService mediaService)
void
setSessionRole(UIRole role)
Set the current session's rolevoid
setSessionRole(java.lang.String role)
Set the current session's role by namevoid
setSessionService(SessionService sessionService)
void
setUiComponentCache(UIComponentCache componentCache)
void
setUserService(UserService userService)
-
Methods inherited from class de.hybris.platform.cockpit.services.impl.AbstractServiceImpl
getEnum, getEnums, getLocalizedLabel, getLocalizedLabel, getModelService, getTypeService, setCockpitTypeService, setLabelResolver, setModelService
-
-
-
-
Method Detail
-
getFallbackRole
public UIRole getFallbackRole()
Description copied from interface:UIConfigurationService
The ultimate role for ui configuration lookups- Specified by:
getFallbackRole
in interfaceUIConfigurationService
- Returns:
- The fallback role for ui configuration lookups
- See Also:
UIConfigurationService.getComponentConfiguration(UIRole, ObjectTemplate, String, Class)
-
getSessionRole
public UIRole getSessionRole()
Description copied from interface:UIConfigurationService
The role to look up ui configurations by default (if no role is given).- Specified by:
getSessionRole
in interfaceUIConfigurationService
- Returns:
- the session role
- See Also:
UIConfigurationService.getComponentConfiguration(ObjectTemplate, String, Class)
-
setSessionRole
public void setSessionRole(UIRole role)
Description copied from interface:UIConfigurationService
Set the current session's role- Specified by:
setSessionRole
in interfaceUIConfigurationService
- Parameters:
role
- the role
-
setSessionRole
public void setSessionRole(java.lang.String role)
Description copied from interface:UIConfigurationService
Set the current session's role by name- Specified by:
setSessionRole
in interfaceUIConfigurationService
- Parameters:
role
- the name of the role
-
getComponentConfiguration
public <T extends UIComponentConfiguration> T getComponentConfiguration(UIRole role, ObjectTemplate objectTemplate, java.lang.String code, java.lang.Class<T> expectedClass)
Description copied from interface:UIConfigurationService
Returns a UI component configuration for the given role, object template code and type. To search for the component it performs the following steps:- Look up a component for the given role, object tempate and code
- If nothing found look up a component for the fallback role as returned by
UIConfigurationService.getFallbackRole()
- If nothing found ask the
UIComponentConfigurationFactory
registered for the expexted class to create a default configuration
- Specified by:
getComponentConfiguration
in interfaceUIConfigurationService
-
getTypePath
protected java.util.List<ObjectType> getTypePath(ObjectTemplate template)
-
getComponentConfiguration
public <T extends UIComponentConfiguration> T getComponentConfiguration(ObjectTemplate template, java.lang.String code, java.lang.Class<T> expectedClass)
Description copied from interface:UIConfigurationService
Returns a UI component configuration for the given parameters and usesthe session role
as role. SeeUIConfigurationService.getComponentConfiguration(UIRole, ObjectTemplate, String, Class)
for details.- Specified by:
getComponentConfiguration
in interfaceUIConfigurationService
- Type Parameters:
T
- the type of the ui component configuration- Parameters:
template
- the- See Also:
UIConfigurationService.getComponentConfiguration(UIRole, ObjectTemplate, String, Class)
-
getPossibleRoles
public java.util.List<UIRole> getPossibleRoles()
Description copied from interface:UIConfigurationService
Returns all roles of the session user for which there are ui components available. If the user belongs to hybris UserGroups G1, G2 and G3 and there are configurations for G1 and G3 this method will return only G1 and G3.- Specified by:
getPossibleRoles
in interfaceUIConfigurationService
- Returns:
- all roles for which there are ui components available
-
getPossibleRoles
public java.util.List<UIRole> getPossibleRoles(UserModel user)
Description copied from interface:UIConfigurationService
Returns all roles of the given user for which there are ui components available. If the user belongs to hybris UserGroups G1, G2 and G3 and there are configurations for G1 and G3 this method will return only G1 and G3.- Specified by:
getPossibleRoles
in interfaceUIConfigurationService
- Parameters:
user
- the user to search roles for- Returns:
- all roles for which there are ui components available
-
setLoginService
public void setLoginService(LoginService loginService)
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
- Specified by:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
- Throws:
org.springframework.beans.BeansException
-
setFallbackRoleName
public void setFallbackRoleName(java.lang.String roleName)
-
setUiComponentCache
public void setUiComponentCache(UIComponentCache componentCache)
-
setLocalComponentConfiguration
public <T extends UIComponentConfiguration> void setLocalComponentConfiguration(T configuration, UserModel user, ObjectTemplate objectTemplate, java.lang.String code, java.lang.Class<T> expectedClass)
Description copied from interface:UIConfigurationService
Stores given UI configuration for given user and given parameters.- Specified by:
setLocalComponentConfiguration
in interfaceUIConfigurationService
- Parameters:
configuration
- the configuration to be storeduser
- user to set the local configuration forobjectTemplate
- the template this configuration is related tocode
- the code this configuration is related toexpectedClass
- the expected class
-
initPersistingStrategies
public void initPersistingStrategies()
-
setDefaultPersistingStrategy
public void setDefaultPersistingStrategy(ConfigurationPersistingStrategy defaultPersistingStrategy)
-
getDefaultPersistingStrategy
public ConfigurationPersistingStrategy getDefaultPersistingStrategy()
-
init
public void init()
-
clear
public void clear()
-
getCockpitConfigurationService
protected CockpitConfigurationService getCockpitConfigurationService()
-
setCockpitConfigurationService
public void setCockpitConfigurationService(CockpitConfigurationService cockpitConfigurationService)
-
getUserService
protected UserService getUserService()
-
setUserService
public void setUserService(UserService userService)
-
getSessionService
protected SessionService getSessionService()
-
setSessionService
public void setSessionService(SessionService sessionService)
-
getMediaService
public MediaService getMediaService()
-
setMediaService
public void setMediaService(MediaService mediaService)
-
-