org.kuali.rice.kns.workflow
Class WorkflowUtils

java.lang.Object
  extended by org.kuali.rice.kns.workflow.WorkflowUtils

public class WorkflowUtils
extends Object


Field Summary
private static String XPATH_ROUTE_CONTEXT_KEY
           
static String XSTREAM_MATCH_ANYWHERE_PREFIX
           
static String XSTREAM_MATCH_RELATIVE_PREFIX
           
static String XSTREAM_SAFE_PREFIX
           
static String XSTREAM_SAFE_SUFFIX
           
 
Constructor Summary
WorkflowUtils()
           
 
Method Summary
static Row buildDropdownRow(Class propertyClass, String boPropertyName, String workflowPropertyKey, Map<String,String> optionMap, boolean addBlankRow)
          This method builds a workflow-lookup-screen Row of type DROPDOWN.
static Row buildTextRow(Class propertyClass, String boPropertyName, String workflowPropertyKey)
          This method builds a workflow-lookup-screen Row of type TEXT, with no quickfinder/lookup.
static Row buildTextRowWithLookup(Class propertyClass, String boPropertyName, String workflowPropertyKey)
          This method builds a workflow-lookup-screen Row of type TEXT, with the attached lookup icon and functionality.
static Row buildTextRowWithLookup(Class propertyClass, String boPropertyName, String workflowPropertyKey, Map fieldConversionsByBoPropertyName)
          This method builds a workflow-lookup-screen Row of type TEXT, with the attached lookup icon and functionality.
static String getBusinessObjectAttributeLabel(Class businessObjectClass, String attributeName)
          This method returns a label from the data dictionary service
static String getHelpUrl(Field field)
          This method is for use by WorkflowLookupableImpl and WorkflowAttribute implementations to derive the fieldHelpUrl for use on org.kuali.rice.kns.web.ui.Fieldss.
static XPath getXPath(Document document)
          This method sets up the XPath with the correct workflow namespace and resolver initialized.
static XPath getXPath(RouteContext routeContext)
           
static String xstreamSafeEval(XPath xpath, String xpathExpression, Object item)
          This method will do a simple XPath.evaluate, while wrapping your xpathExpression with the xstreamSafe function.
static String xstreamSafeXPath(String xpathExpression)
          This method wraps the passed-in XPath expression in XStream Safe wrappers, so that XStream generated reference links will be handled correctly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XPATH_ROUTE_CONTEXT_KEY

private static final String XPATH_ROUTE_CONTEXT_KEY
See Also:
Constant Field Values

XSTREAM_SAFE_PREFIX

public static final String XSTREAM_SAFE_PREFIX
See Also:
Constant Field Values

XSTREAM_SAFE_SUFFIX

public static final String XSTREAM_SAFE_SUFFIX
See Also:
Constant Field Values

XSTREAM_MATCH_ANYWHERE_PREFIX

public static final String XSTREAM_MATCH_ANYWHERE_PREFIX
See Also:
Constant Field Values

XSTREAM_MATCH_RELATIVE_PREFIX

public static final String XSTREAM_MATCH_RELATIVE_PREFIX
See Also:
Constant Field Values
Constructor Detail

WorkflowUtils

public WorkflowUtils()
Method Detail

getXPath

public static final XPath getXPath(Document document)
This method sets up the XPath with the correct workflow namespace and resolver initialized. This ensures that the XPath statements can use required workflow functions as part of the XPath statements.

Parameters:
document - - document
Returns:
a fully initialized XPath instance that has access to the workflow resolver and namespace.

getXPath

public static final XPath getXPath(RouteContext routeContext)

xstreamSafeEval

public static final String xstreamSafeEval(XPath xpath,
                                           String xpathExpression,
                                           Object item)
This method will do a simple XPath.evaluate, while wrapping your xpathExpression with the xstreamSafe function. It assumes a String result, and will return such. If an XPathExpressionException is thrown, this will be re-thrown within a RuntimeException.

Parameters:
xpath - A correctly initialized XPath instance.
xpathExpression - Your XPath Expression that needs to be wrapped in an xstreamSafe wrapper and run.
item - The document contents you will be searching within.
Returns:
The string value of the xpath.evaluate().

xstreamSafeXPath

public static final String xstreamSafeXPath(String xpathExpression)
This method wraps the passed-in XPath expression in XStream Safe wrappers, so that XStream generated reference links will be handled correctly.

Parameters:
xpathExpression - The XPath Expression you wish to use.
Returns:
Your XPath Expression wrapped in the XStreamSafe wrapper.

getHelpUrl

public static String getHelpUrl(Field field)
This method is for use by WorkflowLookupableImpl and WorkflowAttribute implementations to derive the fieldHelpUrl for use on org.kuali.rice.kns.web.ui.Fieldss.

Parameters:
field - The kuali field that we need to derive a help url for. @ return Returns the help url for the field.

getBusinessObjectAttributeLabel

public static final String getBusinessObjectAttributeLabel(Class businessObjectClass,
                                                           String attributeName)
This method returns a label from the data dictionary service

Parameters:
businessObjectClass - - class where the label should come from
attributeName - - name of the attribute you need the label for
Returns:
the label from the data dictionary for the given Class and attributeName or null if not found

buildTextRow

public static Row buildTextRow(Class propertyClass,
                               String boPropertyName,
                               String workflowPropertyKey)
This method builds a workflow-lookup-screen Row of type TEXT, with no quickfinder/lookup.

Parameters:
propertyClass - The Class of the BO that this row is based on. For example, Account.class for accountNumber.
boPropertyName - The property name on the BO that this row is based on. For example, accountNumber for Account.accountNumber.
workflowPropertyKey - The workflow-lookup-screen property key. For example, account_nbr for Account.accountNumber. This key can be anything, but needs to be consistent with what is used for the row/field key on the java attribute, so everything links up correctly.
Returns:
A populated and ready-to-use workflow lookupable.Row.

buildTextRowWithLookup

public static Row buildTextRowWithLookup(Class propertyClass,
                                         String boPropertyName,
                                         String workflowPropertyKey)
This method builds a workflow-lookup-screen Row of type TEXT, with the attached lookup icon and functionality.

Parameters:
propertyClass - The Class of the BO that this row is based on. For example, Account.class for accountNumber.
boPropertyName - The property name on the BO that this row is based on. For example, accountNumber for Account.accountNumber.
workflowPropertyKey - The workflow-lookup-screen property key. For example, account_nbr for Account.accountNumber. This key can be anything, but needs to be consistent with what is used for the row/field key on the java attribute, so everything links up correctly.
Returns:
A populated and ready-to-use workflow lookupable.Row, which includes both the property field and the lookup icon.

buildTextRowWithLookup

public static Row buildTextRowWithLookup(Class propertyClass,
                                         String boPropertyName,
                                         String workflowPropertyKey,
                                         Map fieldConversionsByBoPropertyName)
This method builds a workflow-lookup-screen Row of type TEXT, with the attached lookup icon and functionality.

Parameters:
propertyClass - The Class of the BO that this row is based on. For example, Account.class for accountNumber.
boPropertyName - The property name on the BO that this row is based on. For example, accountNumber for Account.accountNumber.
workflowPropertyKey - The workflow-lookup-screen property key. For example, account_nbr for Account.accountNumber. This key can be anything, but needs to be consistent with what is used for the row/field key on the java attribute, so everything links up correctly.
fieldConversionsByBoPropertyName - A list of extra field conversions where the key is the business object property name and the value is the workflow property key
Returns:
A populated and ready-to-use workflow lookupable.Row, which includes both the property field and the lookup icon.

buildDropdownRow

public static Row buildDropdownRow(Class propertyClass,
                                   String boPropertyName,
                                   String workflowPropertyKey,
                                   Map<String,String> optionMap,
                                   boolean addBlankRow)
This method builds a workflow-lookup-screen Row of type DROPDOWN.

Parameters:
propertyClass - The Class of the BO that this row is based on. For example, Account.class for accountNumber.
boPropertyName - The property name on the BO that this row is based on. For example, accountNumber for Account.accountNumber.
workflowPropertyKey - The workflow-lookup-screen property key. For example, account_nbr for Account.accountNumber. This key can be anything, but needs to be consistent with what is used for the row/field key on the java attribute, so everything links up correctly.
optionMap - The map of value, text pairs that will be used to constuct the dropdown list.
Returns:
A populated and ready-to-use workflow lookupable.Row.


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