The code in this section demonstrates some scenarios with Model Validation tool.
To print all validation results from a project by using the “UML completeness constraints” suite, for example, type the following code:
#import('validator', 'com.nomagic.reportwizard.tools.ModelValidationTool') #set ($results = $validator.validate("UML completeness constraints")) #foreach ($result in $results) Element: $result.element.name Severity: $result.severity Abbreviation: $result.abbreviation Message: $result.message IsIgnored: $result.isIgnored #end
To print only the validation results from the Class by using the “UML Correctness” suite and the "warning" severity, for example, type the following code:
#import('validator', 'com.nomagic.reportwizard.tools.ModelValidationTool') #set ($results = $validator.validate("UML Correctness", $Class, "warning")) #foreach ($result in $results) Element: $result.element.name Abbreviation: $result.abbreviation Message: $result.message IsIgnored: $result.isIgnored #end