org.kuali.rice.kew.xml
Class RuleTemplateXmlParser

java.lang.Object
  extended by org.kuali.rice.kew.xml.RuleTemplateXmlParser
All Implemented Interfaces:
XmlConstants

public class RuleTemplateXmlParser
extends Object
implements XmlConstants

Parses RuleTemplates from XML.

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

Field Summary
private static boolean DEFAULT_ATTRIBUTE_ACTIVE
           
private static boolean DEFAULT_ATTRIBUTE_REQUIRED
          By default make attributes defined without a <required> element
private static String DUMMY_DOCUMENT_TYPE
          A dummy document type used in the default rule
private static org.apache.log4j.Logger LOG
           
private  int templateAttributeCounter
          Used to set the display order of attributes encountered in parsing runs during the lifetime of this object
 
Fields inherited from interface org.kuali.rice.kew.xml.XmlConstants
ACTION_REQUESTED, ACTIVATION_TYPE, ACTIVE, APP_DOC_STATUSES, APPROVE_POLICY, ATTRIBUTE, ATTRIBUTE_CLASS_NAME, ATTRIBUTES, BLANKET_APPROVE_GROUP_NAME, BLANKET_APPROVE_POLICY, BLANKET_APPROVE_WORKGROUP_NAME, BRANCH, CLASS_NAME, CUSTOM_EMAIL_STYLESHEET, DATA, DATA_ELEMENT, DEFAULT_ACTION_REQUESTED, DEFAULT_EXCEPTION_GROUP_NAME, DEFAULT_EXCEPTION_WORKGROUP_NAME, DELEGATION_TEMPLATE, DELEGATION_TYPE, DELEGATIONS, DESCRIPTION, DOC_HANDLER, DOC_SEARCH_HELP_URL, DOCUMENT_TYPE, DOCUMENT_TYPE_NAMESPACE, DOCUMENT_TYPE_OVERWRITE_MODE, DOCUMENT_TYPE_SCHEMA_LOCATION, DOCUMENT_TYPES, EDL_ACTIVE, EDL_ASSOCIATION, EDL_DEFINITION, EDL_DOC_TYPE, EDL_EDOCLITE, EDL_NAMESPACE, EDL_SCHEMA_LOCATION, EDL_STYLE, EXCEPTION_GROUP_NAME, EXCEPTION_WORKGROUP, EXCEPTION_WORKGROUP_NAME, EXPRESSION, EXTENSION, EXTENSIONS, FINAL_APPROVAL, FORCE_ACTION, FROM_DATE, GROUP, GROUP_ID, GROUP_NAME, GROUP_NAMESPACE, GROUP_SCHEMA_LOCATION, GROUPS, HELP_DEFINITION_URL, HELP_ENTRIES, HELP_ENTRY, HELP_KEY, HELP_NAME, HELP_NAMESPACE, HELP_SCHEMA_LOCATION, HELP_TEXT, ID, INITIAL_NODE, IS_MEMBER_OF_GROUP, IS_MEMBER_OF_WORKGROUP, KEY, LABEL, MANDATORY_ROUTE, MEMBERS, NAME, NAMESPACE, NEXT_NODE, NOTIFICATION_FROM_ADDRESS, PARENT, PARENT_RESPONSIBILITY, PARENT_RULE_NAME, POLICIES, POLICY, POST_PROCESSOR_NAME, PRINCIPAL_ID, PRINCIPAL_NAME, PRIORITY, PROCESS_NAME, REPORTING_GROUP_NAME, REPORTING_WORKGROUP_NAME, REQUIRED, RESOLVER_CONFIG, RESPONSIBILITIES, RESPONSIBILITY, RESPONSIBILITY_ID, ROLE, ROLE_NAME, ROUTE_MODULE, ROUTE_NODES, ROUTE_PATH, ROUTE_PATHS, ROUTING_CONFIG, ROUTING_VERSION, RULE, RULE_ATTRIBUTE, RULE_ATTRIBUTE_NAMESPACE, RULE_ATTRIBUTE_SCHEMA_LOCATION, RULE_ATTRIBUTES, RULE_DEFAULTS, RULE_DELEGATION, RULE_DELEGATIONS, RULE_EXPRESSION, RULE_EXTENSION, RULE_EXTENSION_VALUE, RULE_EXTENSION_VALUES, RULE_EXTENSIONS, RULE_NAMESPACE, RULE_SCHEMA_LOCATION, RULE_TEMPLATE, RULE_TEMPLATE_NAMESPACE, RULE_TEMPLATE_SCHEMA_LOCATION, RULE_TEMPLATES, RULES, SCHEMA_LOCATION_ATTR, SCHEMA_NAMESPACE, SEARCH_RESULT_CONFIG, SEARCHING_CONFIG, SECURITY, SERVICE_NAMESPACE, SHORT_LABEL, STATUS, STYLE_NAMESPACE, STYLE_SCHEMA_LOCATION, STYLE_STYLE, STYLE_STYLES, SUMMARY, SUPER_USER_GROUP_NAME, SUPER_USER_WORKGROUP_NAME, SUPPORTS_ACKNOWLEDGE, SUPPORTS_APPROVE, SUPPORTS_COMPLETE, SUPPORTS_FYI, TO_DATE, TYPE, USER, VALUE, WORKFLOW_NAMESPACE, WORKFLOW_SCHEMA_LOCATION, WORKGROUP, WORKGROUPS
 
Constructor Summary
RuleTemplateXmlParser()
           
 
Method Summary
 Timestamp formatDate(String dateLabel, String dateString)
           
private  RuleTemplate parseRuleTemplate(org.jdom.Element element, List<RuleTemplate> ruleTemplates)
           
private  RuleTemplateAttribute parseRuleTemplateAttribute(org.jdom.Element element, RuleTemplate ruleTemplate)
          Parses a rule template attribute
private  List<RuleTemplateAttribute> parseRuleTemplateAttributes(org.jdom.Element attributesElement, RuleTemplate ruleTemplate)
          Parses the RuleTemplateAttributes defined on the rule template element
 List<RuleTemplate> parseRuleTemplates(org.jdom.Element element)
           
 List<RuleTemplate> parseRuleTemplates(InputStream input)
           
protected  void updateDelegationTemplate(org.jdom.Element ruleTemplateElement, RuleTemplate updatedRuleTemplate, List<RuleTemplate> parsedRuleTemplates)
          Updates the rule template delegation template with the one specified in the XML (if any)
protected  void updateOrDeleteRuleTemplateOption(RuleTemplate updatedRuleTemplate, String key, Object value)
          Updates or deletes a specified rule template option on the rule template
protected  boolean updateRuleDefaults(org.jdom.Element defaultsElement, RuleTemplate updatedRuleTemplate)
          Updates the default/template rule options with those in the defaults element
protected  void updateRuleTemplateAttributes(org.jdom.Element ruleTemplateElement, RuleTemplate updatedRuleTemplate)
          Updates the attributes set on the RuleTemplate
protected  void updateRuleTemplateDefaultOptions(org.jdom.Element ruleTemplateElement, RuleTemplate updatedRuleTemplate)
          Updates the rule template default options.
protected  void updateRuleTemplateOptions(org.jdom.Element defaultsElement, RuleTemplate updatedRuleTemplate, boolean isDelegation)
          Updates the rule template defaults options with those in the defaults element
 
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

DEFAULT_ATTRIBUTE_REQUIRED

private static final boolean DEFAULT_ATTRIBUTE_REQUIRED
By default make attributes defined without a <required> element

See Also:
Constant Field Values

DEFAULT_ATTRIBUTE_ACTIVE

private static final boolean DEFAULT_ATTRIBUTE_ACTIVE
See Also:
Constant Field Values

DUMMY_DOCUMENT_TYPE

private static final String DUMMY_DOCUMENT_TYPE
A dummy document type used in the default rule

See Also:
Constant Field Values

templateAttributeCounter

private int templateAttributeCounter
Used to set the display order of attributes encountered in parsing runs during the lifetime of this object

Constructor Detail

RuleTemplateXmlParser

public RuleTemplateXmlParser()
Method Detail

parseRuleTemplates

public List<RuleTemplate> parseRuleTemplates(InputStream input)
                                      throws IOException,
                                             InvalidXmlException
Throws:
IOException
InvalidXmlException

parseRuleTemplates

public List<RuleTemplate> parseRuleTemplates(org.jdom.Element element)
                                      throws InvalidXmlException
Throws:
InvalidXmlException

parseRuleTemplate

private RuleTemplate parseRuleTemplate(org.jdom.Element element,
                                       List<RuleTemplate> ruleTemplates)
                                throws InvalidXmlException
Throws:
InvalidXmlException

updateRuleTemplateDefaultOptions

protected void updateRuleTemplateDefaultOptions(org.jdom.Element ruleTemplateElement,
                                                RuleTemplate updatedRuleTemplate)
                                         throws InvalidXmlException
Updates the rule template default options. Updates any existing options, removes any omitted ones.

Parameters:
ruleTemplateElement - the rule template XML element
updatedRuleTemplate - the RuleTemplate being updated
Throws:
InvalidXmlException

updateRuleTemplateOptions

protected void updateRuleTemplateOptions(org.jdom.Element defaultsElement,
                                         RuleTemplate updatedRuleTemplate,
                                         boolean isDelegation)
                                  throws InvalidXmlException
Updates the rule template defaults options with those in the defaults element

Parameters:
defaultsElement - the ruleDefaults element
updatedRuleTemplate - the Rule Template being updated
Throws:
InvalidXmlException

updateRuleDefaults

protected boolean updateRuleDefaults(org.jdom.Element defaultsElement,
                                     RuleTemplate updatedRuleTemplate)
                              throws InvalidXmlException
Updates the default/template rule options with those in the defaults element

Parameters:
defaultsElement - the ruleDefaults element
updatedRuleTemplate - the Rule Template being updated
Returns:
whether this is a delegation rule template
Throws:
InvalidXmlException

updateOrDeleteRuleTemplateOption

protected void updateOrDeleteRuleTemplateOption(RuleTemplate updatedRuleTemplate,
                                                String key,
                                                Object value)
Updates or deletes a specified rule template option on the rule template

Parameters:
updatedRuleTemplate - the RuleTemplate being updated
key - the option key
value - the option value

updateDelegationTemplate

protected void updateDelegationTemplate(org.jdom.Element ruleTemplateElement,
                                        RuleTemplate updatedRuleTemplate,
                                        List<RuleTemplate> parsedRuleTemplates)
                                 throws InvalidXmlException
Updates the rule template delegation template with the one specified in the XML (if any)

Parameters:
ruleTemplateElement - the XML ruleTemplate element
updatedRuleTemplate - the rule template to update
parsedRuleTemplates - the rule templates parsed in this parsing run
Throws:
InvalidXmlException - if a delegation template was specified but could not be found

updateRuleTemplateAttributes

protected void updateRuleTemplateAttributes(org.jdom.Element ruleTemplateElement,
                                            RuleTemplate updatedRuleTemplate)
                                     throws InvalidXmlException
Updates the attributes set on the RuleTemplate

Parameters:
ruleTemplateElement - the XML ruleTemplate element
updatedRuleTemplate - the RuleTemplate being updated
Throws:
InvalidXmlException - if there was a problem parsing the rule template attributes

parseRuleTemplateAttributes

private List<RuleTemplateAttribute> parseRuleTemplateAttributes(org.jdom.Element attributesElement,
                                                                RuleTemplate ruleTemplate)
                                                         throws InvalidXmlException
Parses the RuleTemplateAttributes defined on the rule template element

Parameters:
attributesElement - the jdom Element object for the Rule Template attributes
ruleTemplate - the RuleTemplate object
Returns:
the RuleTemplateAttributes defined on the rule template element
Throws:
InvalidXmlException

parseRuleTemplateAttribute

private RuleTemplateAttribute parseRuleTemplateAttribute(org.jdom.Element element,
                                                         RuleTemplate ruleTemplate)
                                                  throws InvalidXmlException
Parses a rule template attribute

Parameters:
element - the attribute XML element
ruleTemplate - the ruleTemplate to update
Returns:
a parsed rule template attribute
Throws:
InvalidXmlException - if the attribute does not exist

formatDate

public Timestamp formatDate(String dateLabel,
                            String dateString)
                     throws InvalidXmlException
Throws:
InvalidXmlException


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