Class MetricstoolModelValidationTool Methods: - +validate( suiteName : String ) : List<ValidationResult>
- +validate( suiteName : String, severity: String ) : List<ValidationResult>
- +validate( suiteName : String, element : List, severity : String) : List<ValidationResult>
- +validate( suiteName : String, element : List, severity : String, excludeReadOnly : boolean) : List<ValidationResult>
- +getSuiteNames() : List<String>
Class ValidationResult Methods: - +getElement() : Element
- +getSeverity() : String
- +getAbbreviation() : String
- +getMessage() : String
- +isIgnored() : boolean
validate(suiteName : String) : List<ValidationResult> Uses only a suite name to validate a model from the whole project with default “debug” as severity. | Code Block |
|---|
| #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”. | Code Block |
|---|
| #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”. | Code Block |
|---|
| #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: | Code Block |
|---|
| #set ($results = $validator.validate("UML completeness constraints", $Class, "warning")) |
validate(suiteName : String, elementList : List<Element>, severity : String, excludeReadOnly : Boolean) : List<ValidationResult> Same as above, except last parameter allows to override environment option "Exclude elements from projects used in read-only mode", which is true by default. | Code Block |
|---|
| #set ($results = $validator.validate("suitename", $elementList, "severity", false)) |
The 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> | Code Block |
|---|
| #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: | Code Block |
|---|
| #foreach ($name in $validator.suiteNames)
$name
#end |
The 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. | Code Block |
|---|
| #set ($element = $result.getElement()) |
To print all validated elements' names, for example, type the following code: | Code Block |
|---|
| #set ($results = $validator.validate("UML completeness constraints"))
#foreach ($result in $results)
$result.element.name
#end |
getSeverity() : String Gets a severity type. | Code Block |
|---|
| #set ($severity = $result.getSeverity())
or
$result.severity |
getAbbreviation() : String Gets an abbreviation. | Code Block |
|---|
| #set ($abbr = $result.getAbbreviation())
or
$result.abbreviation |
getMessage() : String Gets a message. | Code Block |
|---|
| #set ($message = $result.getMessage())
or
$result.message |
isIgnored() : Boolean Gets an isIgnored value to check whether the validation error has been ignored or not. | Code Block |
|---|
| #set ($isIgnored = $result.isIgnored())
or
$result.isIgnored |
|