org.kuali.rice.kew.role
Class XPathQualifierResolver

java.lang.Object
  extended by 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:

 
   /xmlData/chartOrg
   
     ./chart
   
   
     ./org
   
 
 

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:

 
   
     BL
     BUS
   
   
     IN
     MED
   
 
 

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.

 
   
     BL
     BUS
     IN
     MED
   
 
 

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:

 
   /xmlData/accountNumbers
   
     ./accountNumber
   
 
 

In this example, the following XML would return a List containing an AttributeSet for each account number when resolved.

 
   
     12345
     54321
     102030
     302010
   
 
 
 

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

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

Nested Class Summary
(package private)  class XPathQualifierResolver.ResolverConfig
           
 
Field Summary
private static org.apache.log4j.Logger LOG
           
private  RuleAttribute ruleAttribute
           
 
Constructor Summary
XPathQualifierResolver()
           
 
Method Summary
protected  void handleCompoundAttributeSet(Node baseNode, List<AttributeSet> attributeSets, XPathQualifierResolver.ResolverConfig config, XPath xPath)
           
protected  void handleSimpleAttributeSet(Node baseNode, List<AttributeSet> attributeSets, XPathQualifierResolver.ResolverConfig config, XPath xPath)
           
protected  XPathQualifierResolver.ResolverConfig parseResolverConfig()
           
 List<AttributeSet> resolve(RouteContext context)
           
 void setRuleAttribute(RuleAttribute ruleAttribute)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

private static final org.apache.log4j.Logger LOG

ruleAttribute

private RuleAttribute ruleAttribute
Constructor Detail

XPathQualifierResolver

public XPathQualifierResolver()
Method Detail

resolve

public List<AttributeSet> resolve(RouteContext context)
Specified by:
resolve in interface QualifierResolver

handleCompoundAttributeSet

protected void handleCompoundAttributeSet(Node baseNode,
                                          List<AttributeSet> attributeSets,
                                          XPathQualifierResolver.ResolverConfig config,
                                          XPath xPath)
                                   throws XPathExpressionException
Throws:
XPathExpressionException

handleSimpleAttributeSet

protected void handleSimpleAttributeSet(Node baseNode,
                                        List<AttributeSet> attributeSets,
                                        XPathQualifierResolver.ResolverConfig config,
                                        XPath xPath)
                                 throws XPathExpressionException
Throws:
XPathExpressionException

setRuleAttribute

public void setRuleAttribute(RuleAttribute ruleAttribute)
Specified by:
setRuleAttribute in interface XmlConfiguredAttribute

parseResolverConfig

protected XPathQualifierResolver.ResolverConfig parseResolverConfig()


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