Class XPathQualifierResolver

java.lang.Object
org.kuali.rice.kew.role.XPathQualifierResolver
All Implemented Interfaces:
QualifierResolver, XmlConfiguredAttribute

public class XPathQualifierResolver extends Object implements QualifierResolver, XmlConfiguredAttribute
Resolves qualifiers based on XPath configuration in the resolver's attribute.

An example of the xml processed by this attribute follows:

 <resolverConfig>
   <baseXPathExpression>/xmlData/chartOrg</baseXPathExpression>
   <attributes name="chart">
     <xPathExpression>./chart</xPathExpression>
   </attributes>
   <attributes name="org">
     <xPathExpression>./org</xPathExpression>
   </attributes>
 </resolverConfig>
 

There are 2 different types of qualifier resolvers, those that resolve compound attribute sets and those that resolve simple attribute sets. A simple attribute set is one which includes only a single "qualifier" specification. The example above is compound because it includes both chart and org.

When dealing with compound attribute sets, the baseXPathExpression is used to define grouping for these compound sets. It is therefore required that inside each resulting element retrieved from the baseXPathExpression, there is only a single instance of each qualifier. If this is not the case, an error will be thrown. For the example above, the following XML would be evaluated successfully:

 <xmlData>
   <chartOrg>
     <chart>BL</chart>
     <org>BUS</org>
   </chartOrg>
   <chartOrg>
     <chart>IN</chart>
     <org>MED</org>
   </chartOrg>
 </xmlData>
 

This would return 2 attributes sets, each with a chart and org in it. The following XML would cause the XPathQualifierResolver to throw an exception during processing.

 <xmlData>
   <chartOrg>
     <chart>BL</chart>
     <org>BUS</org>
     <chart>IN</chart>
     <org>MED</org>
   </chartOrg>
 </xmlData>
 

In this case the resolver has no knowledge of how to group chart and org together. What follows is an example of a resolver using a simple attribute set:

 <resolverConfig>
   <baseXPathExpression>/xmlData/accountNumbers</baseXPathExpression>
   <attributes name="accountNumber">
     <xPathExpression>./accountNumber</xPathExpression\>
   </attributes>
 </resolverConfig>
 

In this example, the following XML would return a List containing an Mapinvalid input: '<'String, String> for each account number when resolved.

 <xmlData>
   <accountNumbers>
     <accountNumber>12345</accountNumber>
     <accountNumber>54321</accountNumber>
     <accountNumber>102030</accountNumber>
     <accountNumber>302010</accountNumber>
   </accountNumbers>
 </xmlData>
 

The baseXPathExpression is optional and defaults to the root of the document if not specified.

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