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

java.lang.Object
  extended by org.kuali.rice.kns.lookup.AbstractLookupableHelperServiceImpl
      extended by org.kuali.rice.kns.lookup.KualiLookupableHelperServiceImpl
          extended by org.kuali.rice.kew.impl.document.search.DocumentSearchCriteriaBoLookupableHelperService
All Implemented Interfaces:
Serializable, LookupableHelperService

public class DocumentSearchCriteriaBoLookupableHelperService
extends KualiLookupableHelperServiceImpl

Implementation of lookupable helper service which handles the complex lookup behavior required by the KEW document search screen.

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

Field Summary
protected  DocumentSearchCriteria criteria
           
protected  DocumentSearchResults searchResults
           
 
Fields inherited from class org.kuali.rice.kns.lookup.KualiLookupableHelperServiceImpl
LOG, searchUsingOnlyPrimaryKeyValues
 
Fields inherited from class org.kuali.rice.kns.lookup.AbstractLookupableHelperServiceImpl
ACTION_URLS_CHILDREN_END, ACTION_URLS_CHILDREN_SEPARATOR, ACTION_URLS_CHILDREN_STARTER, ACTION_URLS_EMPTY, ACTION_URLS_SEPARATOR, backLocation, businessObjectAuthorizationService, businessObjectClass, businessObjectDictionaryService, businessObjectMetaDataService, businessObjectService, configurationService, dataDictionaryService, docFormKey, docNum, encryptionService, fieldConversions, forceLookupResultFieldInquiryCache, inquirableClassCache, kualiInquirable, lookupResultsService, lookupService, maintenanceDocumentDictionaryService, noLookupResultFieldInquiryCache, parameters, parameterService, persistenceStructureService, readOnlyFieldsList, referencesToRefresh, resultColumns, RESULTS_DEFAULT_MAX_COLUMN_LENGTH, rows, sequenceAccessorService, TITLE_ACTION_URL_PREPENDTEXT_PROPERTY, TITLE_RETURN_URL_PREPENDTEXT_PROPERTY
 
Constructor Summary
DocumentSearchCriteriaBoLookupableHelperService()
           
 
Method Summary
protected  void applyCriteriaChangesToFields(DocumentSearchCriteriaContract criteria)
          Applies changes that might have happened to the criteria back to the fields so that they show up on the form.
 boolean checkForAdditionalFields(Map fieldValues)
          Determines if there should be more search fields rendered based on already entered search criteria, and generates additional form rows.
protected  Map<String,String> cleanupFieldValues(Map<String,String> fieldValues, Map<String,String[]> parameters)
          Cleans up various issues with fieldValues coming from the lookup form (namely, that they don't include multi-valued field values!).
protected  void executeColumnCustomization(ResultRow resultRow, DocumentSearchResult searchResult, DocumentSearchResultSetConfiguration resultSetConfiguration, DocumentSearchCriteriaConfiguration criteriaConfiguration)
          Executes customization of columns, could include removing certain columns or adding additional columns to the result row (in cases where columns are added by document search customization, such as searchable attributes).
protected  HtmlData.AnchorHtmlData generateDocumentHandlerUrl(String documentId, DocumentType documentType, boolean superUserSearch)
          Generates the appropriate document handler url for the given document.
protected  HtmlData.AnchorHtmlData generateRouteLogUrl(String documentId)
           
 DocumentSearchCriteriaProcessor getDocumentSearchCriteriaProcessor()
           
 DocumentSearchCriteriaTranslator getDocumentSearchCriteriaTranslator()
           
 DocumentSearchService getDocumentSearchService()
           
 Field getExtraField()
          get an extra field
protected  Iterable<Field> getFormFields()
          Returns an iterable of current form fields
protected  Map<String,String[]> getFormFieldsValues()
          Preserves Field values, saving single or array property value depending on field type; single property value is converted into String[1] This implementation makes the assumption that a Field can either represent a single property value, or an array of values but not both! (only one is preserved)
 HtmlData getInquiryUrl(BusinessObject bo, String propertyName)
          Custom implementation of getInquiryUrl that sets up doc handler link.
protected  String getSavedSearchName()
           
protected  List<? extends BusinessObject> getSearchResultsHelper(Map<String,String> fieldValues, boolean unbounded)
          This method does the actual search, with the parameters specified, and returns the result.
 String getSupplementalMenuBar()
          This method gets the supplemental lookup menu if any
protected  boolean isAdvancedSearch()
          Returns true if the current search being executed is an "advanced" search.
protected  boolean isClearSavedSearch()
          Returns true if the current "search" being executed is an "clear" search.
protected  boolean isDocumentHandlerPopup()
          Returns true if the document handler should open in a new window.
protected  boolean isFlagSet(String flagName)
          Parses a boolean request parameter
 boolean isRouteLogPopup()
          Returns true if the route log should open in a new window.
protected  boolean isSuperUserSearch()
          Returns true if the current search being executed is a super user search.
protected  DocumentSearchCriteria loadCriteria(Map<String,String> fieldValues)
          Loads the document search criteria from the given map of field values as submitted from the search screen, and populates the current form Rows/Fields with the saved criteria fields
protected  boolean loadSavedSearch(boolean ignoreErrors)
          Loads a saved search
protected  void mergeFieldValues(Map<String,String[]> values)
          Overrides Row Field values with Map values
protected static void overrideFieldValue(Field field, Map<String,String[]> newValues, Map<String,String[]> oldValues)
          Overrides a Field value; sets a fallback/restored value if there is no new value
 void performClear(LookupForm lookupForm)
          This method does the logic for the clear action.
 boolean performCustomAction(boolean ignoreErrors)
          Performs custom document search/lookup actions.
 Collection performLookup(LookupForm lookupForm, Collection resultTable, boolean bounded)
          Performs the lookup and returns a collection of lookup items
protected  void populateCustomColumns(List<Column> customColumns, DocumentSearchResult searchResult)
           
protected  void populateResultWarningMessages(DocumentSearchResults searchResults)
          Inspects the lookup results to determine if any warning messages should be published to the message map.
protected  List<org.kuali.rice.kew.impl.document.search.DocumentSearchCriteriaBo> populateSearchResults(List<DocumentSearchResult> lookupResults)
           
protected  void postProcessResults(Collection<ResultRow> resultRows, DocumentSearchResults searchResults)
          Takes a collection of result rows and does final processing on them.
protected  void repopulateSearchTypeFlags()
          Repopulate the fields indicating advanced/superuser search type.
 void setDocumentSearchCriteriaProcessor(DocumentSearchCriteriaProcessor documentSearchCriteriaProcessor)
           
 void setDocumentSearchCriteriaTranslator(DocumentSearchCriteriaTranslator documentSearchCriteriaTranslator)
           
 void setDocumentSearchService(DocumentSearchService documentSearchService)
           
protected static void setFieldValue(Field field, String[] values)
          Sets a Field value appropriately, depending on whether it is a "multi-value" field type
protected  void setFormField(String name, String value)
          Sets a single form field
protected  void setRows()
          Override setRows in order to post-process and add documenttype-dependent fields
protected  void setRows(String documentTypeName)
          Sets the rows for the search criteria.
 boolean shouldDisplayHeaderNonMaintActions()
           
 boolean shouldDisplayLookupCriteria()
           
protected  void toggleFormView()
          Handles toggling between form views.
 
Methods inherited from class org.kuali.rice.kns.lookup.KualiLookupableHelperServiceImpl
getExternalBusinessObjectProperty, getExternalizableBusinessObjectClass, getExternalizableBusinessObjectFieldValues, getExternalizableBusinessObjectProperties, getPrimaryKeyFieldLabels, getSearchResults, getSearchResultsUnbounded, hasExternalBusinessObjectProperty, isExternalBusinessObjectProperty, isSearchUsingOnlyPrimaryKeyValues, removeExternalizableBusinessObjectFieldValues
 
Methods inherited from class org.kuali.rice.kns.lookup.AbstractLookupableHelperServiceImpl
addToReturnHref, allowsMaintenanceDeleteAction, allowsMaintenanceEditAction, allowsMaintenanceNewOrCopyAction, allowsNewOrCopyAction, applyConditionalLogicForFieldDisplay, applyFieldAuthorizationsFromNestedLookups, getActionUrlHref, getActionUrls, getActionUrlTitleText, getBackLocation, getBusinessObjectAuthorizationService, getBusinessObjectClass, getBusinessObjectDictionaryService, getBusinessObjectMetaDataService, getBusinessObjectService, getColumnMaxLength, getColumns, getConditionallyHiddenPropertyNames, getConditionallyReadOnlyPropertyNames, getConditionallyRequiredPropertyNames, getCurrentSearchFieldValue, getCustomActionUrls, getDataDictionaryService, getDefaultSortColumns, getDocFormKey, getDocNum, getEmptyActionUrls, getEmptyAnchorHtmlData, getEncryptionService, getKualiConfigurationService, getKualiInquirable, getLookupResultsService, getLookupService, getMaintenanceDocumentDictionaryService, getMaintenanceDocumentTypeName, getMaintenanceUrl, getParameters, getParameters, getParameterService, getParametersFromPrimaryKey, getPersistenceStructureService, getPropertyClass, getReadOnlyFieldsList, getReferencesToRefresh, getReturnAnchorHtmlData, getReturnHref, getReturnHref, getReturnInputHtmlData, getReturnKeys, getReturnLocation, getReturnUrl, getReturnUrl, getRows, getSequenceAccessorService, getTitle, getUrlData, getUrlData, isResultReturnable, maskValueIfNecessary, setBackLocation, setBusinessObjectClass, setBusinessObjectDictionaryService, setBusinessObjectMetaDataService, setBusinessObjectService, setDataDictionaryService, setDocFormKey, setDocNum, setEncryptionService, setFieldConversions, setKualiInquirable, setLookupResultsService, setLookupService, setMaintenanceDocumentDictionaryService, setParameters, setParameterService, setParameterService, setPersistenceStructureService, setReadOnlyFieldsList, setReferencesToRefresh, setSequenceAccessorService, validateSearchParameters, validateSearchParameterWildcardAndOperators
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

searchResults

protected DocumentSearchResults searchResults

criteria

protected DocumentSearchCriteria criteria
Constructor Detail

DocumentSearchCriteriaBoLookupableHelperService

public DocumentSearchCriteriaBoLookupableHelperService()
Method Detail

getSearchResultsHelper

protected List<? extends BusinessObject> getSearchResultsHelper(Map<String,String> fieldValues,
                                                                boolean unbounded)
Description copied from class: KualiLookupableHelperServiceImpl
This method does the actual search, with the parameters specified, and returns the result. NOTE that it will not do any upper-casing based on the DD forceUppercase. That is handled through an external call to LookupUtils.forceUppercase().

Overrides:
getSearchResultsHelper in class KualiLookupableHelperServiceImpl
Parameters:
fieldValues - A Map of the fieldNames and fieldValues to be searched on.
unbounded - Whether the results should be bounded or not to a certain max size.
Returns:
A List of search results.

populateResultWarningMessages

protected void populateResultWarningMessages(DocumentSearchResults searchResults)
Inspects the lookup results to determine if any warning messages should be published to the message map.


applyCriteriaChangesToFields

protected void applyCriteriaChangesToFields(DocumentSearchCriteriaContract criteria)
Applies changes that might have happened to the criteria back to the fields so that they show up on the form. Namely, this handles populating the form with today's date if the create date was not filled in on the form.


cleanupFieldValues

protected Map<String,String> cleanupFieldValues(Map<String,String> fieldValues,
                                                Map<String,String[]> parameters)
Cleans up various issues with fieldValues coming from the lookup form (namely, that they don't include multi-valued field values!). Handles these by adding them comma-separated.


loadCriteria

protected DocumentSearchCriteria loadCriteria(Map<String,String> fieldValues)
Loads the document search criteria from the given map of field values as submitted from the search screen, and populates the current form Rows/Fields with the saved criteria fields


populateSearchResults

protected List<org.kuali.rice.kew.impl.document.search.DocumentSearchCriteriaBo> populateSearchResults(List<DocumentSearchResult> lookupResults)

performLookup

public Collection performLookup(LookupForm lookupForm,
                                Collection resultTable,
                                boolean bounded)
Description copied from class: AbstractLookupableHelperServiceImpl
Performs the lookup and returns a collection of lookup items

Specified by:
performLookup in interface LookupableHelperService
Overrides:
performLookup in class AbstractLookupableHelperServiceImpl
Returns:
the list of result BOs, possibly bounded

setFieldValue

protected static void setFieldValue(Field field,
                                    String[] values)
Sets a Field value appropriately, depending on whether it is a "multi-value" field type


getFormFieldsValues

protected Map<String,String[]> getFormFieldsValues()
Preserves Field values, saving single or array property value depending on field type; single property value is converted into String[1] This implementation makes the assumption that a Field can either represent a single property value, or an array of values but not both! (only one is preserved)

Returns:
a Map containing field values depending on field type

overrideFieldValue

protected static void overrideFieldValue(Field field,
                                         Map<String,String[]> newValues,
                                         Map<String,String[]> oldValues)
Overrides a Field value; sets a fallback/restored value if there is no new value


mergeFieldValues

protected void mergeFieldValues(Map<String,String[]> values)
Overrides Row Field values with Map values

Parameters:
values -

setFormField

protected void setFormField(String name,
                            String value)
Sets a single form field


toggleFormView

protected void toggleFormView()
Handles toggling between form views. Reads and sets the Rows state.


loadSavedSearch

protected boolean loadSavedSearch(boolean ignoreErrors)
Loads a saved search

Returns:
returns true on success to run the loaded search, false on error.

performCustomAction

public boolean performCustomAction(boolean ignoreErrors)
Performs custom document search/lookup actions. 1) switching between simple/detailed search 2) switching between non-superuser/superuser search 3) clearing saved search results 4) restoring a saved search and executing the search

Specified by:
performCustomAction in interface LookupableHelperService
Overrides:
performCustomAction in class AbstractLookupableHelperServiceImpl
Parameters:
ignoreErrors -
Returns:
whether to rerun the previous search; false in cases 1-3 because we are just updating the form
See Also:
LookupableHelperService.performCustomAction(boolean)

getInquiryUrl

public HtmlData getInquiryUrl(BusinessObject bo,
                              String propertyName)
Custom implementation of getInquiryUrl that sets up doc handler link.

Specified by:
getInquiryUrl in interface LookupableHelperService
Overrides:
getInquiryUrl in class AbstractLookupableHelperServiceImpl
Parameters:
bo - the business object instance to build the urls for
propertyName - the property which links to an inquirable
Returns:
String url to inquiry

generateDocumentHandlerUrl

protected HtmlData.AnchorHtmlData generateDocumentHandlerUrl(String documentId,
                                                             DocumentType documentType,
                                                             boolean superUserSearch)
Generates the appropriate document handler url for the given document. If superUserSearch is true then a super user doc handler link will be generated if the document type policy allows it.


generateRouteLogUrl

protected HtmlData.AnchorHtmlData generateRouteLogUrl(String documentId)

isDocumentHandlerPopup

protected boolean isDocumentHandlerPopup()
Returns true if the document handler should open in a new window.


isRouteLogPopup

public boolean isRouteLogPopup()
Returns true if the route log should open in a new window.


isFlagSet

protected boolean isFlagSet(String flagName)
Parses a boolean request parameter


isSuperUserSearch

protected boolean isSuperUserSearch()
Returns true if the current search being executed is a super user search.


isAdvancedSearch

protected boolean isAdvancedSearch()
Returns true if the current search being executed is an "advanced" search.


isClearSavedSearch

protected boolean isClearSavedSearch()
Returns true if the current "search" being executed is an "clear" search.


getSavedSearchName

protected String getSavedSearchName()

setRows

protected void setRows()
Override setRows in order to post-process and add documenttype-dependent fields

Overrides:
setRows in class AbstractLookupableHelperServiceImpl

getFormFields

protected Iterable<Field> getFormFields()
Returns an iterable of current form fields


setRows

protected void setRows(String documentTypeName)
Sets the rows for the search criteria. This method will delegate to the DocumentSearchCriteriaProcessor in order to pull in fields for custom search attributes.

Parameters:
documentTypeName - the name of the document type currently entered on the form, if this is a valid document type then it may have search attribute fields that need to be displayed; documentType name may also be loaded via a saved search

getSupplementalMenuBar

public String getSupplementalMenuBar()
Description copied from interface: LookupableHelperService
This method gets the supplemental lookup menu if any

Specified by:
getSupplementalMenuBar in interface LookupableHelperService
Overrides:
getSupplementalMenuBar in class AbstractLookupableHelperServiceImpl
Returns:
supplemental menu bar
See Also:
LookupableHelperService.getSupplementalMenuBar()

shouldDisplayHeaderNonMaintActions

public boolean shouldDisplayHeaderNonMaintActions()
Specified by:
shouldDisplayHeaderNonMaintActions in interface LookupableHelperService
Overrides:
shouldDisplayHeaderNonMaintActions in class AbstractLookupableHelperServiceImpl
See Also:
LookupableHelperService.shouldDisplayHeaderNonMaintActions()

shouldDisplayLookupCriteria

public boolean shouldDisplayLookupCriteria()
Specified by:
shouldDisplayLookupCriteria in interface LookupableHelperService
Overrides:
shouldDisplayLookupCriteria in class AbstractLookupableHelperServiceImpl
See Also:
LookupableHelperService.shouldDisplayLookupCriteria()

checkForAdditionalFields

public boolean checkForAdditionalFields(Map fieldValues)
Determines if there should be more search fields rendered based on already entered search criteria, and generates additional form rows.

Specified by:
checkForAdditionalFields in interface LookupableHelperService
Overrides:
checkForAdditionalFields in class AbstractLookupableHelperServiceImpl
Parameters:
fieldValues - - Map of property/value pairs
Returns:
boolean
See Also:
LookupableHelperService.checkForAdditionalFields(java.util.Map)

getExtraField

public Field getExtraField()
Description copied from interface: LookupableHelperService
get an extra field

Specified by:
getExtraField in interface LookupableHelperService
Overrides:
getExtraField in class AbstractLookupableHelperServiceImpl
Returns:
See Also:
Lookupable.getExtraField()

performClear

public void performClear(LookupForm lookupForm)
Description copied from class: AbstractLookupableHelperServiceImpl
This method does the logic for the clear action.

Specified by:
performClear in interface LookupableHelperService
Overrides:
performClear in class AbstractLookupableHelperServiceImpl
See Also:
LookupableHelperService#performClear()

repopulateSearchTypeFlags

protected void repopulateSearchTypeFlags()
Repopulate the fields indicating advanced/superuser search type.


postProcessResults

protected void postProcessResults(Collection<ResultRow> resultRows,
                                  DocumentSearchResults searchResults)
Takes a collection of result rows and does final processing on them.


executeColumnCustomization

protected void executeColumnCustomization(ResultRow resultRow,
                                          DocumentSearchResult searchResult,
                                          DocumentSearchResultSetConfiguration resultSetConfiguration,
                                          DocumentSearchCriteriaConfiguration criteriaConfiguration)
Executes customization of columns, could include removing certain columns or adding additional columns to the result row (in cases where columns are added by document search customization, such as searchable attributes).


populateCustomColumns

protected void populateCustomColumns(List<Column> customColumns,
                                     DocumentSearchResult searchResult)

setDocumentSearchService

public void setDocumentSearchService(DocumentSearchService documentSearchService)

getDocumentSearchService

public DocumentSearchService getDocumentSearchService()

getDocumentSearchCriteriaProcessor

public DocumentSearchCriteriaProcessor getDocumentSearchCriteriaProcessor()

setDocumentSearchCriteriaProcessor

public void setDocumentSearchCriteriaProcessor(DocumentSearchCriteriaProcessor documentSearchCriteriaProcessor)

getDocumentSearchCriteriaTranslator

public DocumentSearchCriteriaTranslator getDocumentSearchCriteriaTranslator()

setDocumentSearchCriteriaTranslator

public void setDocumentSearchCriteriaTranslator(DocumentSearchCriteriaTranslator documentSearchCriteriaTranslator)


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