it is possible to validate the items in submission by establishing completely configurable rules. There are two different forms of validation:
submission step validation → validation concerning a single submission step
global validation → validation concerning the entire submission form
Currently the validation of the items is carried out, under the due conditions, during
the submission of a new item
bulk import from excel files
import via OAI-PMH
using the org.dspace.validation.service.ValidationService implementation.
Submission step validation
The validations of the individual submission steps depend on the type of steps that compose the submission associated with a particular collection in which an item is to be submitted. Classes that allow this type of validation must implement the org.dspace.validation.SubmissionStepValidator interface and must be registered as a Spring context bean. Currently this interface has the following implementations:
org.dspace.validation.MetadataValidator → execute three validation check on fields validation (mandatory metadata missing, regex missing match and authority required metadata missing). This validation is associated with submission-form steps.
org.dspace.validation.LicenseValidator → check that the license has been grant for the inprogress submission looking for the presence of a license bitstream in the license bundle.
org.dspace.validation.UploadValidator → execute file required check validation
Global validation
it is possible to establish global rules that apply to multiple sections / metadata of the submission form. The classes that perform this validation must implement the org.dspace.validation.GlobalSubmissionValidator interface. Currently the only implementation is the org.dspace.validation.LogicalStatementValidator class which use a configured instance of org.dspace.content.logic.Filter type to perform a validation check. The basic concepts of this type of validation are:
filters → a filter bean is defined with a single “statement” property - this could be an Operator, to begin a longer logical statement, or a Condition, to perform a simple check. There is one simple implementation of Filter included - org.dspace.content.logic.DefaultFilter.
operators → operators are the basic logical building blocks that implement operations like AND, OR, NOT, NAND and NOR. An Operator can contain any number of other Operators or Conditions.
So statements like this can be created: (x AND (y OR z) AND a AND (b OR NOT(d))
conditions → conditions are where the actual DSpace item evaluation code is written. A condition accepts a Map<String, Object> map of parameters. Conditions don’t contain any other LogicalStatement classes – the are at the bottom of the chain. A condition could be something like MetadataValueMatchCondition, where a regex pattern and field name are passed as parameters, then tested against actual item metadata. If the regex matches, the boolean result is true. Typically, commonly used Conditions will be defined as beans elsewhere in the spring config and then referenced inside Filters and Operators to create more complex statements.
Conditions, Operators and Filters are all defined in ${dspace}/config/spring/api/item-filters.xml
Currently 3 LogicalStatementValidator are defined in the context, to perform the following validations:
verify that a Person entity has at least one identifier set
verify that a Peruvian cv Person has ubigeo set
verify that Project entity without oa-mandate has policy url
These validations are defined in the ${dspace}/config/spring/api/addon-validation-services.xml
<bean name="personHasAtLeastOneIdValidation" class="org.dspace.validation.LogicalStatementValidator">
<property name="errorKey" value="error.validation.personIdRequired"/>
<property name="metadataFields">
<list>
<value>person.identifier.orcid</value>
<value>perucris.identifier.dni</value>
<value>perucris.identifier.dina</value>
<value>perucris.identifier.renacyt</value>
<value>person.identifier.scopus-author-id</value>
<value>person.identifier.rid</value>
</list>
</property>
<property name="filter" ref="person-has-at-least-one-id_filter"/>
</bean>
<bean name="peruvianHasUbigeoSet" class="org.dspace.validation.LogicalStatementValidator">
<property name="errorKey" value="error.validation.ubigeoRequired"/>
<property name="metadataFields">
<list>
<value>perucris.ubigeo</value>
</list>
</property>
<property name="filter" ref="peruvian-cv-person-has-ubigeo_filter"/>
</bean>
<bean name="projectWithOaPolicyUrl" class="org.dspace.validation.LogicalStatementValidator">
<property name="errorKey" value="error.validation.mandateUrlRequired"/>
<property name="metadataFields">
<list>
<value>oairecerif.oamandate.url</value>
</list>
</property>
<property name="filter" ref="project-without-oa-mandate-requires-policy-url"/>
</bean>