org.kuali.rice.krad.workflow.attribute
Class DataDictionaryDocumentSearchCustomizer

java.lang.Object
  extended by org.kuali.rice.krad.workflow.attribute.DataDictionaryDocumentSearchCustomizer
All Implemented Interfaces:
SearchableAttribute, DocumentSearchCustomizer

public class DataDictionaryDocumentSearchCustomizer
extends Object
implements SearchableAttribute, DocumentSearchCustomizer


Constructor Summary
DataDictionaryDocumentSearchCustomizer()
           
DataDictionaryDocumentSearchCustomizer(SearchableAttribute searchableAttribute, DocumentSearchCustomizer documentSearchCustomizer)
           
 
Method Summary
 DocumentSearchCriteria customizeClearCriteria(DocumentSearchCriteria documentSearchCriteria)
          Performs a customized "clear" of the given document search criteria.
 DocumentSearchCriteria customizeCriteria(DocumentSearchCriteria documentSearchCriteria)
          Performs customization on the given document search criteria.
 DocumentSearchResultValues customizeResults(DocumentSearchCriteria documentSearchCriteria, List<DocumentSearchResult> defaultResults)
          Performs customization of the given list of document search results.
 DocumentSearchResultSetConfiguration customizeResultSetConfiguration(DocumentSearchCriteria documentSearchCriteria)
          Performs customization of what result fields should be displayed in the result set.
 List<DocumentAttribute> extractDocumentAttributes(ExtensionDefinition extensionDefinition, DocumentWithContent documentWithContent)
          Extracts and returns document attributes for the given document in order to allow indexing of those values for association with the document and use in document searches.
 String generateSearchContent(ExtensionDefinition extensionDefinition, String documentTypeName, WorkflowAttributeDefinition attributeDefinition)
          Allows for generation of custom XML for this searchable attribute.
protected  DocumentSearchCustomizer getDocumentSearchCustomizer()
           
protected  SearchableAttribute getSearchableAttribute()
           
 List<RemotableAttributeField> getSearchFields(ExtensionDefinition extensionDefinition, String documentTypeName)
          Returns a list of RemotableAttributeField objects which define which searchable attribute criteria fields should be included in the criteria section of the document search user interface for this searchable attribute.
 boolean isCustomizeClearCriteriaEnabled(String documentTypeName)
          Indicates if the DocumentSearchCustomizer.customizeClearCriteria(org.kuali.rice.kew.api.document.search.DocumentSearchCriteria) on this customizer should be invoked for the document type with the given name.
 boolean isCustomizeCriteriaEnabled(String documentTypeName)
          Indicates if the DocumentSearchCustomizer.customizeCriteria(org.kuali.rice.kew.api.document.search.DocumentSearchCriteria) on this customizer should be invoked for the document type with the given name.
 boolean isCustomizeResultsEnabled(String documentTypeName)
          Indicates if the DocumentSearchCustomizer.customizeResults(org.kuali.rice.kew.api.document.search.DocumentSearchCriteria, java.util.List) on this customizer should be invoked for the document type with the given name.
 boolean isCustomizeResultSetFieldsEnabled(String documentTypeName)
          Indicates if the DocumentSearchCustomizer.customizeResultSetConfiguration(org.kuali.rice.kew.api.document.search.DocumentSearchCriteria) on this customizer should be invoked for the document type with the given name.
 void setDocumentSearchCustomizer(DocumentSearchCustomizer documentSearchCustomizer)
           
 void setSearchableAttribute(SearchableAttribute searchableAttribute)
           
 List<RemotableAttributeError> validateDocumentAttributeCriteria(ExtensionDefinition extensionDefinition, DocumentSearchCriteria documentSearchCriteria)
          Performs custom validation of document attribute values that come from this searchable attribute whenever a document search is performed against a document type which uses this searchable attribute.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataDictionaryDocumentSearchCustomizer

public DataDictionaryDocumentSearchCustomizer()

DataDictionaryDocumentSearchCustomizer

public DataDictionaryDocumentSearchCustomizer(SearchableAttribute searchableAttribute,
                                              DocumentSearchCustomizer documentSearchCustomizer)
Method Detail

generateSearchContent

public final String generateSearchContent(ExtensionDefinition extensionDefinition,
                                          String documentTypeName,
                                          WorkflowAttributeDefinition attributeDefinition)
Description copied from interface: SearchableAttribute
Allows for generation of custom XML for this searchable attribute. The trigger for invocation of custom XML generation happens via the workflow API whenever a document action is taken and a request is submitted to update document XML based on searchable attribute definitions (see DocumentContentUpdate). This XML is ultimately included as part of the document's content.

It is intended that this XML can be used by the extractDocumentAttributes method in order to pull values out for indexing, though this method is free to use any source available to it for extracting data for indexing alongside a document.

A null or blank value may be returned from this method to indicate that no XML was generated.

Specified by:
generateSearchContent in interface SearchableAttribute
Parameters:
extensionDefinition - the extension definition which was used to locate and load this searchable attribute implementation
documentTypeName - the name of the document type for which this method is being invoked
attributeDefinition - contains parameters and properties that can be used to inform generation of the XML, these are supplied by the user of the workflow API when the document's searchable XML content is requested to be updated
Returns:
a String containing valid XML that should be included in the searchable attribute XML section of the document's XML content

extractDocumentAttributes

public final List<DocumentAttribute> extractDocumentAttributes(ExtensionDefinition extensionDefinition,
                                                               DocumentWithContent documentWithContent)
Description copied from interface: SearchableAttribute
Extracts and returns document attributes for the given document in order to allow indexing of those values for association with the document and use in document searches. The document and it's XML content is passed to this method as that is a common source of data for indexing purposes, though implementations are free to pull data for indexing from any readily accessible source.

There are a finite set of DocumentAttribute implementations which can be returned and interpreted correctly. Client application's should not create custom extensions of the DocumentAttribute abstract class but should preferably use the DocumentAttributeFactory to construct strongly-typed document attribute instances for indexing.

Specified by:
extractDocumentAttributes in interface SearchableAttribute
Parameters:
extensionDefinition - the extension definition which was used to locate and load this searchable attribute implementation
documentWithContent - the workflow document and it's XML content
Returns:
a list of document attribute values that should be indexed for the given document, or a null or empty list if no attributes should be indexed
See Also:
DocumentAttributeFactory

getSearchFields

public final List<RemotableAttributeField> getSearchFields(ExtensionDefinition extensionDefinition,
                                                           String documentTypeName)
Description copied from interface: SearchableAttribute
Returns a list of RemotableAttributeField objects which define which searchable attribute criteria fields should be included in the criteria section of the document search user interface for this searchable attribute.

Specified by:
getSearchFields in interface SearchableAttribute
Parameters:
extensionDefinition - the extension definition which was used to locate and load this searchable attribute implementation
documentTypeName - the name of the document type for which this method is being invoked
Returns:
a list of remotable attribute fields which define the search fields that should be included in the document search criteria, or a null or empty list if no criteria should be included for this searchable attribute

validateDocumentAttributeCriteria

public final List<RemotableAttributeError> validateDocumentAttributeCriteria(ExtensionDefinition extensionDefinition,
                                                                             DocumentSearchCriteria documentSearchCriteria)
Description copied from interface: SearchableAttribute
Performs custom validation of document attribute values that come from this searchable attribute whenever a document search is performed against a document type which uses this searchable attribute. This hook allows for any desired validation of this searchable attributes custom document attribute values to be performed prior to the execution of the document search.

The entire DocumentSearchCriteria is passed to this method, though it's intended that implementing code will pull out the document attribute values on the criteria which are managed by this searchable attribute and perform any desired validation. However, there are certainly no restrictions on this method that would prevent it from performing validations outside of this scope and in relation to other portions of the criteria, though this is certainly not the intent of this validation hook.

Note that this method is invoked when performing a document search from the user interface as well as via the WorkflowDocumentService api.

Specified by:
validateDocumentAttributeCriteria in interface SearchableAttribute
Parameters:
extensionDefinition - the extension definition which was used to locate and load this searchable attribute implementation
documentSearchCriteria - the criteria that was submitted to the document search and against which validation is requested
Returns:
a list of attribute errors containing and validation failure errors messages for the relevant document attributes, if this returns a null or empty list it means that validation was successful

customizeCriteria

public final DocumentSearchCriteria customizeCriteria(DocumentSearchCriteria documentSearchCriteria)
Description copied from interface: DocumentSearchCustomizer
Performs customization on the given document search criteria. This method should return the customized version of the criteria, or null if no customizations were performed. This customization is invoked prior the actual search being executed, and the resulting customized criteria is what gets passed to the search implementation. It is also invoked in situtations where the document search is performed via the api or via the user interface.

It is guaranteed that the document type name on the given criteria will never be null and will always represent a valid document type.

Specified by:
customizeCriteria in interface DocumentSearchCustomizer
Parameters:
documentSearchCriteria - the original criteria against which to perform customization, will never be null
Returns:
the customized criteria, or null if no customization was performed

customizeClearCriteria

public final DocumentSearchCriteria customizeClearCriteria(DocumentSearchCriteria documentSearchCriteria)
Description copied from interface: DocumentSearchCustomizer
Performs a customized "clear" of the given document search criteria. Clearing of the criteria is typically invoked whenever the user of the document search user interface clicks the "clear" button. By default all of the search criteria is cleared, but this method allows for certain criteria data to be preserved on a clear if desired.

A common use of this feature is to preserve the document type that has been selected when clearing criteria for a customized document search.

It is guaranteed that the document type name on the given criteria will never be null and will always represent a valid document type.

Specified by:
customizeClearCriteria in interface DocumentSearchCustomizer
Parameters:
documentSearchCriteria - the criteria to clear
Returns:
the cleared criteria, or null if no custom criteria clearing was performed

customizeResults

public final DocumentSearchResultValues customizeResults(DocumentSearchCriteria documentSearchCriteria,
                                                         List<DocumentSearchResult> defaultResults)
Description copied from interface: DocumentSearchCustomizer
Performs customization of the given list of document search results. This method is invoked after the search is executed but before results are returned to the caller. It is executed when a document search is executed via the api or from the document search user interface.

This method returns a DocumentSearchResultValues object which contains a list of DocumentSearchResultValue objects. Each of these result values maps to a specific document id and contains a list of DocumentAttribute values which can be used to modify existing document attributes or create new ones that are included as part of the search results. It is important to note that in order for these custom attribute values to be displayed in the result set in the document search user interface, there must be a corresponding entry in the DocumentSearchResultSetConfiguration returned by the DocumentSearchCustomizer.customizeResultSetConfiguration(org.kuali.rice.kew.api.document.search.DocumentSearchCriteria) method on this customizer implementation.

It is permissible that implementations of this method may not return result values for all of the document provided in the given list of document search results. It is important to note however that ommision from the returned result values does not filter or remove the result from the search results. Generally speaking, this method cannot be used to remove results from the result set.

It is guaranteed that the document type name on the given criteria will never be null and will always represent a valid document type.

Specified by:
customizeResults in interface DocumentSearchCustomizer
Parameters:
documentSearchCriteria - the criteria against which the document search was executed
defaultResults - the results that were returned by the execution of the document search
Returns:
customized search result values for any of the document results requiring custom values, or null if no customization was performed

customizeResultSetConfiguration

public DocumentSearchResultSetConfiguration customizeResultSetConfiguration(DocumentSearchCriteria documentSearchCriteria)
Description copied from interface: DocumentSearchCustomizer
Performs customization of what result fields should be displayed in the result set. Allows for hiding of standard fields, addition of custom fields, and the ability to override the default behavior of searchable attributes that are defined for the document type. Generally speaking, this controls which "columns" of data are displayed in the document search results.

This method is only invoked by the document search user interface whenever it is rendering document search results. It is not invoked when invoking document search using only the api.

It is guaranteed that the document type name on the given criteria will never be null and will always represent a valid document type.

Specified by:
customizeResultSetConfiguration in interface DocumentSearchCustomizer
Parameters:
documentSearchCriteria - the criteria against which the document search was executed
Returns:
the customized result set configuration, or null if no customization was performed

isCustomizeCriteriaEnabled

public final boolean isCustomizeCriteriaEnabled(String documentTypeName)
Description copied from interface: DocumentSearchCustomizer
Indicates if the DocumentSearchCustomizer.customizeCriteria(org.kuali.rice.kew.api.document.search.DocumentSearchCriteria) on this customizer should be invoked for the document type with the given name. The caller of this method is permitted to cache the return value for a length of time of their choosing.

Specified by:
isCustomizeCriteriaEnabled in interface DocumentSearchCustomizer
Parameters:
documentTypeName - the name of the document type against which this customizer is being applied
Returns:
true if the customization method should be executed, false otherwise

isCustomizeClearCriteriaEnabled

public final boolean isCustomizeClearCriteriaEnabled(String documentTypeName)
Description copied from interface: DocumentSearchCustomizer
Indicates if the DocumentSearchCustomizer.customizeClearCriteria(org.kuali.rice.kew.api.document.search.DocumentSearchCriteria) on this customizer should be invoked for the document type with the given name. The caller of this method is permitted to cache the return value for a length of time of their choosing.

Specified by:
isCustomizeClearCriteriaEnabled in interface DocumentSearchCustomizer
Parameters:
documentTypeName - the name of the document type against which this customizer is being applied
Returns:
true if the customization method should be executed, false otherwise

isCustomizeResultsEnabled

public final boolean isCustomizeResultsEnabled(String documentTypeName)
Description copied from interface: DocumentSearchCustomizer
Indicates if the DocumentSearchCustomizer.customizeResults(org.kuali.rice.kew.api.document.search.DocumentSearchCriteria, java.util.List) on this customizer should be invoked for the document type with the given name. The caller of this method is permitted to cache the return value for a length of time of their choosing.

Specified by:
isCustomizeResultsEnabled in interface DocumentSearchCustomizer
Parameters:
documentTypeName - the name of the document type against which this customizer is being applied
Returns:
true if the customization method should be executed, false otherwise

isCustomizeResultSetFieldsEnabled

public final boolean isCustomizeResultSetFieldsEnabled(String documentTypeName)
Description copied from interface: DocumentSearchCustomizer
Indicates if the DocumentSearchCustomizer.customizeResultSetConfiguration(org.kuali.rice.kew.api.document.search.DocumentSearchCriteria) on this customizer should be invoked for the document type with the given name. The caller of this method is permitted to cache the return value for a length of time of their choosing.

Specified by:
isCustomizeResultSetFieldsEnabled in interface DocumentSearchCustomizer
Parameters:
documentTypeName - the name of the document type against which this customizer is being applied
Returns:
true if the customization method should be executed, false otherwise

getSearchableAttribute

protected SearchableAttribute getSearchableAttribute()

setSearchableAttribute

public void setSearchableAttribute(SearchableAttribute searchableAttribute)

getDocumentSearchCustomizer

protected DocumentSearchCustomizer getDocumentSearchCustomizer()

setDocumentSearchCustomizer

public void setDocumentSearchCustomizer(DocumentSearchCustomizer documentSearchCustomizer)


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