org.kuali.rice.krad.uif.field
Class AttributeQuery

java.lang.Object
  extended by org.kuali.rice.krad.uif.field.AttributeQuery
All Implemented Interfaces:
Serializable

public class AttributeQuery
extends Object
implements Serializable

Holds configuration for executing a dynamic query on an InputField to pull data for updating the UI

There are two types of query types that can be configured and executed. The first is provided completely by the framework using the LookupService and will perform a query against the configured dataObjectClassName using the query parameters and return field mapping. The second type will invoke a method that will perform the query. This can be configured using the queryMethodToCall (if the method is on the view helper service), or using the queryMethodInvoker if the method is on another class or object.

Author:
Kuali Rice Team (rice.collab@kuali.org)
See Also:
Serialized Form

Constructor Summary
AttributeQuery()
           
 
Method Summary
 Map<String,String> getAdditionalCriteria()
          Fixed criteria that will be appended to the dynamic criteria generated for the query.
 String getDataObjectClassName()
          Class name for the data object the query should be performed against
 Map<String,String> getQueryFieldMapping()
          Configures the query parameters by mapping fields in the view to properties on the data object class for the query
 String getQueryFieldMappingJsString()
          Builds String for passing the queryFieldMapping Map as a Javascript object parameter
 List<String> getQueryMethodArgumentFieldList()
          List of field names that should be passed as arguments to the query method
 String getQueryMethodArgumentFieldsJsString()
          Builds String for passing the queryMethodArgumentFieldList as a Javascript array
 MethodInvokerConfig getQueryMethodInvokerConfig()
          Configures the query method target class/object and method name
 String getQueryMethodToCall()
          Configures the name of the method that should be invoked to perform the query
 Map<String,String> getReturnFieldMapping()
          Maps properties from the result object of the query to fields in the view
 String getReturnFieldMappingJsString()
          Builds String for passing the returnFieldMapping Map as a Javascript object parameter
 String getReturnMessageStyleClasses()
          CSS Style classes that should be applied to the return message.
 String getReturnMessageText()
          Message text to display along with the query result
 List<String> getSortPropertyNames()
          List of property names to sort the query results by.
 boolean hasConfiguredMethod()
          Indicates whether this attribute query is configured to invoke a custom method as opposed to running the general object query.
 boolean isRenderNotFoundMessage()
          Indicates whether a message should be added to the query result object and displayed when the query return object is null
 void setAdditionalCriteria(Map<String,String> additionalCriteria)
          Setter for the query's additional criteria map
 void setDataObjectClassName(String dataObjectClassName)
          Setter for the query data object class name
 void setQueryFieldMapping(Map<String,String> queryFieldMapping)
          Setter for the query parameter mapping
 void setQueryMethodArgumentFieldList(List<String> queryMethodArgumentFieldList)
          Setter for the query method argument list
 void setQueryMethodInvokerConfig(MethodInvokerConfig queryMethodInvokerConfig)
          Setter for the query method config
 void setQueryMethodToCall(String queryMethodToCall)
          Setter for the query method name
 void setRenderNotFoundMessage(boolean renderNotFoundMessage)
          Setter for the render not found message indicator
 void setReturnFieldMapping(Map<String,String> returnFieldMapping)
          Setter for the return field mapping
 void setReturnMessageStyleClasses(String returnMessageStyleClasses)
          Setter for the return messages style classes
 void setReturnMessageText(String returnMessageText)
          Setter for the return message text
 void setSortPropertyNames(List<String> sortPropertyNames)
          Setter for the list of property names to sort results by
 void updateQueryFieldMapping(BindingInfo bindingInfo)
          Adjusts the path on the query field mapping from property to match the binding path prefix of the given BindingInfo
 void updateQueryMethodArgumentFieldList(BindingInfo bindingInfo)
          Adjusts the path on the query method arguments field list to match the binding path prefix of the given BindingInfo
 void updateReturnFieldMapping(BindingInfo bindingInfo)
          Adjusts the path on the return field mapping to property to match the binding path prefix of the given BindingInfo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttributeQuery

public AttributeQuery()
Method Detail

updateQueryFieldMapping

public void updateQueryFieldMapping(BindingInfo bindingInfo)
Adjusts the path on the query field mapping from property to match the binding path prefix of the given BindingInfo

Parameters:
bindingInfo - - binding info instance to copy binding path prefix from

updateReturnFieldMapping

public void updateReturnFieldMapping(BindingInfo bindingInfo)
Adjusts the path on the return field mapping to property to match the binding path prefix of the given BindingInfo

Parameters:
bindingInfo - - binding info instance to copy binding path prefix from

updateQueryMethodArgumentFieldList

public void updateQueryMethodArgumentFieldList(BindingInfo bindingInfo)
Adjusts the path on the query method arguments field list to match the binding path prefix of the given BindingInfo

Parameters:
bindingInfo - - binding info instance to copy binding path prefix from

getQueryFieldMappingJsString

public String getQueryFieldMappingJsString()
Builds String for passing the queryFieldMapping Map as a Javascript object parameter

Returns:
String js parameter string

getReturnFieldMappingJsString

public String getReturnFieldMappingJsString()
Builds String for passing the returnFieldMapping Map as a Javascript object parameter

Returns:
String js parameter string

getQueryMethodArgumentFieldsJsString

public String getQueryMethodArgumentFieldsJsString()
Builds String for passing the queryMethodArgumentFieldList as a Javascript array

Returns:
String js parameter string

hasConfiguredMethod

public boolean hasConfiguredMethod()
Indicates whether this attribute query is configured to invoke a custom method as opposed to running the general object query. If either the query method to call is given, or the query method invoker is not null it is assumed the intention is to call a custom method

Returns:
boolean true if a custom method is configured, false if not

getDataObjectClassName

public String getDataObjectClassName()
Class name for the data object the query should be performed against

Returns:
String data object class name

setDataObjectClassName

public void setDataObjectClassName(String dataObjectClassName)
Setter for the query data object class name

Parameters:
dataObjectClassName -

getQueryFieldMapping

public Map<String,String> getQueryFieldMapping()
Configures the query parameters by mapping fields in the view to properties on the data object class for the query

Each map entry configures one parameter for the query, where the map key is the field name to pull the value from, and the map value is the property name on the object the parameter should populate.

Returns:
Map mapping of query parameters

setQueryFieldMapping

public void setQueryFieldMapping(Map<String,String> queryFieldMapping)
Setter for the query parameter mapping

Parameters:
queryFieldMapping -

getReturnFieldMapping

public Map<String,String> getReturnFieldMapping()
Maps properties from the result object of the query to fields in the view

Each map entry configures one return mapping, where the map key is the field name for the field to populate, and the map values is the name of the property on the result object to pull the value from

Returns:
Map return field mapping

setReturnFieldMapping

public void setReturnFieldMapping(Map<String,String> returnFieldMapping)
Setter for the return field mapping

Parameters:
returnFieldMapping -

getAdditionalCriteria

public Map<String,String> getAdditionalCriteria()
Fixed criteria that will be appended to the dynamic criteria generated for the query. Map key gives name of the property the criteria should apply to, and the map value is the value (literal) for the criteria. Standard lookup wildcards are allowed

Returns:
Map field name/value pairs for query criteria

setAdditionalCriteria

public void setAdditionalCriteria(Map<String,String> additionalCriteria)
Setter for the query's additional criteria map

Parameters:
additionalCriteria -

getSortPropertyNames

public List<String> getSortPropertyNames()
List of property names to sort the query results by. The sort will be performed on each property in the order they are contained within the list. Each property must be a valid property of the return query object (the data object in case of the general query)

Returns:
List property names

setSortPropertyNames

public void setSortPropertyNames(List<String> sortPropertyNames)
Setter for the list of property names to sort results by

Parameters:
sortPropertyNames -

isRenderNotFoundMessage

public boolean isRenderNotFoundMessage()
Indicates whether a message should be added to the query result object and displayed when the query return object is null

Returns:
boolean true if not found message should be added, false otherwise

setRenderNotFoundMessage

public void setRenderNotFoundMessage(boolean renderNotFoundMessage)
Setter for the render not found message indicator

Parameters:
renderNotFoundMessage -

getReturnMessageText

public String getReturnMessageText()
Message text to display along with the query result

Returns:
String literal message text

setReturnMessageText

public void setReturnMessageText(String returnMessageText)
Setter for the return message text

Parameters:
returnMessageText -

getReturnMessageStyleClasses

public String getReturnMessageStyleClasses()
CSS Style classes that should be applied to the return message. Multiple style classes should be delimited by a space

Returns:
String style classes

setReturnMessageStyleClasses

public void setReturnMessageStyleClasses(String returnMessageStyleClasses)
Setter for the return messages style classes

Parameters:
returnMessageStyleClasses -

getQueryMethodToCall

public String getQueryMethodToCall()
Configures the name of the method that should be invoked to perform the query

Should contain only the method name (no parameters or return type). If only the query method name is configured it is assumed to be on the ViewHelperService for the contained view.

Returns:
String query method name

setQueryMethodToCall

public void setQueryMethodToCall(String queryMethodToCall)
Setter for the query method name

Parameters:
queryMethodToCall -

getQueryMethodArgumentFieldList

public List<String> getQueryMethodArgumentFieldList()
List of field names that should be passed as arguments to the query method

Each entry in the list maps to a method parameter, in the other contained within the list. The value for the field within the view will be pulled and passed to the query method as an argument

Returns:
List query method argument list

setQueryMethodArgumentFieldList

public void setQueryMethodArgumentFieldList(List<String> queryMethodArgumentFieldList)
Setter for the query method argument list

Parameters:
queryMethodArgumentFieldList -

getQueryMethodInvokerConfig

public MethodInvokerConfig getQueryMethodInvokerConfig()
Configures the query method target class/object and method name

When the query method is not contained on the ViewHelperService, this can be configured for declaring the target class/object and method. The target class can be set in which case a new instance will be created and the given method invoked. Alternatively, the target object instance for the invocation can be given. Or finally a static method can be configured

Returns:
MethodInvokerConfig query method config

setQueryMethodInvokerConfig

public void setQueryMethodInvokerConfig(MethodInvokerConfig queryMethodInvokerConfig)
Setter for the query method config

Parameters:
queryMethodInvokerConfig -


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