|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.core.plugin.ParameterValuesWrapper
public class ParameterValuesWrapper
A helper class that will wrap the parameter values from one job, one configuration
and one request object. The main use is to simplify reading parameter values that
may be located at different places. The 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.
Field Summary | |
---|---|
private ParameterValues |
config
|
private ParameterValues |
job
|
private boolean |
preferJob
|
private Request |
request
|
Constructor Summary | |
---|---|
ParameterValuesWrapper(Request request,
ParameterValues job,
ParameterValues config,
boolean preferJob)
|
Method Summary | ||
---|---|---|
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. |
|
|
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. |
|
|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final Request request
private final ParameterValues job
private final ParameterValues config
private final boolean preferJob
Constructor Detail |
---|
public ParameterValuesWrapper(Request request, ParameterValues job, ParameterValues config, boolean preferJob)
Method Detail |
---|
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 parameter
PermissionDeniedException
- If the logged in user doesn't
have permission to read the value
BaseException
- If there is another errorpublic List<?> getValues(String name) throws PermissionDeniedException, BaseException
getValues
in interface ParameterValues
name
- The name of the parameter
PermissionDeniedException
- If the logged in user doesn't
have permission to read the values
BaseException
- 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 set
PermissionDeniedException
- If the logged in user doesn't
have write permission
InvalidDataException
- If the value is invalid according
to the settings in the type
BaseException
- 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 values
PermissionDeniedException
- If the logged in user doesn't
have write permission
InvalidDataException
- If any of the values is invalid according
to the settings in the type
BaseException
- If there is another error
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |