org.kuali.rice.krad.lookup
Class LookupableImpl

java.lang.Object
  extended by org.kuali.rice.krad.uif.service.impl.ViewHelperServiceImpl
      extended by org.kuali.rice.krad.lookup.LookupableImpl
All Implemented Interfaces:
Serializable, Lookupable, ViewHelperService
Direct Known Subclasses:
AgendaLookupableHelperServiceImpl, FiscalOfficerInfoLookupViewHelperServiceImpl, GroupLookupableImpl, PersonLookupableImpl, RoleLookupableImpl

public class LookupableImpl
extends ViewHelperServiceImpl
implements Lookupable

Default implementation of Lookupable

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

Constructor Summary
LookupableImpl()
           
 
Method Summary
protected  Map<String,String> adjustCriteriaForNestedEBOs(Map<String,String> searchCriteria, boolean unbounded)
           
 boolean allowsMaintenanceDeleteAction(Object dataObject)
          Determines if given data object has associated maintenance document that allows delete maintenance actions.
 boolean allowsMaintenanceEditAction(Object dataObject)
          Determines if given data object has associated maintenance document that allows edit maintenance actions
 boolean allowsMaintenanceNewOrCopyAction()
          Determines if given data object has associated maintenance document that allows new or copy maintenance actions
protected  String getActionUrlHref(LookupForm lookupForm, Object dataObject, String methodToCall, List<String> pkNames)
          Generates a URL to perform a maintenance action on the given result data object
protected  ConfigurationService getConfigurationService()
           
protected  Map<String,InputField> getCriteriaFieldsForValidation(LookupView lookupView, LookupForm form)
           
protected  DataObjectAuthorizationService getDataObjectAuthorizationService()
           
 Class<?> getDataObjectClass()
          Returns the class for the data object the lookup is configured with
protected  DataObjectMetaDataService getDataObjectMetaDataService()
           
 List<String> getDefaultSortAttributeNames()
           
 DocumentDictionaryService getDocumentDictionaryService()
           
protected  EncryptionService getEncryptionService()
           
 Map<String,String> getFieldConversions()
           
protected  LookupService getLookupService()
           
 void getMaintenanceActionLink(LinkField actionLinkField, Object model, String maintenanceMethodToCall)
          Invoked to build a maintenance URL for a result row
protected  String getMaintenanceDocumentTypeName()
          Returns the maintenance document type associated with the business object class or null if one does not exist.
 Map<String,String> getParameters()
           
 List<String> getReadOnlyFieldsList()
           
protected  List<String> getReturnKeys(LookupView lookupView, LookupForm lookupForm, Object dataObject)
          Returns the configured return key property names or if not configured defaults to the primary keys for the data object class
protected  String getReturnUrl(LookupView lookupView, LookupForm lookupForm, Object dataObject)
          Builds the URL for returning the given data object result row
 void getReturnUrlForResults(LinkField returnLinkField, Object model)
          Invoked to build the return URL for a result row
protected  Properties getReturnUrlParameters(LookupView lookupView, LookupForm lookupForm, Object dataObject)
          Builds up a Properties object that will be used to provide the request parameters for the return URL link
protected  List<?> getSearchResults(LookupForm form, Map<String,String> searchCriteria, boolean unbounded)
           
protected  List<?> getSearchResultsForEBO(Map<String,String> searchCriteria, boolean unbounded)
           
protected  void initializeLookupViewHelperService(LookupView lookupView)
          Initializes properties on this lookupable from the LookupView
protected  boolean isResultReturnable(Object dataObject)
          Determines whether a given data object that's returned as one of the lookup's results is considered returnable, which means that for single-value lookups, a "return value" link may be rendered, and for multiple value lookups, a checkbox is rendered.
 boolean isSortAscending()
           
 Map<String,String> performClear(LookupForm form, Map<String,String> searchCriteria)
          Invoked when the clear action is requested to result the search fields to their initial default values
 void performInitialization(View view, Object model)
          Initialization of Lookupable requires that the business object class be set for the #initializeAttributeFieldFromDataDictionary(View, org.kuali.rice.krad.uif.field.InputField) method
 Collection<?> performSearch(LookupForm form, Map<String,String> searchCriteria, boolean bounded)
          Invoked to carry out the lookup search based on the given map of key/value search values
 void populateViewFromRequestParameters(View view, Map<String,String> parameters)
          Uses reflection to find all fields defined on the View instance that have the RequestParameter annotation (which indicates the field may be populated by the request).
protected  Map<String,String> processSearchCriteria(LookupForm lookupForm, Map<String,String> searchCriteria)
           
 void setConfigurationService(ConfigurationService configurationService)
           
 void setDataObjectAuthorizationService(DataObjectAuthorizationService dataObjectAuthorizationService)
           
 void setDataObjectClass(Class<?> dataObjectClass)
          Sets the class for the data object the lookup will be provided on
 void setDataObjectMetaDataService(DataObjectMetaDataService dataObjectMetaDataService)
           
 void setDefaultSortAttributeNames(List<String> defaultSortAttributeNames)
           
 void setDocumentDictionaryService(DocumentDictionaryService documentDictionaryService)
           
 void setEncryptionService(EncryptionService encryptionService)
           
 void setFieldConversions(Map<String,String> fieldConversions)
          Sets the field conversion map on the lookupable
 void setLookupService(LookupService lookupService)
           
 void setMultiValueLookupSelect(InputField selectField, Object model)
          Sets the value for the attribute field control to contain the field conversion values for the line
 void setParameters(Map<String,String> parameters)
           
 void setReadOnlyFieldsList(List<String> readOnlyFieldsList)
          Sets List of fields on the lookupable that should be made read only in the search criteria group
 void setSortAscending(boolean sortAscending)
           
 boolean validateSearchParameters(LookupForm form, Map<String,String> searchCriteria)
          Invoked to perform validation on the search criteria before the search is performed
protected  void validateSearchParameterWildcardAndOperators(InputField inputField, String searchPropertyValue)
          Validates that any wildcards contained within the search value are valid wilcards and allowed for the property type for which the field is searching
 
Methods inherited from class org.kuali.rice.krad.uif.service.impl.ViewHelperServiceImpl
addClientSideStateForComponent, addCustomContainerComponents, applyDefaultValues, applyDefaultValuesForCollectionLine, buildClientSideStateScript, buildInquiryLink, findNestedDictionaryAttribute, getCommonContext, getDataDictionaryService, getExpressionEvaluatorService, getPreModelContext, getViewDictionaryService, initializeDataFieldFromDataDictionary, invokeAuthorizerPresentationController, invokeMethodFinalizer, logAndThrowRuntime, performAddLineValidation, performApplyModel, performComponentApplyModel, performComponentFinalize, performComponentInitialization, performComponentLifecycle, performCustomApplyModel, performCustomFinalize, performCustomInitialization, performDeleteLineValidation, performFinalize, populateDefaultValueForField, processAfterAddLine, processAfterDeleteLine, processAnyRemoteFieldsHolder, processBeforeAddLine, processCollectionAddLine, processCollectionDeleteLine, processMultipleValueLookupResults, runComponentModifiers, setDataDictionaryService, setExpressionEvaluatorService, setViewContext, setViewDictionaryService, syncClientSideStateForComponent
 
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.krad.uif.service.ViewHelperService
applyDefaultValuesForCollectionLine, buildInquiryLink, performApplyModel, performComponentInitialization, performComponentLifecycle, performFinalize, processCollectionAddLine, processCollectionDeleteLine, processMultipleValueLookupResults
 

Constructor Detail

LookupableImpl

public LookupableImpl()
Method Detail

populateViewFromRequestParameters

public void populateViewFromRequestParameters(View view,
                                              Map<String,String> parameters)
Description copied from class: ViewHelperServiceImpl
Uses reflection to find all fields defined on the View instance that have the RequestParameter annotation (which indicates the field may be populated by the request).

For each field found, if there is a corresponding key/value pair in the request parameters, the value is used to populate the field. In addition, any conditional properties of PropertyReplacers configured for the field are cleared so that the request parameter value does not get overridden by the dictionary conditional logic

Specified by:
populateViewFromRequestParameters in interface ViewHelperService
Overrides:
populateViewFromRequestParameters in class ViewHelperServiceImpl
See Also:
ViewHelperServiceImpl.populateViewFromRequestParameters(org.kuali.rice.krad.uif.view.View, java.util.Map)

performInitialization

public void performInitialization(View view,
                                  Object model)
Initialization of Lookupable requires that the business object class be set for the #initializeAttributeFieldFromDataDictionary(View, org.kuali.rice.krad.uif.field.InputField) method

Specified by:
performInitialization in interface ViewHelperService
Overrides:
performInitialization in class ViewHelperServiceImpl
Parameters:
view - - View instance that should be initialized
model - - object instance containing the view data
See Also:
ViewHelperServiceImpl.performInitialization(org.kuali.rice.krad.uif.view.View, java.lang.Object)

initializeLookupViewHelperService

protected void initializeLookupViewHelperService(LookupView lookupView)
Initializes properties on this lookupable from the LookupView

Parameters:
lookupView - - lookup view instance

performSearch

public Collection<?> performSearch(LookupForm form,
                                   Map<String,String> searchCriteria,
                                   boolean bounded)
Description copied from interface: Lookupable
Invoked to carry out the lookup search based on the given map of key/value search values

Specified by:
performSearch in interface Lookupable
Parameters:
form - - lookup form instance containing the lookup data
searchCriteria - - map of criteria currently set
bounded - - indicates whether the results should be limited (if necessary) to the max search result limit configured
Returns:
the list of result objects, possibly bounded
See Also:
Lookupable.performSearch(org.kuali.rice.krad.web.form.LookupForm, java.util.Map, boolean)

getSearchResults

protected List<?> getSearchResults(LookupForm form,
                                   Map<String,String> searchCriteria,
                                   boolean unbounded)

processSearchCriteria

protected Map<String,String> processSearchCriteria(LookupForm lookupForm,
                                                   Map<String,String> searchCriteria)

getSearchResultsForEBO

protected List<?> getSearchResultsForEBO(Map<String,String> searchCriteria,
                                         boolean unbounded)

adjustCriteriaForNestedEBOs

protected Map<String,String> adjustCriteriaForNestedEBOs(Map<String,String> searchCriteria,
                                                         boolean unbounded)
                                                  throws InstantiationException,
                                                         IllegalAccessException
Throws:
InstantiationException
IllegalAccessException

performClear

public Map<String,String> performClear(LookupForm form,
                                       Map<String,String> searchCriteria)
Description copied from interface: Lookupable
Invoked when the clear action is requested to result the search fields to their initial default values

Specified by:
performClear in interface Lookupable
Parameters:
form - - lookup form instance containing the lookup data
searchCriteria - - map of criteria currently set
Returns:
map of criteria with field values reset to defaults
See Also:
Lookupable.performClear(org.kuali.rice.krad.web.form.LookupForm, java.util.Map)

validateSearchParameters

public boolean validateSearchParameters(LookupForm form,
                                        Map<String,String> searchCriteria)
Description copied from interface: Lookupable
Invoked to perform validation on the search criteria before the search is performed

Specified by:
validateSearchParameters in interface Lookupable
Parameters:
form - - lookup form instance containing the lookup data
searchCriteria - - map of criteria where key is search property name and value is search value (which can include wildcards)
See Also:
Lookupable.validateSearchParameters(org.kuali.rice.krad.web.form.LookupForm, java.util.Map)

getCriteriaFieldsForValidation

protected Map<String,InputField> getCriteriaFieldsForValidation(LookupView lookupView,
                                                                LookupForm form)

validateSearchParameterWildcardAndOperators

protected void validateSearchParameterWildcardAndOperators(InputField inputField,
                                                           String searchPropertyValue)
Validates that any wildcards contained within the search value are valid wilcards and allowed for the property type for which the field is searching

Parameters:
inputField - - attribute field instance for the field that is being searched
searchPropertyValue - - value given for field to search for

getReturnUrlForResults

public void getReturnUrlForResults(LinkField returnLinkField,
                                   Object model)
Description copied from interface: Lookupable
Invoked to build the return URL for a result row

Based on the line contained in the field context, the URL for returning the role is constructed and set as the href for the link field. If a return link cannot be constructed the field should be set to not render

Specified by:
getReturnUrlForResults in interface Lookupable
Parameters:
returnLinkField - - link field that will be used to render the return URL
model - - lookup form containing the data
See Also:
Lookupable.getReturnUrlForResults(org.kuali.rice.krad.uif.field.LinkField, java.lang.Object)

getReturnUrl

protected String getReturnUrl(LookupView lookupView,
                              LookupForm lookupForm,
                              Object dataObject)
Builds the URL for returning the given data object result row

Note return URL will only be built if a return location is specified on the LookupForm

Parameters:
lookupView - - lookup view instance containing lookup configuration
lookupForm - - lookup form instance containing the data
dataObject - - data object instance for the current line and for which the return URL is being built
Returns:
String return URL or blank if URL cannot be built

getReturnUrlParameters

protected Properties getReturnUrlParameters(LookupView lookupView,
                                            LookupForm lookupForm,
                                            Object dataObject)
Builds up a Properties object that will be used to provide the request parameters for the return URL link

Parameters:
lookupView - - lookup view instance containing lookup configuration
lookupForm - - lookup form instance containing the data
dataObject - - data object instance for the current line and for which the return URL is being built
Returns:
Properties instance containing request parameters for return URL

getReturnKeys

protected List<String> getReturnKeys(LookupView lookupView,
                                     LookupForm lookupForm,
                                     Object dataObject)
Returns the configured return key property names or if not configured defaults to the primary keys for the data object class

Returns:
List property names which should be passed back on the return URL

getMaintenanceActionLink

public void getMaintenanceActionLink(LinkField actionLinkField,
                                     Object model,
                                     String maintenanceMethodToCall)
Description copied from interface: Lookupable
Invoked to build a maintenance URL for a result row

Based on the line contained in the field context and the given maintenance method that should be called a URL is constructed and set as the href on the link field. If a maintenance link cannot be constructed the field should be set to not render

Specified by:
getMaintenanceActionLink in interface Lookupable
Parameters:
actionLinkField - - link field that will be used to return the maintenance URL
model - - lookup form containing the data
maintenanceMethodToCall - - name of the method that should be invoked in the maintenance controller
See Also:
Lookupable.getMaintenanceActionLink(org.kuali.rice.krad.uif.field.LinkField, java.lang.Object, java.lang.String)

getActionUrlHref

protected String getActionUrlHref(LookupForm lookupForm,
                                  Object dataObject,
                                  String methodToCall,
                                  List<String> pkNames)
Generates a URL to perform a maintenance action on the given result data object

Will build a URL containing keys of the data object to invoke the given maintenance action method within the maintenance controller

Parameters:
dataObject - - data object instance for the line to build the maintenance action link for
methodToCall - - method name on the maintenance controller that should be invoked
pkNames - - list of primary key field names for the data object whose key/value pairs will be added to the maintenance link
Returns:
String URL link for the maintenance action

setMultiValueLookupSelect

public void setMultiValueLookupSelect(InputField selectField,
                                      Object model)
Sets the value for the attribute field control to contain the field conversion values for the line

Specified by:
setMultiValueLookupSelect in interface Lookupable
See Also:
setMultiValueLookupSelect(org.kuali.rice.krad.uif.field.InputField, java.lang.Object)

allowsMaintenanceNewOrCopyAction

public boolean allowsMaintenanceNewOrCopyAction()
Determines if given data object has associated maintenance document that allows new or copy maintenance actions

Returns:
boolean true if the maintenance new or copy action is allowed for the data object instance, false otherwise

allowsMaintenanceEditAction

public boolean allowsMaintenanceEditAction(Object dataObject)
Determines if given data object has associated maintenance document that allows edit maintenance actions

Returns:
boolean true if the maintenance edit action is allowed for the data object instance, false otherwise

allowsMaintenanceDeleteAction

public boolean allowsMaintenanceDeleteAction(Object dataObject)
Determines if given data object has associated maintenance document that allows delete maintenance actions.

Returns:
boolean true if the maintenance delete action is allowed for the data object instance, false otherwise

getMaintenanceDocumentTypeName

protected String getMaintenanceDocumentTypeName()
Returns the maintenance document type associated with the business object class or null if one does not exist.

Returns:
String representing the maintenance document type name

isResultReturnable

protected boolean isResultReturnable(Object dataObject)
Determines whether a given data object that's returned as one of the lookup's results is considered returnable, which means that for single-value lookups, a "return value" link may be rendered, and for multiple value lookups, a checkbox is rendered. Note that this can be part of an authorization mechanism, but not the complete authorization mechanism. The component that invoked the lookup/ lookup caller (e.g. document, nesting lookup, etc.) needs to check that the object that was passed to it was returnable as well because there are ways around this method (e.g. crafting a custom return URL).

Parameters:
dataObject - - an object from the search result set
Returns:
true if the row is returnable and false if it is not

setDataObjectClass

public void setDataObjectClass(Class<?> dataObjectClass)
Description copied from interface: Lookupable
Sets the class for the data object the lookup will be provided on

Specified by:
setDataObjectClass in interface Lookupable
Parameters:
dataObjectClass - - data object class for lookup
See Also:
Lookupable.setDataObjectClass(java.lang.Class)

getDataObjectClass

public Class<?> getDataObjectClass()
Description copied from interface: Lookupable
Returns the class for the data object the lookup is configured with

Specified by:
getDataObjectClass in interface Lookupable
Returns:
Class data object class
See Also:
Lookupable.getDataObjectClass()

setFieldConversions

public void setFieldConversions(Map<String,String> fieldConversions)
Description copied from interface: Lookupable
Sets the field conversion map on the lookupable

The field conversions map specifies the mappings for return fields. When the user selects a row to return, for each configured field conversion the corresponding value from the result row will be sent back as the value for the field on the calling field.

Specified by:
setFieldConversions in interface Lookupable
Parameters:
fieldConversions - - map of field conversions where key is name of the property on result data object to get value for, and map value is the name of the field to send the value back as (name of the field on the calling view)
See Also:
Lookupable.setFieldConversions(java.util.Map)

setReadOnlyFieldsList

public void setReadOnlyFieldsList(List<String> readOnlyFieldsList)
Description copied from interface: Lookupable
Sets List of fields on the lookupable that should be made read only in the search criteria group

Specified by:
setReadOnlyFieldsList in interface Lookupable
Parameters:
readOnlyFieldsList - - list of read only fields
See Also:
Lookupable.setReadOnlyFieldsList(java.util.List)

getParameters

public Map<String,String> getParameters()

setParameters

public void setParameters(Map<String,String> parameters)

getDefaultSortAttributeNames

public List<String> getDefaultSortAttributeNames()

setDefaultSortAttributeNames

public void setDefaultSortAttributeNames(List<String> defaultSortAttributeNames)

isSortAscending

public boolean isSortAscending()

setSortAscending

public void setSortAscending(boolean sortAscending)

getReadOnlyFieldsList

public List<String> getReadOnlyFieldsList()

getFieldConversions

public Map<String,String> getFieldConversions()

getConfigurationService

protected ConfigurationService getConfigurationService()

setConfigurationService

public void setConfigurationService(ConfigurationService configurationService)

getDataObjectAuthorizationService

protected DataObjectAuthorizationService getDataObjectAuthorizationService()

setDataObjectAuthorizationService

public void setDataObjectAuthorizationService(DataObjectAuthorizationService dataObjectAuthorizationService)

getDataObjectMetaDataService

protected DataObjectMetaDataService getDataObjectMetaDataService()

setDataObjectMetaDataService

public void setDataObjectMetaDataService(DataObjectMetaDataService dataObjectMetaDataService)

getDocumentDictionaryService

public DocumentDictionaryService getDocumentDictionaryService()

setDocumentDictionaryService

public void setDocumentDictionaryService(DocumentDictionaryService documentDictionaryService)

getLookupService

protected LookupService getLookupService()

setLookupService

public void setLookupService(LookupService lookupService)

getEncryptionService

protected EncryptionService getEncryptionService()

setEncryptionService

public void setEncryptionService(EncryptionService encryptionService)


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