Package com.nomagic.magicdraw.validation
Class RuleViolationResult
- java.lang.Object
-
- com.nomagic.magicdraw.validation.RuleViolationResult
-
@OpenApiAll public class RuleViolationResult extends java.lang.Object
Class for rule violation result storage.
-
-
Field Summary
Fields Modifier and Type Field Description private Annotation
annotation
Annotation of this violationprivate java.lang.Object
parentObject
Parent object.private boolean
parentObjectInitialized
Identifies whether theparentObject
is initialized.private Constraint
parentRule
Parent rule.private boolean
parentRuleInitialized
Identifies whether theparentRule
is initialized.private Constraint
rule
Violated constraintprivate boolean
systemRule
private ValidationRuleSpecification
validationRuleSpecification
Validation rule specification;
-
Constructor Summary
Constructors Constructor Description RuleViolationResult(Annotation annotation, Constraint rule)
Constructor.RuleViolationResult(Annotation annotation, Constraint rule, boolean systemRule)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
Annotation
getAnnotation()
ReturnsAnnotation
of violation.static java.util.List<Annotation>
getAnnotations(java.util.Collection results)
Collects annotations from a list of RuleViolationResult list.Project
getConstrainedProject()
Returns project of the violated constraintBaseElement
getElement()
Returns targetElement
java.lang.String
getErrorMessage()
Violation message or empty String.java.lang.Object
getParentObject()
Returns parent object that should be used for grouping the results.private ElementExpression
getParentObjectExpression(Class metaType)
Constraint
getParentRule()
Returns parent rule if such is specified.Constraint
getRule()
Returns violated rule.java.lang.Object
getTargetObject()
Returns target object of the rule violation result.int
hashCode()
boolean
isIgnored()
Checks if this violation result is ignored by user.boolean
isSystemValidationResult()
If true validation result came from system rule, else false.
-
-
-
Field Detail
-
annotation
private final Annotation annotation
Annotation of this violation
-
rule
@CheckForNull private final Constraint rule
Violated constraint
-
validationRuleSpecification
@CheckForNull private ValidationRuleSpecification validationRuleSpecification
Validation rule specification;
-
parentRule
private Constraint parentRule
Parent rule.
-
parentObject
@CheckForNull private java.lang.Object parentObject
Parent object.
-
parentRuleInitialized
private boolean parentRuleInitialized
Identifies whether theparentRule
is initialized.
-
parentObjectInitialized
private boolean parentObjectInitialized
Identifies whether theparentObject
is initialized.
-
systemRule
private final boolean systemRule
-
-
Constructor Detail
-
RuleViolationResult
public RuleViolationResult(Annotation annotation, @CheckForNull Constraint rule)
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 Detail
-
getAnnotation
public Annotation getAnnotation()
ReturnsAnnotation
of violation.- Returns:
- annotation of violation.
-
getElement
@CheckForNull public BaseElement getElement()
Returns targetElement
- Returns:
- target element.
-
getTargetObject
@CheckForNull public java.lang.Object getTargetObject()
Returns target object of the rule violation result.- Returns:
- target object.
-
getErrorMessage
public java.lang.String getErrorMessage()
Violation message or empty String.- Returns:
- violation message or empty String.
-
getRule
@CheckForNull public Constraint 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
@CheckForNull public Project getConstrainedProject()
Returns project of the violated constraint
-
getParentRule
@CheckForNull public Constraint getParentRule()
Returns parent rule if such is specified.- Returns:
- parent rule or null.
-
getParentObject
@CheckForNull public java.lang.Object getParentObject()
Returns parent object that should be used for grouping the results.- Returns:
- parent object.
-
getParentObjectExpression
@CheckForNull private ElementExpression getParentObjectExpression(Class metaType)
-
getAnnotations
public static java.util.List<Annotation> getAnnotations(java.util.Collection results)
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
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-