public interface WorkflowRuleAttribute extends Serializable
Interface which abstracts a piece of information ("attribute") associated with a Workflow document, which can be used to make routing decisions when combined with Rules.
WorkflowAttribute lifecycle:
Definition via XML
Definition via UI (this documentation needs work)
validateRuleData(Map)
and validateRoutingData(Map)
and are called to validate the configuration/extension values
of the rule definition, and the user-configured rule data (??). see WebRuleBaseValues
,
RuleRoutingAttribute
.Runtime evaluation
WorkflowAttributeDefinition
and attaches
it to the client-side documentWorkflowAttributeDefinitionVO
s
are looked up (... how ...) and constructed on the client side.WorkflowAttributeXmlValidator
(e.g. StandardGenericXMLRuleAttribute
),
then WorkflowAttributeXmlValidator.validateClientRoutingData()
is called to validate any data the client app may have set
on the client-instantiated attribute (the WorkflowAttributeDefinition
)getDocContent()
or SearchableAttribute.generateSearchContent(org.kuali.rice.kew.api.extension.ExtensionDefinition, String, org.kuali.rice.kew.api.document.attribute.WorkflowAttributeDefinition)
,
depending on whether the attribute is a WorkflowAttribute or SearchableAttribute
requests
node is fired), all attributes associated with the rule
(those associated with the Rule Template associated with the rule) which are WorkflowAttributes are enumerated and for each:
KewApiConstants.RULE_XML_ATTRIBUTE_TYPE
): the attribute is cast to GenericXMLRuleAttribute
and RuleAttribute business object is set on it (GenericXMLRuleAttribute#setRuleAttribute(org.kuali.rice.kew.rule.RuleAttribute)
before proceeding with isMatch invocation. (what about a RuleAttributeAware interface so this can be done generically for all worklfow attribute
implementations?)isMatch(DocumentContent, List)
is called with the Rule's extension values passedModifier and Type | Method and Description |
---|---|
String |
getDocContent()
Returns a String containing this Attribute's routingData values, formatted as a series of XML
tags.
|
List<Row> |
getRoutingDataRows()
RoutingDataRows contain Rows describing the UI-level presentation of the ruleData fields
used to determine where a given document would be routed according to the associated rule.
|
List<RuleExtensionValue> |
getRuleExtensionValues()
Returns the List of RuleExtensionValue objects associated with this Rule, each of which contains
the name and value of one of the parameters used by this Attribute to control when the associated
Rule gets evaluated.
|
List<Row> |
getRuleRows()
Each Row contains Fields describing the UI-level presentation of a single RuleExtensionValue.
|
boolean |
isMatch(DocumentContent docContent,
List<RuleExtension> ruleExtensions)
Returns true if this Attribute finds a match in the given DocContent.
|
boolean |
isRequired()
Returns true if the extensionValues on this Attribute must be filled in before the associated
Rule can be persisted.
|
void |
setRequired(boolean required)
Sets the required flag for this Attribute to true.
|
List<RemotableAttributeError> |
validateRoutingData(Map<String,String> paramMap)
Validates routingData values in the incoming map.
|
List<RemotableAttributeError> |
validateRuleData(Map<String,String> paramMap)
Validates ruleExtension values in the incoming map.
|
boolean isMatch(DocumentContent docContent, List<RuleExtension> ruleExtensions)
List<Row> getRuleRows()
A single Row may contain more than one actual Field instance, but Fields beyond the first one are there to provide context for the display and evaluation of the first one.
The getRuleRows method returns a list of rows that contain Fields describing the UI-level presentation of a single RuleExtensionValue for the creation of a rule. A single row may contain more than one actual Field object, but Fields beyond the first one are there to provide context for the display and evaluation of the first one. For example, a secondary field may be a lookupable or a searchable valid values object. An individual field consists of a field label, a field help url, a field type, whether a lookupable is associated with this field, a property name, a property value, valid values, the name of the lookupable, and the default lookupable name for this field. The field label is a short title that will display on the jsp describing what data to enter for this field. The field help url is optional, but will pop open in a new window the url entered. The field type is the type of field to display (e.g. hidden, text, drop down, radio, quickfinder (lookupable), lookup result only (this type is needed for the lookupable, but does not actually render on the jsp), and finally drop down refresh (this type is a drop down box that when it's value changes another drop down box's valid values will be changed as well)). The lookupable indicator determines whether this field will have a lookupable (valid value search) associated with it. The property name is the name of the field when rendered on the jsp. This needs to be unique when compared to other field names on the jsp. The property value is the value entered into the text box or other field type on the jsp. This value will be empty when creating the field and populated during form submission. A List of valid values is optional and needed to populate drop down boxes or radio buttons. This list consists of KeyValue objects which the key will be the value passed in on submission and the label will be what is display on the jsp. The lookupable is the name of the lookable service to be called for this field. The default lookupable name is the name of the field on the lookupable itself. This may be the same of the property name of the field. This is needed when field conversions are needed. If the lookupable returns a key that doesn't match a property name on the jsp it needs to be converted to one that does. So if the property name is different than the default lookupable name, the lookupable will convert the return key to the property name of the field. Example: say by default a lookupable returns "color=red" on the url. The default lookupable name would be "color" and if you needed a different name for this property on the jsp such as "wallcolor", the lookupable will now return "wallcolor=red" instead of the default "color=red". The default lookupable name also is the key for rule extension values. When an extension value is saved the value comes from the UI and the key from this field. If this field is left null, then the property name of the field will become the key stored in the database for the extension value. A row can also consist of a group label and number of rows for this label to span for this attribute. If a group label is present, it will display on the rule creation jsp and group together the individual rows for this attribute. The total rows number will rowspan the group label across the rows of this attribute. NOTE: the group label and number of rows to span must be specified on each row object for the display to work correctly.
Additionally, it is very important that the List of Row objects is reconstructed every time getRuleRows is called. This is because the code which processes these Rows will set the propertyValue directly on the Field objects contained within. Essentially, this means the Rows and Fields should not be constructed once inside of the attribute and cached statically, but instead be recreated each time this method is called.
List<Row> getRoutingDataRows()
The getRoutingDataRows method returns a list of rows that contain Fields describing the UI-level presentation of a single RuleExtensionValue for the routing report feature. These rows are used to determine where an eDoc would route if these values were entered. They are constructed the same way rule rows are described above and a lot of times are identical.
Additionally, it is very important that the List of Row objects is reconstructed every time getRoutingDataRows is called. This is because the code which processes these Rows will set the propertyValue directly on the Field objects contained within. Essentially, this means the Rows and Fields should not be constructed once inside of the attribute and cached statically, but instead be recreated each time this method is called.
String getDocContent()
For example, DollarRangeAttribute returns a single tag containing its totalDollarAmount, thus:
<totalDollarAmount>345</totalDollarAmount>
List<RuleExtensionValue> getRuleExtensionValues()
For example, the DollarRangeAttribute has two associated RuleExtensionValues - its minimum and maximum values - which control when a rule containing that attribute gets evaluated.
The UI instantiates a Rule from a RuleTemplate, uses the RuleRows of all of that Rule's Attributes to build a form, uses user input to create a set of RuleExtensionValues which get persisted when the rule is persisted. To create a RuleExtensionValue object, instantiate a new object, set the key which will be located on the Rule's attribute, set the value which will be entered on the form from the UI side, and finally add each RuleExtensionValue object to a list. (Basically, given a configured/initialized attribute, marshalls out the RuleExtensionValues representing the current state of the attribute - Aaron Hamid FIXME)
List<RemotableAttributeError> validateRoutingData(Map<String,String> paramMap)
paramMap
- Map containing the names and values of the routing data for this AttributeList<RemotableAttributeError> validateRuleData(Map<String,String> paramMap)
paramMap
- Map containing the names and values of the rule extensions for this Attributevoid setRequired(boolean required)
boolean isRequired()
Copyright © 2005–2015 The Kuali Foundation. All rights reserved.