Class AbstractValidationResult

java.lang.Object
ch.tocco.nice2.validate.api.result.AbstractValidationResult
All Implemented Interfaces:
ValidationResult
Direct Known Subclasses:
CommitValidationResult, CompleteEntityValidationResult, EntityValidationResult, FieldValidationResult

public abstract class AbstractValidationResult extends Object implements ValidationResult
  • Field Details

  • Constructor Details

    • AbstractValidationResult

      protected AbstractValidationResult()
  • Method Details

    • getValidatorName

      public String getValidatorName()
    • setValidatorName

      public void setValidatorName(String validatorName)
    • getValidatorClass

      public Class getValidatorClass()
    • setValidatorClass

      public void setValidatorClass(Class validatorClass)
    • getStatus

      public AbstractValidationResult.Status getStatus()
      Use the methods on the status object to find out more.
    • setStatus

      public void setStatus(AbstractValidationResult.Status status)
    • setError

      public void setError(TextMessage msg)
      sets the status to AbstractValidationResult.Status.ERROR and sets the passed TextMessage
      Parameters:
      msg - a text message for the error
    • setMessage

      public void setMessage(TextMessage msg)
    • getMessages

      public ArrayList<TextMessage> getMessages()
    • getChildren

      public List<AbstractValidationResult> getChildren()
    • addChild

      public void addChild(AbstractValidationResult child)
    • addChildAndCheckStatus

      public void addChildAndCheckStatus(AbstractValidationResult child)
      Adds the child FieldValidationResult and passes the status code up to this result if it is worse than what we currently have.
    • toString

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

      @Deprecated public String toString(boolean onlyNotOk)
      Deprecated.
      Parameters:
      onlyNotOk - Returns only validation results that were run and ended in a not-ok status.
    • _toString

      @Deprecated protected String _toString(AbstractValidationResult vRes, boolean onlyNotOkChildren)
      Deprecated.
    • getName

      protected String getName()
    • simplePrint

      public String simplePrint(boolean errorsOnly)
    • getIndent

      public String getIndent(int tabCount)
      Returns tabs to be inserted in front of text output.
      Parameters:
      tabCount - the amount of tabs to be generated
      Returns:
      the indent as a string of tabs
    • setValidationHint

      public void setValidationHint(String validationHint)
      Sets a hint to be added to the log output pointing to the reason for the validation result. Will be added to the output if no message was added during validation.
      Parameters:
      validationHint - the hint used for output
      See Also:
      • simplePrint(int, boolean)