public class PluginConfiguration extends AnnotatedItem implements Transactional, AnnotatableProxy, Registered
Transactional.Action
Modifier and Type | Field and Description |
---|---|
private int |
newParameterVersion |
static Item |
TYPE
The type of item represented by this class.
|
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH
Constructor and Description |
---|
PluginConfiguration(PluginConfigurationData pc) |
Modifier and Type | Method and Description |
---|---|
PluginConfigurationRequest |
configure()
Start the configuration sequence for a plugin.
|
void |
copyParametersFrom(PluginConfiguration copyFrom)
Copy all parameter values from another plugin configuration.
|
Set<Annotatable> |
getAnnotatableParents()
Get all parents objects which are annotatable and the logged in
user has read permission to.
|
String |
getAnnotationMessage()
Get a message explaining what the proxy does with the annotations.
|
ItemQuery<AnnotationType> |
getAnnotationTypes()
Get the annotation types that can be used by this configuration.
|
static PluginConfiguration |
getById(DbControl dc,
int id)
Get a
PluginConfiguration item when you know the ID. |
(package private) PluginConfigurationData |
getData()
Get the
BasicData object that holds all data for this item. |
Date |
getEntryDate()
Get the date that the item was registered in the database.
|
ItemQuery<Job> |
getJobs()
Get a query that returns the jobs
using this plugin configuration.
|
static PluginConfiguration |
getNew(DbControl dc,
PluginDefinition pd)
Create a new
PluginConfiguration item. |
private int |
getNewParameterVersion()
Increase the version number once per transaction.
|
ParameterInfo |
getParameterInfo(String name)
Get extra information about a parameter in the latest version.
|
ParameterInfo |
getParameterInfo(String name,
int version)
Get extra information about a parameter in a specific version.
|
Set<String> |
getParameterNames()
Get the names of all configuration values in the latest version.
|
Set<String> |
getParameterNames(int version)
Get the names of all configuration values in a specific version.
|
private <T> ParameterType<T> |
getParameterType(Class<T> parameterClass,
List<?> values)
Gets the ParameterType to use with a class.
|
ParameterValues |
getParameterValues(int version)
Get the configuration parameters as a
ParameterValues object. |
List<?> |
getParameterValues(String name)
Get the values of a configuration parameter in the latest version.
|
List<?> |
getParameterValues(String name,
int version)
Get the values of a configuration parameter in a specific version.
|
(package private) ParameterValuesImpl |
getParameterValuesImpl(int version)
Get a write-protected ParameterValuesImpl object so a job can read
the paremeters.
|
int |
getParameterVersion()
Get the latest version number of the parameters.
|
PluginDefinition |
getPluginDefinition()
Get the plugin definition for this configuration.
|
static ItemQuery<PluginConfiguration> |
getQuery()
Get a query configured to retrieve plugin configurations.
|
static ItemQuery<PluginConfiguration> |
getQuery(GuiContext gc,
String interfaceName)
Get a query that returns all plugins configurations related
to a specified GUI context and implementing a certain interface.
|
Item |
getType()
Get the type of item represented by the object.
|
Set<ItemProxy> |
getUsingItems()
Get all:
Job :s using this configuration
|
private <T> List<T> |
getValueList2(Element parameter,
Class<T> classType)
Gets the list of values for a parameter from the XML-file.
|
boolean |
isUsed()
Check if:
A
Job is using this plugin configuration
|
static List<Element> |
loadXmlFile2(InputStream in,
String fileName)
Load a configurations xml file from the given stream.
|
Job |
newJob(Experiment experiment)
Create a new
Job for this plugin configuration. |
(package private) void |
onAfterCommit(Transactional.Action action)
Reset parameter version so that adding new parameters will
increase the version the next time.
|
void |
setParameterValues(String name,
ParameterType<?> parameterType,
List<?> values)
Set a configuration parameter.
|
void |
setParameterValues(String name,
String label,
String description,
ParameterType<?> parameterType,
List<?> values)
Set a configuration parameter.
|
void |
setParameterValues2(List<Element> parameters)
Sets parameters for a PluginConfiguration from the elements in a xml
configurations file.
|
(package private) void |
setParameterValuesInternal(String name,
String label,
String description,
ParameterType<?> parameterType,
List<?> values,
boolean validate)
Set the values of a configuration parameter.
|
private void |
setPluginDefinition(PluginDefinition pd)
The definition cannot be changed.
|
getAnnotationSet, getProtocol, isAnnotated, removeAnnotations
getDescription, getName, getRemovedBy, isRemoved, setDescription, setName, setRemoved
getItemKey, getProjectKey, initPermissions, isShared, onBeforeCommit, setItemKey, setProjectKey
getOwner, isOwner, setOwner, takeOwnership
addAnnotatableParents, addUsingItems, addUsingItems, checkPermission, equals, getBasicData, getDbControl, getId, getPermissions, getPluginPermissions, getSessionControl, getVersion, hashCode, hasPermission, isDetached, isInDatabase, onAfterInsert, onRollback, setDbControl, setProjectDefaults, toString, validate
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getAnnotationSet, getProtocol, isAnnotated, removeAnnotations
getId, getVersion
checkPermission, getPermissions, hasPermission
getOwner, isOwner, setOwner, takeOwnership
public static final Item TYPE
Item.PLUGINCONFIGURATION
,
getType()
private int newParameterVersion
PluginConfiguration(PluginConfigurationData pc)
public static PluginConfiguration getNew(DbControl dc, PluginDefinition pd) throws PermissionDeniedException, BaseException
PluginConfiguration
item.dc
- The DbControl
which will be used for
permission checking and database access.pd
- PluginDefinition to create a configuration for.PluginConfiguration
itemInvalidDataException
- If the plugin definition is nullPermissionDeniedException
- If the logged in user doesn't have
use permission for the plugin definitionBaseException
- If there is an errorpublic static PluginConfiguration getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException
PluginConfiguration
item when you know the ID.dc
- The DbControl
which will be used for
permission checking and database access.id
- The ID of the item to loadPluginConfiguration
itemItemNotFoundException
- If an item with the specified ID is not foundPermissionDeniedException
- If the logged in user doesn't have
READ
permission for the itemBaseException
- If there is another errorpublic static ItemQuery<PluginConfiguration> getQuery()
ItemQuery
objectpublic static ItemQuery<PluginConfiguration> getQuery(GuiContext gc, String interfaceName)
PluginDefinition.isInContext(GuiContext)
returns true for the
specified item, and PluginDefinition.supports(PluginType)
returns
true for the specified interface.gc
- The item the plugin should be related to, or null
if this parameter is irrelevantinterfaceName
- The complete name of the interface that the plugin
must implement, or null if this parameter is irrelevantpublic static List<Element> loadXmlFile2(InputStream in, String fileName) throws IOException
in
- The input stream to read fromfileName
- The name of the originating file (optional)IOException
PluginConfigurationData getData()
BasicItem
BasicData
object that holds all data for this item.getData
in class AnnotatedItem
public Item getType()
Identifiable
Item
enumeration.getType
in interface Identifiable
public Date getEntryDate()
Registered
getEntryDate
in interface Registered
public boolean isUsed() throws BaseException
Job
is using this plugin configuration
isUsed
in class BasicItem
BaseException
- If not able to tell if item is used or not.BasicItem.getUsingItems()
public Set<ItemProxy> getUsingItems()
Job
:s using this configuration
getUsingItems
in class BasicItem
BasicItem.addUsingItems(Set, Item, org.hibernate.Query)
void onAfterCommit(Transactional.Action action)
onAfterCommit
in class BasicItem
Transactional
,
Developer documentation: Transactions,
Developer documentation: Coding rules and guidelines for item classespublic Set<Annotatable> getAnnotatableParents()
Annotatable
Subtypable
item that has a subtype
with the ItemSubtype.getPushAnnotations()
flag set.getAnnotatableParents
in interface Annotatable
public ItemQuery<AnnotationType> getAnnotationTypes()
AnnotationSetterPlugin
interface.getAnnotationTypes
in interface AnnotatableProxy
public String getAnnotationMessage()
getAnnotationMessage
in interface AnnotatableProxy
public PluginDefinition getPluginDefinition() throws PermissionDeniedException, BaseException
PluginDefinition
object.PermissionDeniedException
- This exception is thrown if
the logged in user doesn't have READ
permission to the items.BaseException
- If anything else fails.private void setPluginDefinition(PluginDefinition pd) throws PermissionDeniedException, InvalidUseOfNullException
public int getParameterVersion()
private int getNewParameterVersion()
public Set<String> getParameterNames()
Set
containing the names of the configuration values
or an empty set if no values has been definedgetParameterNames(int)
public Set<String> getParameterNames(int version)
version
- The version to get the configuration parameters forSet
containing the names of the configuration values
or an empty set if no values has been definedgetParameterNames()
public List<?> getParameterValues(String name) throws PermissionDeniedException, BaseException
name
- The name of the parameterPermissionDeniedException
- If the logged in user doesn't have
read permission to all valuesBaseException
- If there is another errorgetParameterValues(String, int)
public List<?> getParameterValues(String name, int version) throws PermissionDeniedException, BaseException
name
- The name of the parameterversion
- The version of the parameterPermissionDeniedException
- If the logged in user doesn't have
read permission to all valuesBaseException
- If there is another errorgetParameterValues(String)
public ParameterInfo getParameterInfo(String name) throws PermissionDeniedException, BaseException
name
- The name of the parameterPermissionDeniedException
- If the parameter contain values that
the logged in user doesn't have read permission forBaseException
- If there is another errorgetParameterInfo(String, int)
public ParameterInfo getParameterInfo(String name, int version) throws PermissionDeniedException, BaseException
name
- The name of the parameterversion
- The version of the parameterPermissionDeniedException
- If the parameter contain values that
the logged in user doesn't have read permission forBaseException
- If there is another errorgetParameterInfo(String)
public ParameterValues getParameterValues(int version)
ParameterValues
object.version
- The version of the parametersgetParameterVersion()
public void setParameterValues(String name, ParameterType<?> parameterType, List<?> values) throws InvalidDataException, PermissionDeniedException, BaseException
name
- The name of the configuration parameterparameterType
- The type of the parametervalues
- A list containing the new values, null or empty to remove the
configuration valuesPermissionDeniedException
- If the logged in user doesn't have
write permissionInvalidDataException
- If name is null or the new value doesn't
validate against the parameter typeBaseException
- If there is another errorpublic void setParameterValues(String name, String label, String description, ParameterType<?> parameterType, List<?> values) throws InvalidDataException, PermissionDeniedException, BaseException
name
- The name of the configuration parameterlabel
- The label of the parameter (optional)description
- A description of the parameter (optional)parameterType
- The type of the parametervalues
- A list containing the new values, null or empty to remove the
configuration valuesPermissionDeniedException
- If the logged in user doesn't have
write permissionInvalidDataException
- If name is null or the new value doesn't
validate against the parameter typeBaseException
- If there is another errorvoid setParameterValuesInternal(String name, String label, String description, ParameterType<?> parameterType, List<?> values, boolean validate) throws InvalidDataException, PermissionDeniedException, BaseException
name
- The name of the configuration parameterlabel
- The label of the parameter (optional)description
- A description of the parameter (optional)parameterType
- The type of the parametervalues
- A list containing the new values, null or empty to remove the
configuration valuesvalidate
- If validation by ParameterType.validate(String, List)
is needed or notPermissionDeniedException
- If the logged in user doesn't have
write permissionInvalidDataException
- If name is null or the new value doesn't
validate against the parameter typeBaseException
- If there is another errorpublic void copyParametersFrom(PluginConfiguration copyFrom) throws InvalidDataException, PermissionDeniedException, BaseException
copyFrom
- The configuration to copy parameters fromInvalidDataException
- If the copyFrom parameter is nullPermissionDeniedException
- If the logged in user doesn't have write
permission for this configurationBaseException
- If there is another errorpublic PluginConfigurationRequest configure() throws PermissionDeniedException, BaseException
PluginRequest
for more information. The parameters sent to the plugin are those from the latest
version.PluginRequest
objectPermissionDeniedException
- If the logged in user doesn't have
write permissionBaseException
- If there is another errorpublic Job newJob(Experiment experiment) throws PermissionDeniedException, BaseException
Job
for this plugin configuration.experiment
- The experiment the job is part of, or null
if the job is not part of an experimentJob
itemPermissionDeniedException
- If
the logged in user doesn't have use
permission for this plugin definitionBaseException
public ItemQuery<Job> getJobs()
ItemQuery
objectParameterValuesImpl getParameterValuesImpl(int version) throws BaseException
BaseException
public void setParameterValues2(List<Element> parameters) throws ClassNotFoundException
parameters
- A list of the parameters that shall be set to the configurationClassNotFoundException
- If there is an error while trying to find the type of the parameters.private <T> List<T> getValueList2(Element parameter, Class<T> classType)
private <T> ParameterType<T> getParameterType(Class<T> parameterClass, List<?> values)