Class SearchableAttributeNumericBase

java.lang.Object
org.kuali.rice.kew.docsearch.SearchableAttributeBase
org.kuali.rice.kew.docsearch.SearchableAttributeNumericBase
All Implemented Interfaces:
SearchableAttributeValue
Direct Known Subclasses:
SearchableAttributeFloatValue, SearchableAttributeLongValue

public abstract class SearchableAttributeNumericBase extends SearchableAttributeBase
Abstract base class for numeric searchable attributes.

Contains common logic for validation along with a template method for retrieving a validation Pattern.

Author:
Kuali Rice Team (rice.collab@kuali.org)
  • Constructor Details

    • SearchableAttributeNumericBase

      public SearchableAttributeNumericBase()
  • Method Details

    • getDefaultValidationPattern

      protected abstract Pattern getDefaultValidationPattern()
      Returns a Pattern object used for validating the format of number Strings.

      Patterns are immutable and thus safe for concurrent use, so it makes sense to return a pre-compiled static instance.

      The pattern should only match valid String representations of the numeric type

      Returns:
      the Pattern used for validating number Strings.
    • isPassesDefaultValidation

      public boolean isPassesDefaultValidation(String valueEntered)
      is the given value valid for searching against this attribute?

      This method detects the binary operators defined by SearchOperator.BETWEEN, SearchOperator.AND, and SearchOperator.OR and validates their operands by recursing on them. It also strips off other valid numeric operators before parsing the leaf operands.

      A Pattern which is provided by the template method getDefaultValidationPattern() is used for parsing the numeric strings themselves.

      Note that the parsing of expressions done here is very rudimentary, this method is mostly focused on validating that any operands are valid numeric strings for the attribute type.

      Parameters:
      valueEntered -
      Returns:
      true if the valueEntered is considered valid