org.kuali.rice.krad.uif.util
Class ExpressionUtils

java.lang.Object
  extended by org.kuali.rice.krad.uif.util.ExpressionUtils

public class ExpressionUtils
extends Object

Utility class for UIF expressions

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

Constructor Summary
ExpressionUtils()
           
 
Method Summary
static void adjustPropertyExpressions(View view, Object object)
          Adjusts the property expressions for a given object.
static void evaluateCurrentStack(String stack, List<String> controlNames)
          Used internally by parseExpression to evalute if the current stack is a property name (ie, will be a control on the form)
protected static String getLinePathPrefixValue(Component component)
          Determines the value for the org.kuali.rice.krad.uif.UifConstants#LINE_PATH_BIND_ADJUST_PREFIX binding prefix based on collection group found in the component context
protected static boolean moveNestedPropertyExpression(Object object, String propertyName, String expression)
          Moves any nested property expressions to the parent object
static String parseExpression(String exp, List<String> controlNames)
          Takes in an expression and a list to be filled in with names(property names) of controls found in the expression.
static String replaceBindingPrefixes(View view, Object object, String expression)
          Adjusts the property expressions for a given object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExpressionUtils

public ExpressionUtils()
Method Detail

adjustPropertyExpressions

public static void adjustPropertyExpressions(View view,
                                             Object object)
Adjusts the property expressions for a given object. Any nested properties are moved to the parent object. Binding adjust prefixes are replaced with the correct values.

The org.kuali.rice.krad.uif.UifConstants#NO_BIND_ADJUST_PREFIX prefix will be removed as this is a placeholder indicating that the property is directly on the form. The org.kuali.rice.krad.uif.UifConstants#FIELD_PATH_BIND_ADJUST_PREFIX prefix will be replaced by the object's field path - this is only applicable to DataFields. The org.kuali.rice.krad.uif.UifConstants#DEFAULT_PATH_BIND_ADJUST_PREFIX prefix will be replaced by the view's default path if it is set.

Parameters:
view - - the parent view of the object
object - - Object to adjust property expressions on

replaceBindingPrefixes

public static String replaceBindingPrefixes(View view,
                                            Object object,
                                            String expression)
Adjusts the property expressions for a given object

The org.kuali.rice.krad.uif.UifConstants#NO_BIND_ADJUST_PREFIX prefix will be removed as this is a placeholder indicating that the property is directly on the form. The org.kuali.rice.krad.uif.UifConstants#FIELD_PATH_BIND_ADJUST_PREFIX prefix will be replaced by the object's field path - this is only applicable to DataFields. The org.kuali.rice.krad.uif.UifConstants#DEFAULT_PATH_BIND_ADJUST_PREFIX prefix will be replaced by the view's default path if it is set.

Parameters:
view - - the parent view of the object
object - - Object to adjust property expressions on
expression - - The expression to adjust
Returns:
the adjusted expression String

getLinePathPrefixValue

protected static String getLinePathPrefixValue(Component component)
Determines the value for the org.kuali.rice.krad.uif.UifConstants#LINE_PATH_BIND_ADJUST_PREFIX binding prefix based on collection group found in the component context

Parameters:
component - - component instance for which the prefix is configured on
Returns:
String line binding path or empty string if path not found

moveNestedPropertyExpression

protected static boolean moveNestedPropertyExpression(Object object,
                                                      String propertyName,
                                                      String expression)
Moves any nested property expressions to the parent object

Parameters:
object - - the object containing the expression
propertyName - - the property the expression is on
expression - - the expression to move
Returns:

parseExpression

public static String parseExpression(String exp,
                                     List<String> controlNames)
Takes in an expression and a list to be filled in with names(property names) of controls found in the expression. This method returns a js expression which can be executed on the client to determine if the original exp was satisfied before interacting with the server - ie, this js expression is equivalent to the one passed in. There are limitations on the Spring expression language that can be used as this method. It is only used to parse expressions which are valid case statements for determining if some action/processing should be performed. ONLY Properties, comparison operators, booleans, strings, matches expression, and boolean logic are supported. Properties must be a valid property on the form, and should have a visible control within the view. Example valid exp: account.name == 'Account Name'

Parameters:
exp -
controlNames -
Returns:

evaluateCurrentStack

public static void evaluateCurrentStack(String stack,
                                        List<String> controlNames)
Used internally by parseExpression to evalute if the current stack is a property name (ie, will be a control on the form)

Parameters:
stack -
controlNames -


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