Package net.sf.basedb.core.plugin
Interface ParameterValues
- All Known Implementing Classes:
DefaultConfigurationValues
,NamespaceParameterValuesWrapper
,ParameterValuesImpl
,ParameterValuesWrapper
public interface ParameterValues
This interface is used by the plugin to access the different parameters
attached to its job and configuration.
- Version:
- 2.0
- Author:
- Enell, Nicklas
- Last modified
- $Date$
-
Method Summary
Modifier and TypeMethodDescriptionint
getId()
Get the ID of the job or configuration the parameters comes from.getJob()
Get the job that we are executing/configuring.Get the configuration that we are using/configuring.Get the plugin that we are executing/configuring.<T> T
Get a single value for a specific parameter.<T> List<T>
Get aList
of values for a specific parameter.<T> void
setValue
(String name, ParameterType<T> type, T value) Set a single value for a parameter.<T> void
setValues
(String name, ParameterType<T> type, List<T> values) Set a list of values for a parameter.
-
Method Details
-
getPluginDefinition
PluginDefinition getPluginDefinition()Get the plugin that we are executing/configuring.- Returns:
- A PluginDefinition or null if not known
- Since:
- 2.2
-
getJob
Job getJob()Get the job that we are executing/configuring.- Returns:
- A Job or null if not known
- Since:
- 2.2
-
getPluginConfiguration
PluginConfiguration getPluginConfiguration()Get the configuration that we are using/configuring.- Returns:
- A PluginConfiguration or null if not known
- Since:
- 2.2
-
getId
int getId()Get the ID of the job or configuration the parameters comes from. -
getValue
Get a single value for a specific parameter. If the parameter has more then one value only the first value is returned. UsegetValues(String)
to return all values as a list.- Parameters:
name
- the name of the parameter- Returns:
- The value or null if no parameter with that name is found
- Throws:
PermissionDeniedException
- If the logged in user doesn't have permission to read the valueBaseException
- If there is another error
-
getValues
Get aList
of values for a specific parameter.- Parameters:
name
- The name of the parameter- Returns:
- The values or null if no parameter with that name is found
- Throws:
PermissionDeniedException
- If the logged in user doesn't have permission to read the valuesBaseException
- If there is another error
-
setValue
<T> void setValue(String name, ParameterType<T> type, T value) throws PermissionDeniedException, InvalidDataException, BaseException Set a single value for a parameter. The core will store the value at the appropriate place in the database. Ie. as a configuration value to either the plugin or job configuration. If the configuration settings are write protected because the plugin received an execute command the settings will not be changed. If the value is null, but the parameter type doesn't allow null values, the default value is used. If the default value is null, an exception will be thrown.- Parameters:
name
- The name of the parametertype
- The type of the valuevalue
- The value to be set- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permissionInvalidDataException
- If the value is invalid according to the settings in the typeBaseException
- If there is another error
-
setValues
<T> void setValues(String name, ParameterType<T> type, List<T> values) throws PermissionDeniedException, InvalidDataException, BaseException Set a list of values for a parameter. The core will store the values at the appropriate place in the database. Ie. as a configuration value to either the plugin or job configuration. If the configuration settings are write protected because the plugin received an execute command the settings will not be changed.- Parameters:
name
- The name of the parametertype
- The type of the valuevalues
- A list containing the values- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permissionInvalidDataException
- If any of the values is invalid according to the settings in the typeBaseException
- If there is another error
-