Class XPathQualifierResolver
- All Implemented Interfaces:
QualifierResolver,XmlConfiguredAttribute
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)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidhandleCompoundMap(Node baseNode, List<Map<String, String>> maps, org.kuali.rice.kew.role.XPathQualifierResolver.ResolverConfig config, XPath xPath) protected voidhandleSimpleMap(Node baseNode, List<Map<String, String>> maps, org.kuali.rice.kew.role.XPathQualifierResolver.ResolverConfig config, XPath xPath) protected org.kuali.rice.kew.role.XPathQualifierResolver.ResolverConfigresolve(RouteContext context) voidsetExtensionDefinition(org.kuali.rice.kew.api.extension.ExtensionDefinition ruleAttribute)
-
Constructor Details
-
XPathQualifierResolver
public XPathQualifierResolver()
-
-
Method Details
-
resolve
- Specified by:
resolvein interfaceQualifierResolver
-
handleCompoundMap
protected void handleCompoundMap(Node baseNode, List<Map<String, String>> maps, org.kuali.rice.kew.role.XPathQualifierResolver.ResolverConfig config, XPath xPath) throws XPathExpressionException- Throws:
XPathExpressionException
-
handleSimpleMap
protected void handleSimpleMap(Node baseNode, List<Map<String, String>> maps, org.kuali.rice.kew.role.XPathQualifierResolver.ResolverConfig config, XPath xPath) throws XPathExpressionException- Throws:
XPathExpressionException
-
parseResolverConfig
protected org.kuali.rice.kew.role.XPathQualifierResolver.ResolverConfig parseResolverConfig() -
setExtensionDefinition
public void setExtensionDefinition(org.kuali.rice.kew.api.extension.ExtensionDefinition ruleAttribute) - Specified by:
setExtensionDefinitionin interfaceXmlConfiguredAttribute
-