
A Class diagram of a ModelValidationTool.Class ModelValidationTool Methods: - +validate( suiteName : String ) : List<ValidationResult>
- +validate( suiteName : String, severity: String ) : List<ValidationResult>
- +validate( suiteName : String, element : List, severity : String) : List<ValidationResult>
- +getSuiteNames() : List<String>
Class ValidationResult Methods: - +getElement( ) : Element
- +getSeverity( ) : String
- +getAbbreviation() : String
- +getMessage( ) : String
Validate Methodsvalidate(suiteName : String) : List<ValidationResult> Uses only a suite name to validate a model from the whole project with default “debug” as severity. #set ($results = $validator.validate("suitename")) |
validate(suiteName : String, severity : String) : List<ValidationResult> Uses a suite name and a severity type to validate a model from the whole project. The severity types are “debug”, “info”, “warning”, “error” and “fatal”. #set ($results = $validator.validate("suitename", "severity")) |
validate(suiteName : String, elementList : List<Element>, severity : String) : List<ValidationResult> Uses a suite name and a severity type to validate a model from an element list. The severity types are “debug”, “info”, “warning”, “error”, and “fatal”. #set ($results = $validator.validate("suitename", $elementList, "severity")) |
To validate all classes by using ‘UML completeness constraints’ suite and the severity type is warning, for example, type the following code: #set ($results = $validator.validate("UML completeness constraints", $Class, "warning")) |
Getting the Suite Name ListThe template author can list the entire available Model Validation suite names from ‘suiteNames’ methods. The ‘suiteNames’ is available in the ModelValidationtool class. getSuiteNames() : List<String> #set ($nameList = $validator.suiteNames) |
$validator represents the ModelValidationtool class. Prints all Metrics names and their values of all Classes, for example, type the following code: #foreach ($name in $validator.suiteNames)
$name
#end |
Getting the Validation Data from Validation ResultsThe object returned from validate methods in the previous section is the list of validation results. The validation results contain columns of validation result with each row of validated models. getElement() : Element Gets a validated element. #set ($element = $result.getElement()) |
To print all validated elements' names, for example, type the following code: #set ($results = $validator.validate("UML completeness constraints"))
#foreach ($result in $results)
$result.element.name
#end |
getSeverity() : String Gets a severity type. #set ($severity = $result.getSeverity())
or
$result.severity |
getAbbreviation() : String Gets an abbreviation. #set ($abbr = $result.getAbbreviation())
or
$result.abbreviation |
getMessage() : String Gets a message. #set ($message = $result.getMessage())
or
$result.message |
isIgnored() : Boolean Gets an isIgnored value to check whether the validated element is ignored or not. #set ($isIgnored = $result.isIgnored())
or
$result.isIgnored |
|