Package com.nomagic.magicdraw.validation
Class RuleViolationResult
java.lang.Object
com.nomagic.magicdraw.validation.RuleViolationResult
Class for rule violation result storage.
-
Constructor Summary
ConstructorDescriptionRuleViolationResult
(Annotation annotation, Constraint rule) Constructor.RuleViolationResult
(Annotation annotation, Constraint rule, boolean systemRule) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
ReturnsAnnotation
of violation.static List<Annotation>
getAnnotations
(Collection results) Collects annotations from a list of RuleViolationResult list.Returns project of the violated constraintReturns targetElement
Violation message or empty String.Returns parent object that should be used for grouping the results.Returns parent rule if such is specified.getRule()
Returns violated rule.Returns target object of the rule violation result.int
hashCode()
boolean
Checks if this violation result is ignored by user.boolean
If true validation result came from system rule, else false.
-
Constructor Details
-
RuleViolationResult
Constructor.- Parameters:
annotation
- of this violationrule
- violated constraint
-
RuleViolationResult
public RuleViolationResult(Annotation annotation, @CheckForNull Constraint rule, boolean systemRule) Constructor.- Parameters:
annotation
- of this violationrule
- violated constraintsystemRule
- is system validation rule
-
-
Method Details
-
getAnnotation
ReturnsAnnotation
of violation.- Returns:
- annotation of violation.
-
getElement
Returns targetElement
- Returns:
- target element.
-
getTargetObject
Returns target object of the rule violation result.- Returns:
- target object.
-
getErrorMessage
Violation message or empty String.- Returns:
- violation message or empty String.
-
getRule
Returns violated rule.- Returns:
- violated rule.
-
isIgnored
public boolean isIgnored()Checks if this violation result is ignored by user. User can ignore pair of violation - target element & constraint.- Returns:
- ignored flag.
-
getConstrainedProject
Returns project of the violated constraint -
getParentRule
Returns parent rule if such is specified.- Returns:
- parent rule or null.
-
getParentObject
Returns parent object that should be used for grouping the results.- Returns:
- parent object.
-
getAnnotations
Collects annotations from a list of RuleViolationResult list.- Parameters:
results
- list of RuleViolationResult objects- Returns:
- list of Annotation objects
-
isSystemValidationResult
public boolean isSystemValidationResult()If true validation result came from system rule, else false.- Returns:
- true if validation result came from system rule, else false.
-
equals
-
hashCode
public int hashCode()
-