Properties Handled By Scripts
One of the reasons why openBIS is easily extensible and adjustible is the concept of generic entities like samples, experiments, materials and data sets. By adding domain specific properties to the mentioned objects, instance administrator creates a data model specific to given field of study. Values of configured properties will be defined by the user upon creation or update of the entities (samples etc.).
In most cases values of properties must be provided directly by the user. The default way of handling a property in openBIS can be changed by instance admin defining a property that should be handled by a script written in Jython or Predeployed Plugin written in Java. Jython plugins use Jython version configured by the service.properties property
jython-version which can be either 2.5 or 2.7.
Types of Scripts
There are two types of plugins that can be used for handling properties, and one script type to perform validations on entities:
- Dynamic Property Evaluator (for properties referred to as Dynamic Properties)
- for properties that can't be modified by users,
- values of such properties will be evaluated automatically using metadata already stored in openBIS (e.g. values of other properties of the same entity or connected entities),
- the script defines an expression or a function that returns a value for a Dynamic Property specified in the script
- Managed Property Handler (for properties referred to as Managed Properties)
- for properties that will be indirectly modified by users,
- the script alters default handling of a property by openBIS by defining functions that specify e.g.:
- how the property should be displayed in entity detail view (e.g. as a table),
- input fields for modifying the property,
- translation and/or validation of user input.
- Entity Validation
- performed after each update or creation of a given entity type.
- the user provided script performs a validation, which can cancel the operation if the validation fails
To create a property that should be handled by a script perform the following steps.
- Define a property type with appropriate name and data type (Administration->Property Types->New).
- Define a script that will handle the property (Administration->Scripts) or deploy a Java plugin. For details and examples of usage go to pages:
- Assign the created property type to chosen entity type using the created script (e.g. for samples: Administration->Property Types->Assign to Sample Type):
- select Handled By Script checkbox,
- select the appropriate Script Type
- choose the Script
- The validation scripts are assigned to the type in the "Edit Type" section. (e.g Admin->Types->Samples. Select sample and click edit.)