agave-monitors/monitors-core/src/main/java/org/iplantc/service/monitor/search/MonitorSearchFilter.java
/**
	 * Validates an individual search value against the type defined by the field mapping.
	 *  
	 * @param searchTermType
	 * @param searchField
	 * @param searchValue
	 * @return 
	 * @throws IllegalArgumentException
	 */
Validates an individual search value against the type defined by the field mapping.


Validates an individual search value against the type defined by the field mapping .
public Object strongTypeSearchValue(Class searchTermType, String searchField, String searchValue) 
	throws IllegalArgumentException
	{
		if (searchTermType == Date.class) {
            Object time = StringToTime.date(searchValue);
            if (Boolean.FALSE.equals(time)) {
                if (NumberUtils.isDigits(searchValue)) {
                    try {
                        DateTime dateTime = new DateTime(Long.valueOf(searchValue));
                        return dateTime.toDate();
                    } catch (IllegalArgumentException e) {
                        throw new IllegalArgumentException("Illegal date format for " + searchField);
                    }
                } else {
                    try {
                        DateTime dateTime = new DateTime(searchValue);
                        return dateTime.toDate();
                    } catch (IllegalArgumentException e) {
                        throw new IllegalArgumentException("Illegal date format for " + searchField);
                    }
                }
            } else {
                return time;
            }
        } else if (searchTermType == Long.class) {
            if (NumberUtils.isNumber(searchValue)) {
                return NumberUtils.toLong(searchValue);
            } else {
                throw new IllegalArgumentException("Illegal integer value for " + searchField);
            }
        } else if (searchTermType == Integer.class) {
            if (NumberUtils.isNumber(searchValue)) {
                return NumberUtils.toInt(searchValue);
            } else {
                throw new IllegalArgumentException("Illegal integer value for " + searchField);
            }
        } else if (searchTermType == Double.class) {
            if (NumberUtils.isNumber(searchValue)) {
                return NumberUtils.toDouble(searchValue);
            } else {
                throw new IllegalArgumentException("Illegal decimal value for " + searchField);
            }
        } else if (searchTermType == Boolean.class) {
            if (NumberUtils.isNumber(searchValue)) {
            	return NumberUtils.toInt(searchValue, 0) == 1;
            } 
            else {
            	return BooleanUtils.toBoolean(searchValue);
            }
        } else {
            return searchValue;
        }
	}
public Object strongTypeSearchValue ( Class searchTermType , String searchField , String searchValue ) throws IllegalArgumentException { if ( searchTermType == Date . class ) { Object time = StringToTime . date ( searchValue ) ; if ( Boolean . FALSE . equals ( time ) ) { if ( NumberUtils . isDigits ( searchValue ) ) { try { DateTime dateTime = new DateTime ( Long . valueOf ( searchValue ) ) ; return dateTime . toDate ( ) ; } catch ( IllegalArgumentException e ) { throw new IllegalArgumentException ( "Illegal date format for " + searchField ) ; } } else { try { DateTime dateTime = new DateTime ( searchValue ) ; return dateTime . toDate ( ) ; } catch ( IllegalArgumentException e ) { throw new IllegalArgumentException ( "Illegal date format for " + searchField ) ; } } } else { return time ; } } else if ( searchTermType == Long . class ) { if ( NumberUtils . isNumber ( searchValue ) ) { return NumberUtils . toLong ( searchValue ) ; } else { throw new IllegalArgumentException ( "Illegal integer value for " + searchField ) ; } } else if ( searchTermType == Integer . class ) { if ( NumberUtils . isNumber ( searchValue ) ) { return NumberUtils . toInt ( searchValue ) ; } else { throw new IllegalArgumentException ( "Illegal integer value for " + searchField ) ; } } else if ( searchTermType == Double . class ) { if ( NumberUtils . isNumber ( searchValue ) ) { return NumberUtils . toDouble ( searchValue ) ; } else { throw new IllegalArgumentException ( "Illegal decimal value for " + searchField ) ; } } else if ( searchTermType == Boolean . class ) { if ( NumberUtils . isNumber ( searchValue ) ) { return NumberUtils . toInt ( searchValue , 0 ) == 1 ; } else { return BooleanUtils . toBoolean ( searchValue ) ; } } else { return searchValue ; } }
Validates an individual search value against the type defined by the field mapping.
Validates an individual search value against the type defined by the field mapping .