Package com.nomagic.magicdraw.validation
Class ValidationHelper
- java.lang.Object
-
- com.nomagic.magicdraw.validation.ValidationHelper
-
@OpenApiAll public class ValidationHelper extends java.lang.Object
Utility class for working with validation. It is able to invoke validation with givenValidationRunData
or for specificElement
. It is also able to open validation window and display validation results in it.
-
-
Constructor Summary
Constructors Constructor Description ValidationHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
openValidationWindow(ValidationRunData validationRunData, java.lang.String windowID, java.util.Collection<RuleViolationResult> results)
Opens validation window and displaysRuleViolationResult
in it.static java.util.Collection<RuleViolationResult>
validate(ValidationRunData validationRunData, java.lang.String validationTaskName, ProgressStatus progressStatus)
Runs validation for givenValidationRunData
static java.util.List<RuleViolationResult>
validateElement(Element elementForValidation, java.util.List<Constraint> rules, boolean excludeReadOnly)
Validates given element with given list of validation rules.static java.util.List<RuleViolationResult>
validateElement(Element elementForValidation, java.util.List<Constraint> rules, boolean excludeReadOnly, boolean recursive)
Validates given element with given list of validation rules.
-
-
-
Method Detail
-
validate
public static java.util.Collection<RuleViolationResult> validate(ValidationRunData validationRunData, @CheckForNull java.lang.String validationTaskName, @CheckForNull ProgressStatus progressStatus)
Runs validation for givenValidationRunData
- Parameters:
validationRunData
- instance ofValidationRunData
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 java.util.List<RuleViolationResult> validateElement(Element elementForValidation, java.util.List<Constraint> rules, boolean excludeReadOnly)
Validates given element with given list of validation rules.- Parameters:
elementForValidation
- element which should be validatedrules
- list of validation rulesexcludeReadOnly
- exclude read only elements or not- Returns:
- list of violation results
-
validateElement
public static java.util.List<RuleViolationResult> validateElement(Element elementForValidation, java.util.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 notrecursive
- validate owned elements of given element recursively- Returns:
- list of violation results
-
openValidationWindow
public static void openValidationWindow(ValidationRunData validationRunData, java.lang.String windowID, java.util.Collection<RuleViolationResult> results)
Opens validation window and displaysRuleViolationResult
in it.- Parameters:
validationRunData
- instance ofValidationRunData
windowID
- id which will be set to validation window.results
- collection ofRuleViolationResult
-
-