org.kuali.rice.kew.docsearch
Class SearchableAttributeNumericBase

java.lang.Object
  extended by org.kuali.rice.kew.docsearch.SearchableAttributeBase
      extended by 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)

Field Summary
 
Fields inherited from class org.kuali.rice.kew.docsearch.SearchableAttributeBase
ojbConcreteClass
 
Constructor Summary
SearchableAttributeNumericBase()
           
 
Method Summary
protected abstract  Pattern getDefaultValidationPattern()
          Returns a Pattern object used for validating the format of number Strings.
 boolean isPassesDefaultValidation(String valueEntered)
          is the given value valid for searching against this attribute?
 
Methods inherited from class org.kuali.rice.kew.docsearch.SearchableAttributeBase
getDocumentId, getOjbConcreteClass, getRouteHeader, getSearchableAttributeKey, getSearchableAttributeValueId, setDocumentId, setOjbConcreteClass, setRouteHeader, setSearchableAttributeKey, setSearchableAttributeValueId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.kuali.rice.kew.docsearch.SearchableAttributeValue
allowsCaseInsensitivity, allowsRangeSearches, allowsWildcards, getAttributeDataType, getAttributeTableName, getSearchableAttributeDisplayValue, getSearchableAttributeValue, isRangeValid, setupAttributeValue, setupAttributeValue, toDocumentAttribute
 

Constructor Detail

SearchableAttributeNumericBase

public SearchableAttributeNumericBase()
Method Detail

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


Copyright © 2005–2014 The Kuali Foundation. All rights reserved.