close

Filter

loading table of contents...

Studio Developer Manual / Version 2310

Table Of Contents

9.26.5 Workflow Validation

This section describes the server-side customizations required for workflow validation. The client-side counterpart is very simple and was already covered in section Section 9.26.3, “Workflow Fields”. It is divided into two parts: the first part (this section) covers validation for custom workflows, the second one (next section) describes how to customize validation for built-in workflows.

For the Studio server you can define or change validators that create issues for your workflow. Each validator is linked to a workflow task and optionally its state, so that you can define different validators for every stage of your process. For each set of validators you can additionally define a so-called WorkflowValidationPreparation. This is a step that will be executed before the Workflow validators. (For example, the dependent content is calculated in the WorkflowValidationPreparation)

Adding custom workflow validators

In order to add validators or a preparation step for your workflow, you need to provide a bean of type WorkflowValidatorsModel within your studio-lib extension. In that model you need to set the processName according to the process that you want to add validators to. Now you need to define validators that have to implement the interface com.coremedia.rest.cap.workflow.validation.WorkflowValidator, and optionally an implementation of interface WorkflowValidationPreparation. Depending on whether you want to use the validator for the start of a workflow or for a certain task you need to either place you validator in the WorkflowStartValidators or the WorkflowTaskValidators.

Workflow validators model class diagram

Figure 9.12.  Workflow validators model class diagram


Note

Note

If you want to add a validator to a built-in workflow, see section Section 9.26.6, “Customizing Validation of Built-In Workflows”.

Already existing validators

There is a set of already defined validators available, which you can use for your own validator lists. See Spring configuration classes TranslationWorkflowValidationConfiguration PublicationWorkflowValidationConfiguration for available validator beans.

Writing your own validator

If you want to define your own validator you need to implement the interface WorkflowValidator and create issues within the method addIssuesIfInvalid. The method will receive a parameter object that you can use to compute your issues from. Within the parameter object, the isAbortRequestedRunnable object is stored, that you need to check if the validation was aborted. You need to call the isAbortRequestedRunnable method within your validator regularly to make sure that an aborted validation does not go on longer than necessary.

Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.