org.modeldriven.fuml.xmi.validation
Class ValidationErrorCollector

java.lang.Object
  extended by org.modeldriven.fuml.xmi.AbstractXmiNodeVisitor
      extended by org.modeldriven.fuml.xmi.validation.ValidationErrorCollector
All Implemented Interfaces:
XmiNodeVisitor

public class ValidationErrorCollector
extends AbstractXmiNodeVisitor
implements XmiNodeVisitor

A visitor pattern implementation class that walks a given XmiNode hierarchy checking for various error conditions, creating and gathering ValidationError instances into a collection helpful for user feedback. This class can be initialized with an initial list of errors gathered from another context, and errors may be added to it's collection ad-hoc. This class heavily leverages the fuml.model package. For more information on runtime metadata, see the fuml.model package documentation.

Author:
Scott Cinnamond

Constructor Summary
ValidationErrorCollector(XmiNode root)
           
 
Method Summary
 void addEventListener(ValidationEventListener eventListener)
           
 int getErrorCount()
           
 int getErrorCount(ErrorCategory category)
           
 int getErrorCount(ErrorCode code)
           
 int getErrorCount(ErrorSeverity severity)
           
 List<ValidationError> getErrors()
           
 List<ValidationError> getErrors(ErrorCategory category)
           
 List<ValidationError> getErrors(ErrorCode code)
           
 List<ValidationError> getErrors(ErrorSeverity severity)
           
 boolean isValidateExternalReferences()
           
 void removeEventListener(ValidationEventListener eventListener)
           
 void setValidateExternalReferences(boolean validateExternalReferences)
           
 void validate()
          Traverses the entire given graph ala.
 void visit(XmiNode target, XmiNode sourceXmiNode, String sourceKey, XmiNodeVisitorStatus status, int level)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValidationErrorCollector

public ValidationErrorCollector(XmiNode root)
Method Detail

validate

public void validate()
Traverses the entire given graph ala. the visitor pattern, gathering any validation errors, other than reference errors. References are added to a collection to be validated subsequently, outside of the visitor.


addEventListener

public void addEventListener(ValidationEventListener eventListener)

removeEventListener

public void removeEventListener(ValidationEventListener eventListener)

visit

public void visit(XmiNode target,
                  XmiNode sourceXmiNode,
                  String sourceKey,
                  XmiNodeVisitorStatus status,
                  int level)
Specified by:
visit in interface XmiNodeVisitor

getErrors

public List<ValidationError> getErrors()

getErrorCount

public int getErrorCount()

getErrors

public List<ValidationError> getErrors(ErrorCode code)

getErrorCount

public int getErrorCount(ErrorCode code)

getErrors

public List<ValidationError> getErrors(ErrorCategory category)

getErrorCount

public int getErrorCount(ErrorCategory category)

getErrors

public List<ValidationError> getErrors(ErrorSeverity severity)

getErrorCount

public int getErrorCount(ErrorSeverity severity)

isValidateExternalReferences

public boolean isValidateExternalReferences()

setValidateExternalReferences

public void setValidateExternalReferences(boolean validateExternalReferences)


Copyright © 2012. All Rights Reserved.