Class ValidationHelper

java.lang.Object
com.nomagic.magicdraw.validation.ValidationHelper

@OpenApiAll public class ValidationHelper extends Object
Utility class for working with validation. It is able to invoke validation with given ValidationRunData or for specific Element. It is also able to open validation window and display validation results in it.
  • Constructor Details

    • ValidationHelper

      public ValidationHelper()
  • Method Details

    • validate

      public static Collection<RuleViolationResult> validate(ValidationRunData validationRunData, @CheckForNull String validationTaskName, @CheckForNull ProgressStatus progressStatus)
      Runs validation for given ValidationRunData
      Parameters:
      validationRunData - instance of ValidationRunData
      validationTaskName - which is visible when running validation. If Passed null, it will show default value "Validating"
      progressStatus - for validation, or null if to run validation with owe progress
      Returns:
      collection of validation results
    • validateElement

      public static List<RuleViolationResult> validateElement(Element elementForValidation, List<Constraint> rules, boolean excludeReadOnly)
      Validates given element with given list of validation rules.
      Parameters:
      elementForValidation - element which should be validated
      rules - list of validation rules
      excludeReadOnly - exclude read only elements or not
      Returns:
      list of violation results
    • validateElement

      public static List<RuleViolationResult> validateElement(Element elementForValidation, List<Constraint> rules, boolean excludeReadOnly, boolean recursive)
      Validates given element with given list of validation rules.
      Parameters:
      elementForValidation - element which should be validated.
      rules - list of validation rules.
      excludeReadOnly - exclude read only elements or not
      recursive - validate owned elements of given element recursively
      Returns:
      list of violation results
    • openValidationWindow

      public static void openValidationWindow(ValidationRunData validationRunData, String windowID, Collection<RuleViolationResult> results)
      Opens validation window and displays RuleViolationResult in it.
      Parameters:
      validationRunData - instance of ValidationRunData
      windowID - id which will be set to validation window.
      results - collection of RuleViolationResult