Class RuleViolationResult

java.lang.Object
com.nomagic.magicdraw.validation.RuleViolationResult

@OpenApiAll public class RuleViolationResult extends Object
Class for rule violation result storage.
  • Constructor Details

    • RuleViolationResult

      public RuleViolationResult(Annotation annotation, @CheckForNull Constraint rule)
      Constructor.
      Parameters:
      annotation - of this violation
      rule - violated constraint
    • RuleViolationResult

      public RuleViolationResult(Annotation annotation, @CheckForNull Constraint rule, boolean systemRule)
      Constructor.
      Parameters:
      annotation - of this violation
      rule - violated constraint
      systemRule - is system validation rule
  • Method Details

    • getAnnotation

      public Annotation getAnnotation()
      Returns Annotation of violation.
      Returns:
      annotation of violation.
    • getElement

      @CheckForNull public BaseElement getElement()
      Returns target Element
      Returns:
      target element.
    • getTargetObject

      @CheckForNull public Object getTargetObject()
      Returns target object of the rule violation result.
      Returns:
      target object.
    • getErrorMessage

      public 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 Object getParentObject()
      Returns parent object that should be used for grouping the results.
      Returns:
      parent object.
    • getAnnotations

      public static List<Annotation> getAnnotations(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(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object