Studio Developer Manual / Version 2107
Table Of ContentsAt the Studio server, you can define or change validators that create issues for your workflow. The issues will be shown in the so-called nagbar of Studio's StartWorkflowWindow, or WorkflowWindow. 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. (E.g. the dependent content is calculated in the WorkflowValidationPreparation)
Additionally, it is possible to change the icon for the workflows in your inbox panel, so you can highlight certain workflow steps, depending on your current workflow task.
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
accordingly to the process, that you want to add
validators for.
Now you need to define validators that have to implement the Interface
com.coremedia.rest.cap.workflow.validation.WorkflowValidator
, and optionally a
WorkflowValidationPreparation
.
Depending if 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
.
Note
If you want to add a validator for already existing Workflows you need to adapt the existing WorkflowValidatorsModel
bean
for that process.
Already existing validators
There is a set of already defined validators available, that you can use for your own validator lists. You can get these validators via the Spring configuration class com.coremedia.rest.cap.workflow.validation.WorkflowValidationConfiguration.
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
within your validator
regularly to make sure an aborted validation does not go on longer than necessary.