Class UelFunctions

java.lang.Object
org.apache.ofbiz.base.util.string.UelFunctions

public class UelFunctions extends Object
Implements Unified Expression Language functions.

Built-in functions are divided into a number of namespace prefixes:

Miscellaneous date/time functions
date: contains miscellaneous date/time functions
date:second(Timestamp, TimeZone, Locale)Returns the second value of Timestamp (0 - 59).
date:minute(Timestamp, TimeZone, Locale)Returns the minute value of Timestamp (0 - 59).
date:hour(Timestamp, TimeZone, Locale)Returns the hour value of Timestamp (0 - 23).
date:dayOfMonth(Timestamp, TimeZone, Locale)Returns the day of month value of Timestamp (1 - 31) .
date:dayOfWeek(Timestamp, TimeZone, Locale)Returns the day of week value of Timestamp (Sunday = 1, Saturday = 7).
date:dayOfYear(Timestamp, TimeZone, Locale)Returns the day of year value of Timestamp.
date:week(Timestamp, TimeZone, Locale)Returns the week value of Timestamp.
date:month(Timestamp, TimeZone, Locale)Returns the month value of Timestamp (January = 0, December = 11).
date:year(Timestamp, TimeZone, Locale)Returns the year value of Timestamp.
date:dayStart(Timestamp, TimeZone, Locale)Returns Timestamp set to start of day.
date:dayEnd(Timestamp, TimeZone, Locale)Returns Timestamp set to end of day.
date:weekStart(Timestamp, TimeZone, Locale)Returns Timestamp set to start of week.
date:weekEnd(Timestamp, TimeZone, Locale)Returns Timestamp set to end of week.
date:monthStart(Timestamp, TimeZone, Locale)Returns Timestamp set to start of month.
date:monthEnd(Timestamp, TimeZone, Locale)Returns Timestamp set to end of month.
date:yearStart(Timestamp, TimeZone, Locale)Returns Timestamp set to start of year.
date:yearEnd(Timestamp, TimeZone, Locale)Returns Timestamp set to end of year.
date:dateStr(Timestamp, TimeZone, Locale)Returns Timestamp as a date String (yyyy-mm-dd) .
date:localizedDateStr(Timestamp, TimeZone, Locale)Returns Timestamp as a date String formatted according to the supplied locale.
date:dateTimeStr(Timestamp, TimeZone, Locale)Returns Timestamp as a date-time String (yyyy-mm-dd hh:mm).
date:localizedDateTimeStr(Timestamp, TimeZone, Locale)Returns Timestamp as a date-time String formatted according to the supplied locale.
date:timeStr(Timestamp, TimeZone, Locale)Returns Timestamp as a time String (hh:mm) .
date:nowTimestamp()Returns Timestamp for right now.
math: maps to java.lang.Math
math:absDouble(double)Returns the absolute value of a double value.
math:absFloat(float)Returns the absolute value of a float value.
math:absInt(int)Returns the absolute value of an int value.
math:absLong(long)Returns the absolute value of a long value.
math:acos(double)Returns the arc cosine of an angle, in the range of 0.0 through pi.
math:asin(double)Returns the arc sine of an angle, in the range of -pi/2 through pi/2.
math:atan(double)Returns the arc tangent of an angle, in the range of -pi/2 through pi/2.
math:atan2(double, double)Converts rectangular coordinates (xy) to polar (r,  theta).
math:cbrt(double)Returns the cube root of a double value.
math:ceil(double)Returns the smallest (closest to negative infinity) double value that is greater than or equal to the argument and is equal to a mathematical integer.
math:cos(double)Returns the trigonometric cosine of an angle.
math:cosh(double)Returns the hyperbolic cosine of a double value.
math:exp(double)Returns Euler's number e raised to the power of a double value.
math:expm1(double)Returns ex -1.
math:floor(double)Returns the largest (closest to positive infinity) double value that is less than or equal to the argument and is equal to a mathematical integer.
math:hypot(double, double)Returns sqrt(x2 +y2) without intermediate overflow or underflow.
math:IEEEremainder(double, double)Computes the remainder operation on two arguments as prescribed by the IEEE 754 standard.
math:log(double)Returns the natural logarithm (base e) of a double value.
math:log10(double)Returns the base 10 logarithm of a double value.
math:log1p(double)Returns the natural logarithm of the sum of the argument and 1.
math:maxDouble(double, double)Returns the greater of two double values.
math:maxFloat(float, float)Returns the greater of two float values.
math:maxInt(int, int)Returns the greater of two int values.
math:maxLong(long, long)Returns the greater of two long values.
math:minDouble(double, double)Returns the smaller of two double values.
math:minFloat(float, float)Returns the smaller of two float values.
math:minInt(int, int)Returns the smaller of two int values.
math:minLong(long, long)Returns the smaller of two long values.
math:pow(double, double)Returns the value of the first argument raised to the power of the second argument.
math:random()Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0.
math:rint(double)Returns the double value that is closest in value to the argument and is equal to a mathematical integer.
math:roundDouble(double)Returns the closest long to the argument.
math:roundFloat(float)Returns the closest int to the argument.
math:signumDouble(double)Returns the signum function of the argument; zero if the argument is zero, 1.0 if the argument is greater than zero, -1.0 if the argument is less than zero.
math:signumFloat(float)Returns the signum function of the argument; zero if the argument is zero, 1.0f if the argument is greater than zero, -1.0f if the argument is less than zero.
math:sin(double)Returns the trigonometric sine of an angle.
math:sinh(double)Returns the hyperbolic sine of a double value.
math:sqrt(double)Returns the correctly rounded positive square root of a double value.
math:tan(double)Returns the trigonometric tangent of an angle.
math:tanh(double)Returns the hyperbolic tangent of a double value.
math:toDegrees(double)Converts an angle measured in radians to an approximately equivalent angle measured in degrees.
math:toRadians(double)Converts an angle measured in degrees to an approximately equivalent angle measured in radians.
math:ulpDouble(double)Returns the size of an ulp (units in the last place) of the argument.
math:ulpFloat(float)Returns the size of an ulp (units in the last place) of the argument.
str: maps to java.lang.String
str:endsWith(String, String)Returns true if this string ends with the specified suffix.
str:indexOf(String, String)Returns the index within this string of the first occurrence of the specified substring .
str:lastIndexOf(String, String)Returns the index within this string of the last occurrence of the specified character.
str:length(String)Returns the length of this string.
str:replace(String, String, String)Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence.
str:replaceAll(String, String, String)Replaces each substring of this string that matches the given regular expression with the given replacement.
str:replaceFirst(String, String, String)Replaces the first substring of this string that matches the given regular expression with the given replacement.
str:startsWith(String, String)Returns true if this string starts with the specified prefix.
str:endstring(String, int)Returns a new string that is a substring of this string. The substring begins with the character at the specified index and extends to the end of this string.
str:substring(String, int, int)Returns a new string that is a substring of this string. The substring begins at the specified beginIndex and extends to the character at index endIndex - 1. Thus the length of the substring is endIndex-beginIndex.
str:toLowerCase(String)Converts all of the characters in this String to lower case using the rules of the default locale.
str:toString(Object)Converts Object to a String - bypassing localization.
str:toUpperCase(String)Converts all of the characters in this String to upper case using the rules of the default locale.
str:trim(String)Returns a copy of the string, with leading and trailing whitespace omitted.
sys: maps to java.lang.System
sys:getenv(String)Gets the value of the specified environment variable.
sys:getProperty(String)Gets the system property indicated by the specified key.
util: contains miscellaneous utility functions
util:defaultLocale()Returns the default Locale.
util:defaultTimeZone()Returns the default TimeZone.
util:label(String, String, Locale)Return the label present in ressource on the given locale.
util:size(Object)Returns the size of Maps,
screen:id(ScreenStack)Returns the id of the current screen, Collections, and Strings. Invalid Object types return -1.
dom: contains org.w3c.dom.* functions
dom:readHtmlDocument(String)Reads an HTML file and returns a org.w3c.dom.Document instance.
dom:readXmlDocument(String)Reads an XML file and returns a org.w3c.dom.Document instance.
dom:toHtmlString(Node, String encoding, boolean indent, int indentAmount)Returns a org.w3c.dom.Node as an HTML String.
dom:toXmlString(Node, String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount)Returns a org.w3c.dom.Node as an XML String.
dom:writeXmlDocument(String, Node, String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount) Writes a org.w3c.dom.Node to an XML file and returns true if successful.
  • Field Details

  • Constructor Details

    • UelFunctions

      public UelFunctions()
  • Method Details

    • getFunctionMapper

      public static javax.el.FunctionMapper getFunctionMapper()
      Returns a FunctionMapper instance.
      Returns:
      FunctionMapper instance
    • setFunction

      public static void setFunction(String prefix, String localName, Method method)
      Add a function to OFBiz's built-in UEL functions.
    • dateString

      public static String dateString(Timestamp stamp, TimeZone timeZone, Locale locale)
    • localizedDateString

      public static String localizedDateString(Timestamp stamp, TimeZone timeZone, Locale locale)
    • dateTimeString

      public static String dateTimeString(Timestamp stamp, TimeZone timeZone, Locale locale)
    • localizedDateTimeString

      public static String localizedDateTimeString(Timestamp stamp, TimeZone timeZone, Locale locale)
    • timeString

      public static String timeString(Timestamp stamp, TimeZone timeZone, Locale locale)
    • getSize

      public static int getSize(Object obj)
    • endsWith

      public static boolean endsWith(String str1, String str2)
    • indexOf

      public static int indexOf(String str1, String str2)
    • lastIndexOf

      public static int lastIndexOf(String str1, String str2)
    • length

      public static int length(String str1)
    • replace

      public static String replace(String str1, String str2, String str3)
    • replaceAll

      public static String replaceAll(String str1, String str2, String str3)
    • replaceFirst

      public static String replaceFirst(String str1, String str2, String str3)
    • startsWith

      public static boolean startsWith(String str1, String str2)
    • endString

      public static String endString(String str, int index)
    • subString

      public static String subString(String str, int beginIndex, int endIndex)
    • trim

      public static String trim(String str)
    • toLowerCase

      public static String toLowerCase(String str)
    • toUpperCase

      public static String toUpperCase(String str)
    • toString

      public static String toString(Object obj)
    • sysGetEnv

      public static String sysGetEnv(String str)
    • sysGetProp

      public static String sysGetProp(String str)
    • label

      public static String label(String ressource, String label, Locale locale)
    • resolveCurrentScreenId

      public static String resolveCurrentScreenId(ScreenRenderer.ScreenStack screenStack)
      Returns the id of the current screen identified on the screen stack
      Parameters:
      screenStack -
      Returns:
    • readHtmlDocument

      public static Document readHtmlDocument(String str)
    • readXmlDocument

      public static Document readXmlDocument(String str)
    • writeXmlDocument

      public static boolean writeXmlDocument(String str, Node node, String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount)
    • toHtmlString

      public static String toHtmlString(Node node, String encoding, boolean indent, int indentAmount)
    • toXmlString

      public static String toXmlString(Node node, String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount)