org.kuali.rice.kew.docsearch
Class DocumentSearchCriteriaProcessorKEWAdapter

java.lang.Object
  extended by org.kuali.rice.kew.docsearch.DocumentSearchCriteriaProcessorKEWAdapter
All Implemented Interfaces:
DocumentSearchCriteriaProcessor

public class DocumentSearchCriteriaProcessorKEWAdapter
extends Object
implements DocumentSearchCriteriaProcessor

This class adapts the RemotableAttributeField instances from the various attributes associated with a document type and combines with the "default" rows for the search, returning the final List of Row objects to render for the document search.

Implementation note:

This implementation relies on applicationDocumentStatus, and dateApplicationDocumentStatusChanged conditional fields being defined in the DD for basic display purposes. These fields are conditionally shown depending on whether a document supporting application document statuses has been specified. Further, the applicationDocumentStatus field is dynamically switched to a multiselect when the document specifies an explicit enumeration of valid statuses (this control switching is something that is not possible via declarative DD, at the time of this writing).

In addition the routeNodeName field is dynamically populated with the list of route nodes for the specified document type.

Note: an alternative to programmatically providing dynamic select values is to define a value finder declaratively in DD. KeyValueFinder however does not have access to request state, including the required document type, which would mean resorting to GlobalVariables inspection. In reluctance to add yet another dependency on this external state, the fixups are done programmatically in this class. (see applyApplicationDocumentStatusCustomizations(org.kuali.rice.kns.web.ui.Field, org.kuali.rice.kew.doctype.bo.DocumentType), applyRouteNodeNameCustomizations(org.kuali.rice.kns.web.ui.Field, org.kuali.rice.kew.doctype.bo.DocumentType)).

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

Field Summary
static String CLEARSAVED_SEARCH_FIELD
          Name if the hidden input field containing the clear saved search flag
static String SUPERUSER_SEARCH_FIELD
          Name if the hidden input field containing non-superuser/superuser search toggle state
 
Constructor Summary
DocumentSearchCriteriaProcessorKEWAdapter()
           
 
Method Summary
protected  void addHiddenFields(List<Row> rows, boolean advancedSearch, boolean superUserSearch)
           
protected  void applyApplicationDocumentStatusCustomizations(Field field, DocumentType documentType)
          Modifies the DataDictionary-defined applicationDocumentStatus field control to reflect whether the DocumentType has specified a list of valid application document statuses (in which case a select control is rendered), or whether it is free form (in which case a text control is rendered)
protected  void applyRouteNodeNameCustomizations(Field field, DocumentType documentType)
           
protected  List<Row> getDocumentAttributeRows(DocumentType documentType)
          Returns fields for the search attributes defined on the document
 List<Row> getRows(DocumentType documentType, List<Row> defaultRows, boolean advancedSearch, boolean superUserSearch)
          Constructs the list of rows and fields to display in the lookup criteria section of the document search screen.
protected  List<Row> loadRowsForAdvancedSearch(List<Row> defaultRows, DocumentType documentType)
           
protected  List<Row> loadRowsForBasicSearch(List<Row> defaultRows, DocumentType documentType)
           
protected  void loadRowsWithFields(List<Row> rowsToLoad, List<Row> defaultRows, String[] fieldNames, DocumentType documentType)
          Generates the document search form fields given the DataDictionary-defined fields, the DocumentType, and whether basic, detailed, or superuser search is being rendered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUPERUSER_SEARCH_FIELD

public static final String SUPERUSER_SEARCH_FIELD
Name if the hidden input field containing non-superuser/superuser search toggle state

See Also:
Constant Field Values

CLEARSAVED_SEARCH_FIELD

public static final String CLEARSAVED_SEARCH_FIELD
Name if the hidden input field containing the clear saved search flag

See Also:
Constant Field Values
Constructor Detail

DocumentSearchCriteriaProcessorKEWAdapter

public DocumentSearchCriteriaProcessorKEWAdapter()
Method Detail

getRows

public List<Row> getRows(DocumentType documentType,
                         List<Row> defaultRows,
                         boolean advancedSearch,
                         boolean superUserSearch)
Description copied from interface: DocumentSearchCriteriaProcessor
Constructs the list of rows and fields to display in the lookup criteria section of the document search screen. The documentType parameter passed to this method will generally be supplied in cases where the document type name was supplied to the lookup via a query parameter or when refreshing the criteria after making a change to it (like the user doing a document type lookup to fill in the value and then returning it back to the document search).

This method should look at the given document type (if there is one) to determine if there are any custom rows to render for that document type. It should also look at the request for detailed and super user search and adjust the rows accordingly for either of those conditions.

Specified by:
getRows in interface DocumentSearchCriteriaProcessor
Parameters:
documentType - supplies the document type in use on this search if one is specified, will be null otherwise
defaultRows - the default set of rows that are supplied from the data dictionary for the document search
advancedSearch - indicates whether or not a detailed search has been requested
superUserSearch - indicates whether or not a super user search has been requested
Returns:
the rows to render is the criteria section of the document search.

loadRowsForAdvancedSearch

protected List<Row> loadRowsForAdvancedSearch(List<Row> defaultRows,
                                              DocumentType documentType)

loadRowsForBasicSearch

protected List<Row> loadRowsForBasicSearch(List<Row> defaultRows,
                                           DocumentType documentType)

loadRowsWithFields

protected void loadRowsWithFields(List<Row> rowsToLoad,
                                  List<Row> defaultRows,
                                  String[] fieldNames,
                                  DocumentType documentType)
Generates the document search form fields given the DataDictionary-defined fields, the DocumentType, and whether basic, detailed, or superuser search is being rendered. If the document type policy DOCUMENT_STATUS_POLICY is set to "app", or "both" Then display the doc search criteria fields. If the documentType.validApplicationStatuses are defined, then the criteria field is a drop down. If the validApplication statuses are NOT defined, then the criteria field is a text input.

Parameters:
rowsToLoad - the list of rows to update
defaultRows - the DataDictionary-derived default form rows
fieldNames - a list of field names corresponding to the fields to render according to the current document search state
documentType - the document type, if specified in the search form

getDocumentAttributeRows

protected List<Row> getDocumentAttributeRows(DocumentType documentType)
Returns fields for the search attributes defined on the document


applyApplicationDocumentStatusCustomizations

protected void applyApplicationDocumentStatusCustomizations(Field field,
                                                            DocumentType documentType)
Modifies the DataDictionary-defined applicationDocumentStatus field control to reflect whether the DocumentType has specified a list of valid application document statuses (in which case a select control is rendered), or whether it is free form (in which case a text control is rendered)

Parameters:
field - the applicationDocumentStatus field
documentType - the document type

applyRouteNodeNameCustomizations

protected void applyRouteNodeNameCustomizations(Field field,
                                                DocumentType documentType)

addHiddenFields

protected void addHiddenFields(List<Row> rows,
                               boolean advancedSearch,
                               boolean superUserSearch)


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