Class Failure

java.lang.Object
net.sf.basedb.util.overview.Failure

public class Failure extends Object
Holds information about a failed validation. Note that all rules are always validated. Use a ValidationOptions object to keep track of which validators that should be ignored, generate warnings or errors.

NOTE! The implementation of the equals(Object) method of this object is a bit unorthodox. Two failures are considered equal if they have the same validator but different nodes referencing the same item with the same descriptor. Two failures on the same node are never equal. This allows us to filter out duplicate failures that happens because there can be several ways to reach a certain item (for example a reference sample that is used on all hybridizations).

Version:
2.2
Author:
Nicklas
See Also:
Last modified
$Date: 2012-09-14 09:28:35 +0200 (fr, 14 sep 2012) $
  • Field Details

  • Constructor Details

    • Failure

      public Failure(ValidationRuleAction rule, Node node)
      Create a new validation failure.
      Parameters:
      rule - The validation rule that fails
      node - The node that contains the failure
    • Failure

      public Failure(ValidationRuleAction rule, Node node, String message)
      Create a new validation failure with a detailed message.
      Parameters:
      rule - The validation rule that fails
      node - The node that contains the failure
      message - A detailed message about the failue, if null the Validator.getFailureSummary() is used
    • Failure

      public Failure(ValidationRuleAction rule, Node node, String message, Fix... fixes)
      Create a new validation failure with a detailed message and a list of suggested fixes.
      Parameters:
      rule - The validation rule that fails
      node - The node that contains the failure
      message - A detailed message about the failue, if null the Validator.getFailureSummary() is used
      fixes - A list of suggested fixes
  • Method Details

    • setDescriptor

      public void setDescriptor(Object descriptor)
      Set a descriptor on this failure. This affects the equals(Object) method, since the descriptor must be equal for two failures to be equal.

      NOTE! The main reason for this property is that we need to discriminate between failures on different positions on physical bioassays.

      Parameters:
      descriptor - Any object
      Since:
      2.6
    • getDescriptor

      public Object getDescriptor()
      Returns:
      The descriptor
      Since:
      2.6
      See Also:
    • getValidator

      public ValidationRuleAction getValidator()
      Get the validation rule that failed.
      Since:
      3.2
    • getNode

      public Node getNode()
      Get the node that failed validation.
    • getMessage

      public String getMessage()
      Get a message explaining the failure.
    • getFixes

      public List<Fix> getFixes()
      Get a list of suggested fixes.
      Returns:
      A list of suggested fixes, or null if there are none
    • addFix

      public void addFix(Fix fix)
      Add a suggested fix to this failure.
      Parameters:
      fix - The fix to add.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      One failure is the same as another if they have the same validator but different nodes referencing the same item with equal descriptors.
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object