org.kuali.rice.kew.rule
Class GenericWorkflowAttribute

java.lang.Object
  extended by org.kuali.rice.kew.rule.AbstractWorkflowAttribute
      extended by org.kuali.rice.kew.rule.GenericWorkflowAttribute
All Implemented Interfaces:
Serializable, WorkflowRuleAttribute
Direct Known Subclasses:
DestinationRuleAttribute, GenericRoleAttribute

public abstract class GenericWorkflowAttribute
extends AbstractWorkflowAttribute

Generic base class that implements common functionality to simplify implementing a WorkflowAttribute. This includes simplified template methods, as well as a generic attribute content model.

Control flow (for isMatch):

  1. isMatch(DocumentContent, List)
    1. isMatch(List, List)
      1. isMatch(Map, List)
The default matching algorithm will match:
if any single attribute's properties are a match for all rule extension values
This implementation does not (yet!) implement a generic internal map of properties, so it is up to subclasses to expose specific named getters/setters to set data on an attribute of this ancestry.

Author:
Kuali Rice Team (rice.collab@kuali.org)
See Also:
Serialized Form

Field Summary
protected  String attributeName
           
protected  GenericAttributeContent content
           
protected  org.apache.log4j.Logger log
           
 
Fields inherited from class org.kuali.rice.kew.rule.AbstractWorkflowAttribute
required
 
Constructor Summary
GenericWorkflowAttribute()
           
GenericWorkflowAttribute(String uniqueName)
           
 
Method Summary
 String getDocContent()
          Simply defers to GenericAttributeContent to generate suitable XML content in a standard fashion
abstract  Map<String,String> getProperties()
          Template method for subclasses to override to expose attribute state
 List<RuleExtensionValue> getRuleExtensionValues()
          I think the job of this method is to marshal the current state of the attribute into a representative list of rule extension values.
 boolean isMatch(DocumentContent docContent, List<RuleExtension> ruleExtensions)
          Returns true if this Attribute finds a match in the given DocContent.
protected  boolean isMatch(List<Map<String,String>> propertiesList, List<RuleExtension> ruleExtensions)
          Returns true if any single incoming attribute's properties are a match for all rule extension values
protected  boolean isMatch(Map<String,String> properties, List<RuleExtension> ruleExtensions)
          Returns true if all key/value pairs defined by the specified rule extensions are present in the incoming attribute's properties
 List validateRoutingData(Map paramMap)
          These guys should probably be implemented to set the parameters on an internal member property map this attribute should use to contain all properties set on it, like StandardGenericXmlAttribute.
 List validateRuleData(Map paramMap)
          Validates ruleExtension values in the incoming map.
 
Methods inherited from class org.kuali.rice.kew.rule.AbstractWorkflowAttribute
getIdFieldName, getLockFieldName, getRoutingDataRows, getRuleRows, isRequired, setRequired
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final org.apache.log4j.Logger log

attributeName

protected final String attributeName

content

protected final GenericAttributeContent content
Constructor Detail

GenericWorkflowAttribute

public GenericWorkflowAttribute()

GenericWorkflowAttribute

public GenericWorkflowAttribute(String uniqueName)
Method Detail

getProperties

public abstract Map<String,String> getProperties()
Template method for subclasses to override to expose attribute state

Returns:
map exposing attribute state

getDocContent

public String getDocContent()
Simply defers to GenericAttributeContent to generate suitable XML content in a standard fashion

Specified by:
getDocContent in interface WorkflowRuleAttribute
Overrides:
getDocContent in class AbstractWorkflowAttribute

isMatch

public boolean isMatch(DocumentContent docContent,
                       List<RuleExtension> ruleExtensions)
Description copied from interface: WorkflowRuleAttribute
Returns true if this Attribute finds a match in the given DocContent. If true, the associated document will be routed to the users specifed by the UNF The isMatch method is responsible for determining whether content in a document matches content saved in workflow, thus determining whether to fire a rule or not. The isMatch method takes a DocumentContent object and a list of rule extension objects and returns a Boolean. The DocumentContent object contains the data in XML format that will be compared with the rules saved in workflow. Rule extension objects come from a potential rule that may match the document content on this eDoc. The potential rule is selected based on the Document Type and Rule Templates associated with this eDoc. Each rule extension object contains a list of rule extension value objects which have the data we will use in key value format to compare to the document content. The key will be determined by a unique string assigned by this attribute. The Value is determined when a rule is created and data is entered for the particular key. If a match is found, this method returns true and the eDoc will be routed based on this rule. If no match is found, the method returns false and the eDoc will not be routed based on this rule.


isMatch

protected boolean isMatch(List<Map<String,String>> propertiesList,
                          List<RuleExtension> ruleExtensions)
Returns true if any single incoming attribute's properties are a match for all rule extension values

Parameters:
propertiesList - the list of incoming attributes' properties
ruleExtensions - the rule extensions
Returns:
true if any single attribute's properties are a match for all rule extension values

isMatch

protected boolean isMatch(Map<String,String> properties,
                          List<RuleExtension> ruleExtensions)
Returns true if all key/value pairs defined by the specified rule extensions are present in the incoming attribute's properties

Parameters:
properties - incoming attribute's properties
ruleExtensions - list of rule extensions
Returns:
true if all key/value pairs defined by the specified rule extensions are present in the incoming attribute's

validateRoutingData

public List validateRoutingData(Map paramMap)
These guys should probably be implemented to set the parameters on an internal member property map this attribute should use to contain all properties set on it, like StandardGenericXmlAttribute.

Specified by:
validateRoutingData in interface WorkflowRuleAttribute
Overrides:
validateRoutingData in class AbstractWorkflowAttribute
Parameters:
paramMap - Map containing the names and values of the routing data for this Attribute
See Also:
TODO: implement me!

validateRuleData

public List validateRuleData(Map paramMap)
Description copied from interface: WorkflowRuleAttribute
Validates ruleExtension values in the incoming map. Called by the UI during rule creation. This method is responsible for validating and setting the data entered on the form from the UI of the rule creation to the Rule's attribute. The values will be in a Map with the key being the key of the RuleExtensionValue and the value being the value of the data entered from the UI. This method is used for rule creation which may have different fields than the routing report data.

Specified by:
validateRuleData in interface WorkflowRuleAttribute
Overrides:
validateRuleData in class AbstractWorkflowAttribute
Parameters:
paramMap - Map containing the names and values of the rule extensions for this Attribute

getRuleExtensionValues

public List<RuleExtensionValue> getRuleExtensionValues()
I think the job of this method is to marshal the current state of the attribute into a representative list of rule extension values. On that assumption, this method should simply create a list of RuleExtensionValues based on the the property map this attribute uses to hold property values. TODO: this is not fully implemented! e.g. generic property map like StandardGenericXmlAttribute

Specified by:
getRuleExtensionValues in interface WorkflowRuleAttribute
Overrides:
getRuleExtensionValues in class AbstractWorkflowAttribute


Copyright © 2005-2013 The Kuali Foundation. All Rights Reserved.