Package org.ametys.core.ui
Class StaticFileImportsClientSideElement
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.core.ui.StaticFileImportsClientSideElement
-
- All Implemented Interfaces:
ClientSideElement
,LogEnabled
,PluginAware
,Configurable
,Serviceable
- Direct Known Subclasses:
ChooseHierarchicalContentFileImportsClientSideElement
,StaticClientSideElement
,WorkflowStepsClientSideElement
public class StaticFileImportsClientSideElement extends AbstractLogEnabled implements ClientSideElement, Configurable, PluginAware, Serviceable
This implementation creates an element from a static configuration
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.ametys.core.ui.ClientSideElement
ClientSideElement.Script, ClientSideElement.ScriptFile
-
-
Field Summary
Fields Modifier and Type Field Description protected CurrentUserProvider
_currentUserProvider
The current user providerprotected Map<String,List<String>>
_dependencies
The dependencies, as an associprotected String
_featureName
The name of the feature that declared the elementprotected String
_id
The element idprotected String
_pluginName
The name of the plugin that declared the elementprotected RightManager
_rightManager
The rights managerprotected Map<String,String>
_rights
The right configured.protected String
_rightsMode
The righs mode to associate rights AND or ORprotected ClientSideElement.Script
_script
The script configured
-
Constructor Summary
Constructors Constructor Description StaticFileImportsClientSideElement()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Map<String,List<String>>
_configureDependencies(Configuration configuration)
Configure the dependencies following the configurationprotected List<ClientSideElement.ScriptFile>
_configureImports(Configuration configuration)
Configure the import partprotected Map<String,String>
_configureRights(Configuration configuration)
Configure the right following the configurationprotected String
_configureRightsMode(Configuration configuration)
Configure the mode to associate rights AND or ORprotected ClientSideElement.Script
_configureScript(Configuration configuration)
Configure the scriptvoid
configure(Configuration configuration)
Map<String,List<String>>
getDependencies()
This method returns the list of dependencies, sorted by extension point.String
getId()
Get the id of the element.String
getPluginName()
Get the plugin name where the control was declaredMap<String,String>
getRights(Map<String,Object> contextParameters)
This method return the right that will be needed on client side.List<ClientSideElement.Script>
getScripts(boolean ignoreRights, Map<String,Object> contextParameters)
This method return the scripts that will be used on client side.List<ClientSideElement.Script>
getScripts(Map<String,Object> contextParameters)
This method return the scripts that will be used on client side.protected boolean
hasRight(Map<String,String> rights)
Determine following the right parameter if the user has right to access this featurevoid
service(ServiceManager smanager)
void
setPluginInfo(String pluginName, String featureName, String id)
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.String
toString()
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_currentUserProvider
protected CurrentUserProvider _currentUserProvider
The current user provider
-
_rightManager
protected RightManager _rightManager
The rights manager
-
_script
protected ClientSideElement.Script _script
The script configured
-
_rightsMode
protected String _rightsMode
The righs mode to associate rights AND or OR
-
_dependencies
protected Map<String,List<String>> _dependencies
The dependencies, as an associ
-
_pluginName
protected String _pluginName
The name of the plugin that declared the element
-
_featureName
protected String _featureName
The name of the feature that declared the element
-
-
Constructor Detail
-
StaticFileImportsClientSideElement
public StaticFileImportsClientSideElement()
-
-
Method Detail
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
setPluginInfo
public void setPluginInfo(String pluginName, String featureName, String id)
Description copied from interface:PluginAware
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.- Specified by:
setPluginInfo
in interfacePluginAware
- Parameters:
pluginName
- Unique identifier for the plugin hosting the extensionfeatureName
- Unique feature identifier (unique for a given pluginName)id
- Unique identifier of this component
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configure
in interfaceConfigurable
- Throws:
ConfigurationException
-
_configureScript
protected ClientSideElement.Script _configureScript(Configuration configuration) throws ConfigurationException
Configure the script- Parameters:
configuration
- the global configuration- Returns:
- The script created
- Throws:
ConfigurationException
- The configuration is incorrect
-
_configureImports
protected List<ClientSideElement.ScriptFile> _configureImports(Configuration configuration) throws ConfigurationException
Configure the import part- Parameters:
configuration
- The imports configuration- Returns:
- The set of the complete url of imported file
- Throws:
ConfigurationException
- If an error occurs
-
_configureRights
protected Map<String,String> _configureRights(Configuration configuration) throws ConfigurationException
Configure the right following the configuration- Parameters:
configuration
- The root configuration- Returns:
- The right name or null.
- Throws:
ConfigurationException
- if a right element is present but empty
-
_configureRightsMode
protected String _configureRightsMode(Configuration configuration) throws ConfigurationException
Configure the mode to associate rights AND or OR- Parameters:
configuration
- The configuration of rights mode.- Returns:
- AND or OR (default value)
- Throws:
ConfigurationException
- The configuration is incorrect
-
_configureDependencies
protected Map<String,List<String>> _configureDependencies(Configuration configuration) throws ConfigurationException
Configure the dependencies following the configuration- Parameters:
configuration
- The root configuration- Returns:
- The list of dependencies, by extension point.
- Throws:
ConfigurationException
- if a dependency element is present but empty
-
hasRight
protected boolean hasRight(Map<String,String> rights)
Determine following the right parameter if the user has right to access this feature- Parameters:
rights
- The rights (name, context) to check. Can be empty.- Returns:
- true if the user has the right or if there is not right and false otherwise
-
getScripts
public final List<ClientSideElement.Script> getScripts(Map<String,Object> contextParameters)
Description copied from interface:ClientSideElement
This method return the scripts that will be used on client side. This class will be parametrized by initial and current parameters.- Specified by:
getScripts
in interfaceClientSideElement
- Parameters:
contextParameters
- Contextuals parameters transmitted by the environment.- Returns:
- The list of scripts or an empty list.
-
getScripts
public List<ClientSideElement.Script> getScripts(boolean ignoreRights, Map<String,Object> contextParameters)
Description copied from interface:ClientSideElement
This method return the scripts that will be used on client side. This class will be parametrized by initial and current parameters.- Specified by:
getScripts
in interfaceClientSideElement
- Parameters:
ignoreRights
- True to ignore the rights verification.contextParameters
- Contextuals parameters transmitted by the environment.- Returns:
- The list of scripts or an empty list.
-
getRights
public Map<String,String> getRights(Map<String,Object> contextParameters)
Description copied from interface:ClientSideElement
This method return the right that will be needed on client side. This class will be parametrized by initial and current parameters.- Specified by:
getRights
in interfaceClientSideElement
- Parameters:
contextParameters
- Contextuals parameters transmitted by the environment.- Returns:
- The rights in a Map of (rightId, context). Can be empty.
-
getPluginName
public String getPluginName()
Description copied from interface:ClientSideElement
Get the plugin name where the control was declared- Specified by:
getPluginName
in interfaceClientSideElement
- Returns:
- The plugin name. Can not be null.
-
getId
public String getId()
Description copied from interface:ClientSideElement
Get the id of the element.- Specified by:
getId
in interfaceClientSideElement
- Returns:
- the id. Can not be null.
-
getDependencies
public Map<String,List<String>> getDependencies()
Description copied from interface:ClientSideElement
This method returns the list of dependencies, sorted by extension point.- Specified by:
getDependencies
in interfaceClientSideElement
- Returns:
- a map of dependencies ids by extension point.
-
-