Package com.nomagic.magicdraw.validation
Class RuleViolationResult
- java.lang.Object
 - 
- com.nomagic.magicdraw.validation.RuleViolationResult
 
 
- 
@OpenApiAll public class RuleViolationResult extends java.lang.ObjectClass for rule violation result storage. 
- 
- 
Field Summary
Fields Modifier and Type Field Description private AnnotationannotationAnnotation of this violationprivate java.lang.ObjectparentObjectParent object.private booleanparentObjectInitializedIdentifies whether theparentObjectis initialized.private ConstraintparentRuleParent rule.private booleanparentRuleInitializedIdentifies whether theparentRuleis initialized.private ConstraintruleViolated constraintprivate booleansystemRuleprivate ValidationRuleSpecificationvalidationRuleSpecificationValidation 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 booleanequals(java.lang.Object o)AnnotationgetAnnotation()ReturnsAnnotationof violation.static java.util.List<Annotation>getAnnotations(java.util.Collection results)Collects annotations from a list of RuleViolationResult list.ProjectgetConstrainedProject()Returns project of the violated constraintBaseElementgetElement()Returns targetElementjava.lang.StringgetErrorMessage()Violation message or empty String.java.lang.ObjectgetParentObject()Returns parent object that should be used for grouping the results.private ElementExpressiongetParentObjectExpression(Class metaType)ConstraintgetParentRule()Returns parent rule if such is specified.ConstraintgetRule()Returns violated rule.java.lang.ObjectgetTargetObject()Returns target object of the rule violation result.inthashCode()booleanisIgnored()Checks if this violation result is ignored by user.booleanisSystemValidationResult()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 theparentRuleis initialized. 
- 
parentObjectInitialized
private boolean parentObjectInitialized
Identifies whether theparentObjectis 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()
ReturnsAnnotationof 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:
 equalsin classjava.lang.Object
 
- 
hashCode
public int hashCode()
- Overrides:
 hashCodein classjava.lang.Object
 
 - 
 
 -