Class ValidationHelper


  • public class ValidationHelper
    extends Object
    UI helper utilities for running the workflow validator and extracting and converting workflow validation messages.
    Since:
    7.0.0
    Author:
    XIMA MEDIA GmbH
    • Method Detail

      • addExternalResultToModel

        public static void addExternalResultToModel​(WorkflowValidationModel validationModel,
                                                    IWorkflowValidationResult result)
        Parameters:
        validationModel - Validation model to which to add the result.
        result - Validation result to merge into the model.
      • collectValidatedElements

        public static Set<ElementKey> collectValidatedElements​(IWorkflowValidationResult result)
        Parameters:
        result - A validation result obtained from running the IWorkflowValidator.
        Returns:
        A set of all workflow element keys (nodes / triggers) that are contained in the given result.
      • findErronousNodes

        public static Set<NodeKey> findErronousNodes​(ProcessModel process,
                                                     IWorkflowValidationResult result)
        Parameters:
        process - Current process with all nodes and their children.
        result - A validation result.
        Returns:
        The UUIDs of all nodes that are either invalid themselves or contain an invalid child.
      • findErronousTasks

        public static Set<UUID> findErronousTasks​(IWorkflowValidationResult result)
        Parameters:
        result - A validation result.
        Returns:
        The UUIDs of all tasks that are either invalid themselves or contain an invalid element (node or trigger).
      • performBackgroundValidation

        public static void performBackgroundValidation​(FlowchartModel flowchartModel,
                                                       AssociatesModel associatesModel,
                                                       WorkflowValidationModel validationModel,
                                                       IWorkflowProvider provider)
                                                throws FastJsonException
        Validate the current workflow in the background while the user is editing the workflow. This provides incremental feedback to the user. Once they attempt to save the workflow, a full validation is performed.
        Parameters:
        flowchartModel - Current flowchart model.
        validationModel - Current validation model.
        associatesModel - Current associates model.
        provider - Workflow provider to use.
        Throws:
        FastJsonException - When serialized element properties could not be deserialized.
      • performFullValidation

        public static IWorkflowValidationResult performFullValidation​(WorkflowProcess process,
                                                                      FlowchartModel flowchartModel,
                                                                      WorkflowValidationModel validationModel,
                                                                      ViewSettingsModel viewSettingsModel,
                                                                      IWorkflowProvider provider)
                                                               throws FastJsonException
        Performs a full validation of the workflow and validates all elements. Adds the validation messages to the flowchart. Also shows any invalid workflow elements that are hidden so the user can see the error.
        Parameters:
        process - Workflow process to validate.
        flowchartModel - Current flowchart model.
        validationModel - Current validation model.
        viewSettingsModel - Current view settings model,
        provider - Workflow provider to use. Can be null for a new database provider.
        Returns:
        The result of the validation.
        Throws:
        FastJsonException - When serialized element properties could not be deserialized.
      • performInitialValidation

        public static void performInitialValidation​(IWorkflowValidationEnvironmentData params,
                                                    IWorkflowProvider provider,
                                                    FlowchartModel flowchartModel,
                                                    WorkflowProcess process,
                                                    WorkflowValidationModel validationModel)
        Performs the initial full validation when the workflow designer is opened.
        Parameters:
        params - Params for the validation process.
        provider - Provider to use. When not given, a new database provider is created.
        flowchartModel - Flowchart model to validate.
        process - Process to validate.
        validationModel - Current UI validation messages model.
      • toTaskMessageSet

        public static ElementMessageSetModel toTaskMessageSet​(WorkflowValidationModel validationModel,
                                                              UUID taskUuid)
        Parameters:
        validationModel - UI validation model used by the workflow designer.
        taskUuid - UUID of a task that was validated.
        Returns:
        The validation messages for the given task, merged into a message set that can be sent to the client.
      • toTaskMessagesSet

        public static Map<UUID,​ElementMessageSetModel> toTaskMessagesSet​(WorkflowValidationModel validationModel)
        Parameters:
        validationModel - Validation result stored in the workflow designer UI.
        Returns:
        The validation messages for all tasks, added to a message set that can be sent to the client.