Documentation Index
Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
Use this file to discover all available pages before exploring further.
Overview
We expect users to utilize theISignOffDefinitionService and IAdjustmentService to perform transactional CRUD operations. These services come with
built-in validation constraint handling using Java Bean Validation.
However, you can customize the validation performed when creating or updating sign-off definitions and adjustments
by adding beans that implement the ISignOffDefinitionValidator and IAdjustmentValidator interfaces, respectively.
We expect Sign-Off tasks to be created or updated via the workflow, hence why they are not included in the list of services that can be customized.
How it works
Atoti Sign-Off uses custom constraint annotations to validate the input of the services. For example, when creating a Sign-Off definition, the validation works as follows:- The input parameter of
ISignOffDefinitionService::createSignOffDefinitionis annotated with@SignOffDefinitionConstraint(type = CREATION). This tells Spring: when passing anISignOffDefinitionto this method, use the custom@SignOffDefinitionConstraintannotation with the typeCREATIONto validate theISignOffDefinition. This means that if you include your own implementation ofISignOffDefinitionService, the constraint will automatically be applied. @SignOffDefinitionConstraintis annotated with@Constraint(validatedBy = SignOffDefinitionConstraintValidator.class). This tells Spring: when you see the@SignOffDefinitionConstraintannotation, use theSignOffDefinitionConstraintValidatorto validate the input.- The
SignOffDefinitionConstraintValidatorclass implements Jakarta’sConstraintValidatorinterface, which is used to validate the input. TheisValidmethod is called when the input is passed to the method. This method calls theISignOffDefinitionValidatorimplementation to actually validate the input.
You can expose your own implementation of
SignOffDefinitionConstraintValidator to override the isValid method, but in order to do so,
you must extend the concrete class SignOffDefinitionConstraintValidator so that your implementation can be picked up by @SignOffDefinitionConstraint.
The Jakarta validation API requires a concrete class to be used as the validator, so we cannot use an interface.- The
ISignOffDefinitionValidatorimplementation is used to validate the input. If you want to add your own custom validation logic, expose an implementation of this interface.
Default validation
We perform the following validations out-of-the-box:Sign-Off definitions
On creation
The defaultISignOffDefinitionValidator validates the following:
- The
idfield is not populated. - The
scopefield does not overlap with another definition’s scope. See the overlapping scopes section for more details.
On update
The defaultISignOffDefinitionValidator validates the following:
- The
idfield is populated. - The
namefield has not changed, as it is required as a key for the workflow. - The
startDatefield has not changed, as it is required as a key for the workflow. - The
scopefield does not overlap with another definition’s scope. See the overlapping scopes section for more details.
Sign-Off adjustments
On creation
The defaultISignOffAdjustmentValidator validates the following:
- The
idfield is not populated.
On update
The defaultISignOffAdjustmentValidator validates the following:
- The
idfield is populated.
Custom validation
To implement your own custom validation you must expose an implementation ofISignOffDefinitionValidator or IAdjustmentValidator as a Spring Bean. This will
then replace our default validation logic. You may extend our logic by letting your implementation extend SignOffDefinitionValidator or AdjustmentValidator
respectively.
Sign-Off definitions
To provide custom validation for sign-off definitions, create a class that implements theISignOffDefinitionValidator interface and override its methods. The
interface is as follows:
ISignOffDefinitionValidator could look like this:
Sign-Off adjustments
To provide custom validation for sign-off adjustments, create a class that implements theISignOffAdjustmentValidator interface and override its methods. The
interface is as follows:
ISignOffAdjustmentValidator could look like this: