public abstract class XPathSearchableAttribute extends Object implements SearchableAttribute
StandardGenericXMLSearchableAttribute
.
In most cases it's simplest to just define an SGXSA. This class exists expressly to aid testing
non-SGXSA attributes, and illustrates performing proper validation.Modifier and Type | Field and Description |
---|---|
protected String |
dataType |
protected String |
key |
protected org.apache.log4j.Logger |
log |
protected String |
title |
protected String |
xpathExpression |
Modifier | Constructor and Description |
---|---|
protected |
XPathSearchableAttribute(String key,
String dataType,
String xpathExpression) |
protected |
XPathSearchableAttribute(String key,
String dataType,
String xpathExpression,
String title) |
Modifier and Type | Method and Description |
---|---|
protected static DocumentAttribute |
createAttribute(String name,
String value,
String dataTypeValue)
Creates an DocumentAttribute of the specified type
|
protected RemotableAttributeField.Builder |
decorateRemotableAttributeField(RemotableAttributeField.Builder raf)
Template method for subclasses to customize the remotableattributefield
|
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.
|
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. |
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.
|
protected final org.apache.log4j.Logger log
protected final String xpathExpression
protected XPathSearchableAttribute(String key, String dataType, String xpathExpression)
protected XPathSearchableAttribute(String key, String dataType, String xpathExpression, String title)
public String generateSearchContent(ExtensionDefinition extensionDefinition, String documentTypeName, WorkflowAttributeDefinition attributeDefinition)
SearchableAttribute
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.
generateSearchContent
in interface SearchableAttribute
extensionDefinition
- the extension definition which was used to locate and load this searchable attribute
implementationdocumentTypeName
- the name of the document type for which this method is being invokedattributeDefinition
- 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
updatedpublic List<DocumentAttribute> extractDocumentAttributes(ExtensionDefinition extensionDefinition, DocumentWithContent documentWithContent)
SearchableAttribute
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.
extractDocumentAttributes
in interface SearchableAttribute
extensionDefinition
- the extension definition which was used to locate and load this searchable attribute
implementationdocumentWithContent
- the workflow document and it's XML contentDocumentAttributeFactory
protected static DocumentAttribute createAttribute(String name, String value, String dataTypeValue) throws ParseException
ParseException
public List<RemotableAttributeField> getSearchFields(ExtensionDefinition extensionDefinition, String documentTypeName)
SearchableAttribute
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.getSearchFields
in interface SearchableAttribute
extensionDefinition
- the extension definition which was used to locate and load this searchable attribute
implementationdocumentTypeName
- the name of the document type for which this method is being invokedprotected RemotableAttributeField.Builder decorateRemotableAttributeField(RemotableAttributeField.Builder raf)
public List<RemotableAttributeError> validateDocumentAttributeCriteria(ExtensionDefinition extensionDefinition, DocumentSearchCriteria documentSearchCriteria)
SearchableAttribute
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.
validateDocumentAttributeCriteria
in interface SearchableAttribute
extensionDefinition
- the extension definition which was used to locate and load this searchable attribute
implementationdocumentSearchCriteria
- the criteria that was submitted to the document search and against which validation
is requestedCopyright © 2005-2015 The Kuali Foundation. All Rights Reserved.