Class ExpressionFunctions

java.lang.Object
org.kuali.rice.krad.uif.util.ExpressionFunctions

public class ExpressionFunctions extends Object
Defines functions that can be used in el expressions within the UIF dictionary files
Author:
Kuali Rice Team (rice.collab@kuali.org)
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    empty(Object value)
    Checks whether the given value is null or blank string
    static boolean
    emptyList(List<?> list)
    Checks to see if the list is empty.
    static String
    getDataObjectKey(String dataObjectClassName)
    Get the a primary key (valid for inquiry/maintenance view retrieval) for the dataObject by class name passed in
    static String
    getName(Class<?> clazz)
    Returns the name for the given class
    static String
    getParam(String namespaceCode, String componentCode, String parameterName)
    Retrieves the value of the parameter identified with the given namespace, component, and name
    static Boolean
    getParamAsBoolean(String namespaceCode, String componentCode, String parameterName)
    Retrieves the value of the parameter identified with the given namespace, component, and name and converts to a Boolean
    static Double
    getParamAsDouble(String namespaceCode, String componentCode, String parameterName)
    Retrieves the value of the parameter identified with the given namespace, component, and name and converts to a Double
    static Integer
    getParamAsInteger(String namespaceCode, String componentCode, String parameterName)
    Retrieves the value of the parameter identified with the given namespace, component, and name and converts to a Integer
    static <T> T
    getService(String serviceName)
    Returns the service indicated by serviceName.
    static boolean
    hasPerm(String namespaceCode, String permissionName)
    Indicates whether the current user has the permission identified by the given namespace and permission name
    static boolean
    hasPermDtls(String namespaceCode, String permissionName, Map<String,String> permissionDetails, Map<String,String> roleQualifiers)
    Indicates whether the current user has the permission identified by the given namespace and permission name and with the given details and role qualification
    static boolean
    hasPermTmpl(String namespaceCode, String templateName, Map<String,String> permissionDetails, Map<String,String> roleQualifiers)
    Indicates whether the current user has the permission identified by the given namespace and template name and with the given details and role qualification
    static boolean
    isAssignableFrom(Class<?> assignableClass, Class<?> objectClass)
    Checks whether the given class parameter is assignable from the given object class parameter
    static boolean
    Determines if running in a production environment.
    static boolean
    listContains(List<?> list, Object[] values)
    Check to see if the list contains the values passed in.
    static Long
    sequence(String sequenceName)
    Gets the next available number from a sequence

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ExpressionFunctions

      public ExpressionFunctions()
  • Method Details

    • isAssignableFrom

      public static boolean isAssignableFrom(Class<?> assignableClass, Class<?> objectClass)
      Checks whether the given class parameter is assignable from the given object class parameter
      Parameters:
      assignableClass - class to use for assignable to
      objectClass - class to use for assignable from
      Returns:
      true if the object class is of type assignable class, false if not
    • empty

      public static boolean empty(Object value)
      Checks whether the given value is null or blank string
      Parameters:
      value - property value to check
      Returns:
      true if value is null or blank, false if not
    • emptyList

      public static boolean emptyList(List<?> list)
      Checks to see if the list is empty. Throws a RuntimeException if list is not a List.
      Parameters:
      list - the list
      Returns:
      true if the list is null or empty, false otherwise
    • getService

      public static <T> T getService(String serviceName)
      Returns the service indicated by serviceName.
      Type Parameters:
      T - the type of the service
      Parameters:
      serviceName - the name of the service to obtain
      Returns:
      the service indicated by serviceName.
    • listContains

      public static boolean listContains(List<?> list, Object[] values)
      Check to see if the list contains the values passed in.

      In the SpringEL call values can be single item or array due to the way the EL converts values. The values can be string or numeric and should match the content type being stored in the list. If the list is String and the values passed in are not string, toString() conversion will be used. Returns true if the values are in the list and both lists are non-empty, false otherwise.

      Parameters:
      list - the list to be evaluated
      values - the values to be to check for in the list
      Returns:
      true if all values exist in the list and both values and list are non-null/not-empty, false otherwise
    • getName

      public static String getName(Class<?> clazz)
      Returns the name for the given class
      Parameters:
      clazz - class object to return name for
      Returns:
      class name or empty string if class is null
    • getParam

      public static String getParam(String namespaceCode, String componentCode, String parameterName)
      Retrieves the value of the parameter identified with the given namespace, component, and name
      Parameters:
      namespaceCode - namespace code for the parameter to retrieve
      componentCode - component code for the parameter to retrieve
      parameterName - name of the parameter to retrieve
      Returns:
      String value of parameter as a string or null if parameter does not exist
    • getParamAsBoolean

      public static Boolean getParamAsBoolean(String namespaceCode, String componentCode, String parameterName)
      Retrieves the value of the parameter identified with the given namespace, component, and name and converts to a Boolean
      Parameters:
      namespaceCode - namespace code for the parameter to retrieve
      componentCode - component code for the parameter to retrieve
      parameterName - name of the parameter to retrieve
      Returns:
      Boolean value of parameter as a boolean or null if parameter does not exist
    • getParamAsInteger

      public static Integer getParamAsInteger(String namespaceCode, String componentCode, String parameterName)
      Retrieves the value of the parameter identified with the given namespace, component, and name and converts to a Integer
      Parameters:
      namespaceCode - namespace code for the parameter to retrieve
      componentCode - component code for the parameter to retrieve
      parameterName - name of the parameter to retrieve
      Returns:
      Boolean value of parameter as a Integer or null if parameter does not exist
    • getParamAsDouble

      public static Double getParamAsDouble(String namespaceCode, String componentCode, String parameterName)
      Retrieves the value of the parameter identified with the given namespace, component, and name and converts to a Double
      Parameters:
      namespaceCode - namespace code for the parameter to retrieve
      componentCode - component code for the parameter to retrieve
      parameterName - name of the parameter to retrieve
      Returns:
      Boolean value of parameter as a Double or null if parameter does not exist
    • hasPerm

      public static boolean hasPerm(String namespaceCode, String permissionName)
      Indicates whether the current user has the permission identified by the given namespace and permission name
      Parameters:
      namespaceCode - namespace code for the permission to check
      permissionName - name of the permission to check
      Returns:
      true if the current user has the permission, false if not or the permission does not exist
    • hasPermDtls

      public static boolean hasPermDtls(String namespaceCode, String permissionName, Map<String,String> permissionDetails, Map<String,String> roleQualifiers)
      Indicates whether the current user has the permission identified by the given namespace and permission name and with the given details and role qualification
      Parameters:
      namespaceCode - namespace code for the permission to check
      permissionName - name of the permission to check
      permissionDetails - details for the permission check
      roleQualifiers - qualification for assigned roles
      Returns:
      true if the current user has the permission, false if not or the permission does not exist
    • hasPermTmpl

      public static boolean hasPermTmpl(String namespaceCode, String templateName, Map<String,String> permissionDetails, Map<String,String> roleQualifiers)
      Indicates whether the current user has the permission identified by the given namespace and template name and with the given details and role qualification
      Parameters:
      namespaceCode - namespace code for the permission to check
      templateName - name of the permission template to find permissions for
      permissionDetails - details for the permission check
      roleQualifiers - qualification for assigned roles
      Returns:
      true if the current user has a permission with the given template, false if not or the permission does not exist
    • sequence

      public static Long sequence(String sequenceName)
      Gets the next available number from a sequence
      Parameters:
      sequenceName - name of the sequence to retrieve from
      Returns:
      next sequence value
    • getDataObjectKey

      public static String getDataObjectKey(String dataObjectClassName)
      Get the a primary key (valid for inquiry/maintenance view retrieval) for the dataObject by class name passed in
      Parameters:
      dataObjectClassName - the class name to get the key for
      Returns:
      a key valid for use as a request parameter for retrieving an inquiry or maintenance doc
    • isProductionEnvironment

      public static boolean isProductionEnvironment()
      Determines if running in a production environment.
      Returns:
      true if running in a production environment