Class DefaultWorkflowValidationContext

    • Constructor Detail

      • DefaultWorkflowValidationContext

        public DefaultWorkflowValidationContext​(WorkflowValidationParams params)
        Creates a new internal workflow validation context with the given parameters.
        Parameters:
        params - Configuration for the validation process.
    • Method Detail

      • addElementValidationMessage

        public void addElementValidationMessage​(ElementKey key,
                                                IWorkflowValidationMessage message)
        Adds a validation message for the given workflow element.
        Parameters:
        key - Key of the workflow element for which to add the message.
        message - Message to add.
      • addProcessValidationMessage

        public void addProcessValidationMessage​(IWorkflowValidationMessage message)
        Adds a validation message for the given process.
        Parameters:
        message - Message to add.
      • addTaskValidationMessage

        public void addTaskValidationMessage​(UUID key,
                                             IWorkflowValidationMessage message)
        Adds a validation message for the given workflow task.
        Parameters:
        key - Key of the workflow element for which to add the message.
        message - Message to add.
      • addUnhandledException

        public void addUnhandledException​(Throwable exception)
        Adds an unhandled exception to this workflow validation context. Usually called when an exception occurred during the validation of a certain node or trigger. This should not prevent other nodes and triggers from being validated.
        Parameters:
        exception - The unhandled exception that occurred.
      • appendElementValidationResult

        public void appendElementValidationResult​(ElementKey key,
                                                  IWorkflowElementValidationResult result)
        Parameters:
        key - Key of the workflow element for which to set the validation result.
        result - The validation result to register for the given element.
      • appendProcessValidationResult

        public void appendProcessValidationResult​(IWorkflowElementValidationResult result)
        Parameters:
        result - The validation result to register for the process.
      • appendTaskValidationResult

        public void appendTaskValidationResult​(UUID key,
                                               IWorkflowElementValidationResult result)
        Parameters:
        key - Key of the workflow element for which to set the validation result.
        result - The validation result to register for the given element.
      • buildResult

        public IWorkflowValidationResult buildResult()
        Called after validation is done. Collects all validation messages added during the validation process and returns them.
        Returns:
        The validation result representing the current state of this context.
      • getAvailabilityCheck

        public WorkflowElementAvailabilityCheck getAvailabilityCheck()
        Returns:
        Checker for checking whether a workflow element is available to the current user and client.
      • getCurrentResourceBundle

        public ResourceBundle getCurrentResourceBundle()
        Description copied from interface: IWorkflowHandlerValidationContext
        Resolves the resource bundle to be used for the workflow element that is currently being validated. This resource bundle takes into account the default resource bundle offered by FORMCYCLE, as well as the custom resource bundle indicated by IElementHandler.getResourceBundle(Locale).

        Please note as this depends upon the workflow element currently being validated, you should not store references to the returned bundle, always call this method directly.

        Specified by:
        getCurrentResourceBundle in interface IWorkflowHandlerValidationContext
        Returns:
        The current resource bundle containing all messages of the custom FORMCYCLE resources and the custom resources of the node or trigger handler.
      • getElementIndex

        public WorkflowElementIndex getElementIndex()
        Returns:
        The element index for quickly accessing workflow element by their key.
      • getUser

        public Benutzer getUser()
        Specified by:
        getUser in interface IBaseEnvironmentData
        Returns:
        The user of the active context that should be used for protocol entries etc.
      • getWorkflowBeanValidator

        public WorkflowBeanValidator getWorkflowBeanValidator()
        Returns:
        The bean validator to be used for the workflow validation process.
      • hasGroup

        public boolean hasGroup​(EWorkflowValidationGroup group)
        Parameters:
        group - Group to check
        Returns:
        Whether the group should be validated.
      • markElementValidated

        public void markElementValidated​(ElementKey key)
        Marks the given element as having been validated, regardless of whether it is valid or invalid. This exists to keep track of the elements that were validated and the elements for which validation was skipped.
        Parameters:
        key - Key of the validated element.
      • markElementValidationFailed

        public void markElementValidationFailed​(ElementKey key)
        Marks the given element as being invalid.
        Parameters:
        key - Key of the invalid element.
      • markProcessValidated

        public void markProcessValidated()
        Marks the given process as having been validated.
      • markProcessValidationFailed

        public void markProcessValidationFailed()
        Marks the process as being invalid.
      • markTaskValidated

        public void markTaskValidated​(UUID key)
        Marks the given task as having been validated, regardless of whether it is valid or invalid. This exists to keep track of the tasks that were validated and the tasks for which validation was skipped.
        Parameters:
        key - Key of the validated task.
      • markTaskValidationFailed

        public void markTaskValidationFailed​(UUID key)
        Marks the given task as being invalid.
        Parameters:
        key - Key of the invalid task.
      • setCurrentElementKey

        public void setCurrentElementKey​(ElementKey currentElementKey)
        Parameters:
        currentElementKey - The NodeKey of the current workflow node or trigger that is currently being checked.