public class ParameterValuesWrapper extends Object implements ParameterValues
getValue(String)
and getValues(String)
methods will first check the request, if no parameter is present the job will be checked
and at last the configuration.
The setValue(String, ParameterType, Object)
and
setValues(String, ParameterType, List)
can be configured to write through to either the job or the configuration.
Modifier and Type | Field and Description |
---|---|
private ParameterValues |
config |
private ParameterValues |
job |
private boolean |
preferJob |
private Request |
request |
Constructor and Description |
---|
ParameterValuesWrapper(Request request,
ParameterValues job,
ParameterValues config,
boolean preferJob) |
Modifier and Type | Method and Description |
---|---|
int |
getId()
Get the ID of either the job or the configuration, depending in the
preferJob parameter that was set when creating this object. |
Job |
getJob()
Get the job that we are executing/configuring.
|
PluginConfiguration |
getPluginConfiguration()
Get the configuration that we are using/configuring.
|
PluginDefinition |
getPluginDefinition()
Get the PluginDefinition of either the job or the configuration, depending in the
preferJob parameter that was set when creating this object. |
Object |
getValue(String name)
Get the value of the parameter with the specified name.
|
List<?> |
getValues(String name)
Get the values of the parameter with the specified name.
|
<T> void |
setValue(String name,
ParameterType<T> type,
T value)
Set the value on either the job or configuration, depending in the
preferJob parameter that was set when creating this object. |
<T> void |
setValues(String name,
ParameterType<T> type,
List<T> values)
Set the value on either the job or configuration, depending in the
preferJob parameter that was set when creating this object. |
private final Request request
private final ParameterValues job
private final ParameterValues config
private final boolean preferJob
public ParameterValuesWrapper(Request request, ParameterValues job, ParameterValues config, boolean preferJob)
public int getId()
preferJob
parameter that was set when creating this object.getId
in interface ParameterValues
public Job getJob()
ParameterValues
getJob
in interface ParameterValues
public PluginConfiguration getPluginConfiguration()
ParameterValues
getPluginConfiguration
in interface ParameterValues
public PluginDefinition getPluginDefinition()
preferJob
parameter that was set when creating this object.getPluginDefinition
in interface ParameterValues
public Object getValue(String name) throws PermissionDeniedException, BaseException
getValue
in interface ParameterValues
name
- the name of the parameterPermissionDeniedException
- If the logged in user doesn't
have permission to read the valueBaseException
- If there is another errorpublic List<?> getValues(String name) throws PermissionDeniedException, BaseException
getValues
in interface ParameterValues
name
- The name of the parameterPermissionDeniedException
- If the logged in user doesn't
have permission to read the valuesBaseException
- If there is another errorpublic <T> void setValue(String name, ParameterType<T> type, T value) throws PermissionDeniedException, InvalidDataException, BaseException
preferJob
parameter that was set when creating this object.setValue
in interface ParameterValues
name
- The name of the parametertype
- The type of the valuevalue
- The value to be setPermissionDeniedException
- 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 errorpublic <T> void setValues(String name, ParameterType<T> type, List<T> values) throws PermissionDeniedException, InvalidDataException, BaseException
preferJob
parameter that was set when creating this object.setValues
in interface ParameterValues
name
- The name of the parametertype
- The type of the valuevalues
- A list containing the valuesPermissionDeniedException
- 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