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

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

public class DataDictionaryDocumentSearchCustomizer
extends Object
implements SearchableAttribute, DocumentLookupCustomizer


Constructor Summary
DataDictionaryDocumentSearchCustomizer()
           
DataDictionaryDocumentSearchCustomizer(SearchableAttribute searchableAttribute, DocumentLookupCustomizer documentLookupCustomizer)
           
 
Method Summary
 DocumentLookupCriteria customizeClearCriteria(DocumentLookupCriteria documentLookupCriteria)
          Performs a customized "clear" of the given document lookup criteria.
 DocumentLookupCriteria customizeCriteria(DocumentLookupCriteria documentLookupCriteria)
          Performs customization on the given document lookup criteria.
 DocumentLookupResultValues customizeResults(DocumentLookupCriteria documentLookupCriteria, List<DocumentLookupResult> defaultResults)
          Performs customization of the given list of document lookup results.
 DocumentLookupResultSetConfiguration customizeResultSetConfiguration(DocumentLookupCriteria documentLookupCriteria)
          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 lookups.
 String generateSearchContent(ExtensionDefinition extensionDefinition, String documentTypeName, WorkflowAttributeDefinition attributeDefinition)
          Allows for generation of custom XML for this searchable attribute.
protected  DocumentLookupCustomizer getDocumentLookupCustomizer()
           
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 lookup user interface for this searchable attribute.
 boolean isCustomizeClearCriteriaEnabled(String documentTypeName)
          Indicates if the DocumentLookupCustomizer.customizeClearCriteria(org.kuali.rice.kew.api.document.lookup.DocumentLookupCriteria) on this customizer should be invoked for the document type with the given name.
 boolean isCustomizeCriteriaEnabled(String documentTypeName)
          Indicates if the DocumentLookupCustomizer.customizeCriteria(org.kuali.rice.kew.api.document.lookup.DocumentLookupCriteria) on this customizer should be invoked for the document type with the given name.
 boolean isCustomizeResultsEnabled(String documentTypeName)
          Indicates if the DocumentLookupCustomizer.customizeResults(org.kuali.rice.kew.api.document.lookup.DocumentLookupCriteria, java.util.List) on this customizer should be invoked for the document type with the given name.
 boolean isCustomizeResultSetFieldsEnabled(String documentTypeName)
          Indicates if the DocumentLookupCustomizer.customizeResultSetConfiguration(org.kuali.rice.kew.api.document.lookup.DocumentLookupCriteria) on this customizer should be invoked for the document type with the given name.
 void setDocumentLookupCustomizer(DocumentLookupCustomizer documentLookupCustomizer)
           
 void setSearchableAttribute(SearchableAttribute searchableAttribute)
           
 List<RemotableAttributeError> validateDocumentAttributeCriteria(ExtensionDefinition extensionDefinition, DocumentLookupCriteria documentLookupCriteria)
          Performs custom validation of document attribute values that come from this searchable attribute whenever a document lookup 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,
                                              DocumentLookupCustomizer documentLookupCustomizer)
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 lookups. 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 lookup 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 lookup 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,
                                                                             DocumentLookupCriteria documentLookupCriteria)
Description copied from interface: SearchableAttribute
Performs custom validation of document attribute values that come from this searchable attribute whenever a document lookup 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 lookup.

The entire DocumentLookupCriteria 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 lookup 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
documentLookupCriteria - the criteria that was submitted to the document lookup 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 DocumentLookupCriteria customizeCriteria(DocumentLookupCriteria documentLookupCriteria)
Description copied from interface: DocumentLookupCustomizer
Performs customization on the given document lookup 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 lookup being executed, and the resulting customized criteria is what gets passed to the search implementation. It is also invoked in situtations where the document lookup 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 DocumentLookupCustomizer
Parameters:
documentLookupCriteria - 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 DocumentLookupCriteria customizeClearCriteria(DocumentLookupCriteria documentLookupCriteria)
Description copied from interface: DocumentLookupCustomizer
Performs a customized "clear" of the given document lookup criteria. Clearing of the criteria is typically invoked whenever the user of the document lookup user interface clicks the "clear" button. By default all of the lookup 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 lookup.

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 DocumentLookupCustomizer
Parameters:
documentLookupCriteria - the criteria to clear
Returns:
the cleared criteria, or null if no custom criteria clearing was performed

customizeResults

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

This method returns a DocumentLookupResultValues object which contains a list of DocumentLookupResultValue 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 lookup results. It is important to note that in order for these custom attribute values to be displayed in the result set in the document lookup user interface, there must be a corresponding entry in the DocumentLookupResultSetConfiguration returned by the DocumentLookupCustomizer.customizeResultSetConfiguration(org.kuali.rice.kew.api.document.lookup.DocumentLookupCriteria) 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 lookup results. It is important to note however that ommision from the returned result values does not filter or remove the result from the lookup 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 DocumentLookupCustomizer
Parameters:
documentLookupCriteria - the criteria against which the document lookup was executed
defaultResults - the results that were returned by the execution of the document lookup
Returns:
customized lookup result values for any of the document results requiring custom values, or null if no customization was performed

customizeResultSetConfiguration

public DocumentLookupResultSetConfiguration customizeResultSetConfiguration(DocumentLookupCriteria documentLookupCriteria)
Description copied from interface: DocumentLookupCustomizer
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 lookup user interface whenever it is rendering document lookup results. It is not invoked when invoking document lookup 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 DocumentLookupCustomizer
Parameters:
documentLookupCriteria - the criteria against which the document lookup 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: DocumentLookupCustomizer
Indicates if the DocumentLookupCustomizer.customizeCriteria(org.kuali.rice.kew.api.document.lookup.DocumentLookupCriteria) 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 DocumentLookupCustomizer
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: DocumentLookupCustomizer
Indicates if the DocumentLookupCustomizer.customizeClearCriteria(org.kuali.rice.kew.api.document.lookup.DocumentLookupCriteria) 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 DocumentLookupCustomizer
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: DocumentLookupCustomizer
Indicates if the DocumentLookupCustomizer.customizeResults(org.kuali.rice.kew.api.document.lookup.DocumentLookupCriteria, 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 DocumentLookupCustomizer
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: DocumentLookupCustomizer
Indicates if the DocumentLookupCustomizer.customizeResultSetConfiguration(org.kuali.rice.kew.api.document.lookup.DocumentLookupCriteria) 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 DocumentLookupCustomizer
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)

getDocumentLookupCustomizer

protected DocumentLookupCustomizer getDocumentLookupCustomizer()

setDocumentLookupCustomizer

public void setDocumentLookupCustomizer(DocumentLookupCustomizer documentLookupCustomizer)


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