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_currentUserProviderThe current user providerprotected Map<String,List<String>>_dependenciesThe dependencies, as an associprotected String_featureNameThe name of the feature that declared the elementprotected String_idThe element idprotected String_pluginNameThe name of the plugin that declared the elementprotected RightManager_rightManagerThe rights managerprotected Map<String,String>_rightsThe right configured.protected String_rightsModeThe righs mode to associate rights AND or ORprotected ClientSideElement.Script_scriptThe 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 scriptvoidconfigure(Configuration configuration)Map<String,List<String>>getDependencies()This method returns the list of dependencies, sorted by extension point.StringgetId()Get the id of the element.StringgetPluginName()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 booleanhasRight(Map<String,String> rights)Determine following the right parameter if the user has right to access this featurevoidservice(ServiceManager smanager)voidsetPluginInfo(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.StringtoString()-
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:
servicein interfaceServiceable- Throws:
ServiceException
-
setPluginInfo
public void setPluginInfo(String pluginName, String featureName, String id)
Description copied from interface:PluginAwareSets 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:
setPluginInfoin 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:
configurein 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:ClientSideElementThis method return the scripts that will be used on client side. This class will be parametrized by initial and current parameters.- Specified by:
getScriptsin 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:ClientSideElementThis method return the scripts that will be used on client side. This class will be parametrized by initial and current parameters.- Specified by:
getScriptsin 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:ClientSideElementThis method return the right that will be needed on client side. This class will be parametrized by initial and current parameters.- Specified by:
getRightsin 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:ClientSideElementGet the plugin name where the control was declared- Specified by:
getPluginNamein interfaceClientSideElement- Returns:
- The plugin name. Can not be null.
-
getId
public String getId()
Description copied from interface:ClientSideElementGet the id of the element.- Specified by:
getIdin interfaceClientSideElement- Returns:
- the id. Can not be null.
-
getDependencies
public Map<String,List<String>> getDependencies()
Description copied from interface:ClientSideElementThis method returns the list of dependencies, sorted by extension point.- Specified by:
getDependenciesin interfaceClientSideElement- Returns:
- a map of dependencies ids by extension point.
-
-