Package com.nomagic.magicdraw.validation
Class ValidationHelper
java.lang.Object
com.nomagic.magicdraw.validation.ValidationHelper
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
openValidationWindow
(ValidationRunData validationRunData, String windowID, Collection<RuleViolationResult> results) Opens validation window and displaysRuleViolationResult
in it.static Collection<RuleViolationResult>
validate
(ValidationRunData validationRunData, String validationTaskName, ProgressStatus progressStatus) Runs validation for givenValidationRunData
static List<RuleViolationResult>
validateElement
(Element elementForValidation, List<Constraint> rules, boolean excludeReadOnly) Validates given element with given list of validation rules.static List<RuleViolationResult>
validateElement
(Element elementForValidation, List<Constraint> rules, boolean excludeReadOnly, boolean recursive) Validates given element with given list of validation rules.
-
Constructor Details
-
ValidationHelper
public ValidationHelper()
-
-
Method Details
-
validate
public static Collection<RuleViolationResult> validate(ValidationRunData validationRunData, @CheckForNull 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 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 validatedrules
- list of validation rulesexcludeReadOnly
- 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 notrecursive
- 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 displaysRuleViolationResult
in it.- Parameters:
validationRunData
- instance ofValidationRunData
windowID
- id which will be set to validation window.results
- collection ofRuleViolationResult
-