org.kuali.rice.kew.docsearch
Class DocumentSearchInternalUtils

java.lang.Object
  extended by org.kuali.rice.kew.docsearch.DocumentSearchInternalUtils

public class DocumentSearchInternalUtils
extends Object

Defines various utilities for internal use in the reference implementation of the document search functionality.

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

Nested Class Summary
static class DocumentSearchInternalUtils.SearchableAttributeConfiguration
           
 
Field Summary
static List<Class<? extends SearchableAttributeValue>> SEARCHABLE_ATTRIBUTE_BASE_CLASS_LIST
           
 
Constructor Summary
DocumentSearchInternalUtils()
           
 
Method Summary
static DataType convertValueToDataType(String dataTypeValue)
          Converts a searchable attribute field data type into a UI data type
static String getAttributeTableName(RemotableAttributeField attributeField)
           
static Class<?> getDataTypeClass(RemotableAttributeField attributeField)
           
static String getDisplayValueWithDateOnly(org.joda.time.DateTime value)
           
static String getDisplayValueWithDateOnly(Timestamp value)
           
static org.joda.time.DateTime getLowerDateTimeBound(String dateRange)
           
static SearchableAttributeValue getSearchableAttributeValueByDataTypeString(String dataType)
           
static List<SearchableAttributeValue> getSearchableAttributeValueObjectTypes()
           
static org.joda.time.DateTime getUpperDateTimeBound(String dateRange)
           
static boolean isLookupCaseSensitive(RemotableAttributeField remotableAttributeField)
           
static String marshalDocumentSearchCriteria(DocumentSearchCriteria criteria)
          Marshals a DocumentSearchCriteria to JSON string
static DocumentSearchCriteria unmarshalDocumentSearchCriteria(String string)
          Unmarshals a DocumentSearchCriteria from JSON string
static Collection<RemotableAttributeError> validateParsedSearchFieldValue(String fieldName, SearchableAttributeValue attributeValue, String parsedValue, String errorMessagePrefix, List<String> resultingValues, com.google.common.base.Function<String,Collection<RemotableAttributeError>> customValidator)
          Validates a single terminal value from a single search field (list of values); calls a custom validator if default validation passes and custom validator is given
static List<RemotableAttributeError> validateSearchFieldValue(String fieldName, SearchableAttributeValue attributeValue, String enteredValue, String errorMessagePrefix, List<String> resultingValues, com.google.common.base.Function<String,Collection<RemotableAttributeError>> customValidator)
          Validates a single DocumentSearchCriteria searchable attribute field value (of the list of possibly multiple values)
static List<RemotableAttributeError> validateSearchFieldValues(String fieldName, SearchableAttributeValue attributeValue, List<String> searchValues, String errorMessagePrefix, List<String> resultingValues, com.google.common.base.Function<String,Collection<RemotableAttributeError>> customValidator)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SEARCHABLE_ATTRIBUTE_BASE_CLASS_LIST

public static final List<Class<? extends SearchableAttributeValue>> SEARCHABLE_ATTRIBUTE_BASE_CLASS_LIST
Constructor Detail

DocumentSearchInternalUtils

public DocumentSearchInternalUtils()
Method Detail

isLookupCaseSensitive

public static boolean isLookupCaseSensitive(RemotableAttributeField remotableAttributeField)

getAttributeTableName

public static String getAttributeTableName(RemotableAttributeField attributeField)

getDataTypeClass

public static Class<?> getDataTypeClass(RemotableAttributeField attributeField)

getSearchableAttributeValueObjectTypes

public static List<SearchableAttributeValue> getSearchableAttributeValueObjectTypes()

getSearchableAttributeValueByDataTypeString

public static SearchableAttributeValue getSearchableAttributeValueByDataTypeString(String dataType)

getDisplayValueWithDateOnly

public static String getDisplayValueWithDateOnly(org.joda.time.DateTime value)

getDisplayValueWithDateOnly

public static String getDisplayValueWithDateOnly(Timestamp value)

getLowerDateTimeBound

public static org.joda.time.DateTime getLowerDateTimeBound(String dateRange)
                                                    throws ParseException
Throws:
ParseException

getUpperDateTimeBound

public static org.joda.time.DateTime getUpperDateTimeBound(String dateRange)
                                                    throws ParseException
Throws:
ParseException

unmarshalDocumentSearchCriteria

public static DocumentSearchCriteria unmarshalDocumentSearchCriteria(String string)
                                                              throws IOException
Unmarshals a DocumentSearchCriteria from JSON string

Parameters:
string - the JSON
Returns:
unmarshalled DocumentSearchCriteria
Throws:
IOException

marshalDocumentSearchCriteria

public static String marshalDocumentSearchCriteria(DocumentSearchCriteria criteria)
                                            throws IOException
Marshals a DocumentSearchCriteria to JSON string

Parameters:
criteria - the criteria
Returns:
a JSON string
Throws:
IOException

validateSearchFieldValues

public static List<RemotableAttributeError> validateSearchFieldValues(String fieldName,
                                                                      SearchableAttributeValue attributeValue,
                                                                      List<String> searchValues,
                                                                      String errorMessagePrefix,
                                                                      List<String> resultingValues,
                                                                      com.google.common.base.Function<String,Collection<RemotableAttributeError>> customValidator)

validateSearchFieldValue

public static List<RemotableAttributeError> validateSearchFieldValue(String fieldName,
                                                                     SearchableAttributeValue attributeValue,
                                                                     String enteredValue,
                                                                     String errorMessagePrefix,
                                                                     List<String> resultingValues,
                                                                     com.google.common.base.Function<String,Collection<RemotableAttributeError>> customValidator)
Validates a single DocumentSearchCriteria searchable attribute field value (of the list of possibly multiple values)

Parameters:
attributeValue - the searchable attribute value type
enteredValue - the incoming DSC field value
fieldName - the name of the searchable attribute field/key
errorMessagePrefix - error message prefix
resultingValues - optional list of accumulated parsed values
customValidator - custom value validator to invoke on default validation success
Returns:
(possibly empty) list of validation error

validateParsedSearchFieldValue

public static Collection<RemotableAttributeError> validateParsedSearchFieldValue(String fieldName,
                                                                                 SearchableAttributeValue attributeValue,
                                                                                 String parsedValue,
                                                                                 String errorMessagePrefix,
                                                                                 List<String> resultingValues,
                                                                                 com.google.common.base.Function<String,Collection<RemotableAttributeError>> customValidator)
Validates a single terminal value from a single search field (list of values); calls a custom validator if default validation passes and custom validator is given

Parameters:
attributeValue - the searchable value type
parsedValue - the parsed value to validate
fieldName - the field name for error message
errorMessagePrefix - the prefix for error message
resultingValues - parsed value is appended to this list if present (non-null)
Returns:
immutable collection of errors (possibly empty)

convertValueToDataType

public static DataType convertValueToDataType(String dataTypeValue)
Converts a searchable attribute field data type into a UI data type

Parameters:
dataTypeValue - the SearchableAttributeValue data type
Returns:
the corresponding DataType


Copyright © 2005-2013 The Kuali Foundation. All Rights Reserved.