org.kuali.rice.kew.impl.document.search
Class DocumentSearchCriteriaTranslatorImpl

java.lang.Object
  extended by org.kuali.rice.kew.impl.document.search.DocumentSearchCriteriaTranslatorImpl
All Implemented Interfaces:
DocumentSearchCriteriaTranslator

public class DocumentSearchCriteriaTranslatorImpl
extends Object
implements DocumentSearchCriteriaTranslator

Reference implementation of DocumentSearchCriteriaTranslator.

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

Constructor Summary
DocumentSearchCriteriaTranslatorImpl()
           
 
Method Summary
protected  void applyDateRangeField(DocumentSearchCriteria.Builder criteria, String fieldName, String fieldValue)
           
protected  void applyDocumentAttribute(DocumentSearchCriteria.Builder criteria, String documentAttributeName, String attributeValue)
           
protected static void convertAttributeRangeField(String attrKey, List<String> attrValues, Map<String,String[]> values)
          Convert a ranged document search attribute field into a form field.
protected static void convertCriteriaPropertyToField(DocumentSearchCriteria criteria, String property, Map<String,String[]> values)
          Looks up a property on the criteria object and sets it as a key/value pair in the values Map
protected static void convertCriteriaPropertyToField(DocumentSearchCriteria criteria, String property, String fieldName, Map<String,String[]> values)
          Looks up a property on the criteria object and sets it as a key/value pair in the values Map
protected static void convertCriteriaRangeField(DocumentSearchCriteria criteria, String property, Map<String,String[]> values)
          Convenience method for converting a set of doc search criteria range fields into form fields
protected  Map<String,AttributeLookupSettings> getAttributeLookupSettings(DocumentSearchCriteriaContract criteria)
          Returns a map of attributelookupsettings for the custom search attributes of the document if specified in the criteria
 Map<String,String[]> translateCriteriaToFields(DocumentSearchCriteria criteria)
          Converts the DocumentSearchCriteria to a Map of values that can be applied to the Lookup form fields.
protected  void translateDocumentAttributeFieldsToCriteria(Map<String,String> fieldValues, List<String> fields, DocumentSearchCriteria.Builder criteria)
           
 DocumentSearchCriteria translateFieldsToCriteria(Map<String,String> fieldValues)
          Translates the given map of fields values into a DocumentSearchCriteria.
protected  String translateRangePropertyToExpression(Map<String,String> fieldValues, String property, String prefix, AttributeLookupSettings settings)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentSearchCriteriaTranslatorImpl

public DocumentSearchCriteriaTranslatorImpl()
Method Detail

translateFieldsToCriteria

public DocumentSearchCriteria translateFieldsToCriteria(Map<String,String> fieldValues)
Description copied from interface: DocumentSearchCriteriaTranslator
Translates the given map of fields values into a DocumentSearchCriteria. The given map of field values is keyed based on the name of the field being submitted and the value represents that field value, which may contain wildcards and other logical operators supported by the KNS lookup framework.

Specified by:
translateFieldsToCriteria in interface DocumentSearchCriteriaTranslator
Parameters:
fieldValues - the map of field names and values from which to populate the criteria
Returns:
populated document search criteria which contains the various criteria components populated based on the interpretation of the given field values

translateCriteriaToFields

public Map<String,String[]> translateCriteriaToFields(DocumentSearchCriteria criteria)
Converts the DocumentSearchCriteria to a Map of values that can be applied to the Lookup form fields.

Specified by:
translateCriteriaToFields in interface DocumentSearchCriteriaTranslator
Parameters:
criteria - the criteria to translate
Returns:
a Map of values that can be applied to the Lookup form fields.

convertAttributeRangeField

protected static void convertAttributeRangeField(String attrKey,
                                                 List<String> attrValues,
                                                 Map<String,String[]> values)
Convert a ranged document search attribute field into a form field. This means: 0) the attribute field has been identified as a ranged attribute 1) we need to parse the attribute search expression to find upper and lower bounds 2) set upper and lower bounds in distinct form fields

Parameters:
attrKey - the attribute key
attrValues - the attribute value

convertCriteriaRangeField

protected static void convertCriteriaRangeField(DocumentSearchCriteria criteria,
                                                String property,
                                                Map<String,String[]> values)
Convenience method for converting a set of doc search criteria range fields into form fields

Parameters:
criteria - the dsc
property - the abstract property name
values - the form field values

convertCriteriaPropertyToField

protected static void convertCriteriaPropertyToField(DocumentSearchCriteria criteria,
                                                     String property,
                                                     Map<String,String[]> values)
Looks up a property on the criteria object and sets it as a key/value pair in the values Map

Parameters:
criteria - the DocumentSearchCriteria
property - the DocumentSearchCriteria property name and destination field name
values - the map of values to update

convertCriteriaPropertyToField

protected static void convertCriteriaPropertyToField(DocumentSearchCriteria criteria,
                                                     String property,
                                                     String fieldName,
                                                     Map<String,String[]> values)
Looks up a property on the criteria object and sets it as a key/value pair in the values Map

Parameters:
criteria - the DocumentSearchCriteria
property - the DocumentSearchCriteria property name
fieldName - the destination field name
values - the map of values to update

applyDateRangeField

protected void applyDateRangeField(DocumentSearchCriteria.Builder criteria,
                                   String fieldName,
                                   String fieldValue)
                            throws Exception
Throws:
Exception

getAttributeLookupSettings

protected Map<String,AttributeLookupSettings> getAttributeLookupSettings(DocumentSearchCriteriaContract criteria)
Returns a map of attributelookupsettings for the custom search attributes of the document if specified in the criteria

Parameters:
criteria - the doc search criteria
Returns:
a map of attributelookupsettings for the custom search attributes of the document if specified in the criteria, empty otherwise

translateRangePropertyToExpression

protected String translateRangePropertyToExpression(Map<String,String> fieldValues,
                                                    String property,
                                                    String prefix,
                                                    AttributeLookupSettings settings)

translateDocumentAttributeFieldsToCriteria

protected void translateDocumentAttributeFieldsToCriteria(Map<String,String> fieldValues,
                                                          List<String> fields,
                                                          DocumentSearchCriteria.Builder criteria)

applyDocumentAttribute

protected void applyDocumentAttribute(DocumentSearchCriteria.Builder criteria,
                                      String documentAttributeName,
                                      String attributeValue)


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