Class UelFunctions


  • public class UelFunctions
    extends java.lang.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.
    util:urlExists(String)Returns true if the specified URL exists.
    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.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      protected static class  UelFunctions.Functions  
    • Constructor Summary

      Constructors 
      Constructor Description
      UelFunctions()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String dateString​(java.sql.Timestamp stamp, java.util.TimeZone timeZone, java.util.Locale locale)  
      static java.lang.String dateTimeString​(java.sql.Timestamp stamp, java.util.TimeZone timeZone, java.util.Locale locale)  
      static java.lang.String endString​(java.lang.String str, int index)  
      static boolean endsWith​(java.lang.String str1, java.lang.String str2)  
      static javax.el.FunctionMapper getFunctionMapper()
      Returns a FunctionMapper instance.
      static int getSize​(java.lang.Object obj)  
      static int indexOf​(java.lang.String str1, java.lang.String str2)  
      static java.lang.String label​(java.lang.String ressource, java.lang.String label, java.util.Locale locale)  
      static int lastIndexOf​(java.lang.String str1, java.lang.String str2)  
      static int length​(java.lang.String str1)  
      static java.lang.String localizedDateString​(java.sql.Timestamp stamp, java.util.TimeZone timeZone, java.util.Locale locale)  
      static java.lang.String localizedDateTimeString​(java.sql.Timestamp stamp, java.util.TimeZone timeZone, java.util.Locale locale)  
      static org.w3c.dom.Document readHtmlDocument​(java.lang.String str)  
      static org.w3c.dom.Document readXmlDocument​(java.lang.String str)  
      static java.lang.String replace​(java.lang.String str1, java.lang.String str2, java.lang.String str3)  
      static java.lang.String replaceAll​(java.lang.String str1, java.lang.String str2, java.lang.String str3)  
      static java.lang.String replaceFirst​(java.lang.String str1, java.lang.String str2, java.lang.String str3)  
      static java.lang.String resolveCurrentScreenId​(ScreenRenderer.ScreenStack screenStack)
      Returns the id of the current screen identified on the screen stack
      static void setFunction​(java.lang.String prefix, java.lang.String localName, java.lang.reflect.Method method)
      Add a function to OFBiz's built-in UEL functions.
      static boolean startsWith​(java.lang.String str1, java.lang.String str2)  
      static java.lang.String subString​(java.lang.String str, int beginIndex, int endIndex)  
      static java.lang.String sysGetEnv​(java.lang.String str)  
      static java.lang.String sysGetProp​(java.lang.String str)  
      static java.lang.String timeString​(java.sql.Timestamp stamp, java.util.TimeZone timeZone, java.util.Locale locale)  
      static java.lang.String toHtmlString​(org.w3c.dom.Node node, java.lang.String encoding, boolean indent, int indentAmount)  
      static java.lang.String toLowerCase​(java.lang.String str)  
      static java.lang.String toString​(java.lang.Object obj)  
      static java.lang.String toUpperCase​(java.lang.String str)  
      static java.lang.String toXmlString​(org.w3c.dom.Node node, java.lang.String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount)  
      static java.lang.String trim​(java.lang.String str)  
      static boolean writeXmlDocument​(java.lang.String str, org.w3c.dom.Node node, java.lang.String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • MODULE

        public static final java.lang.String MODULE
    • Constructor Detail

      • UelFunctions

        public UelFunctions()
    • Method Detail

      • getFunctionMapper

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

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

        public static java.lang.String dateString​(java.sql.Timestamp stamp,
                                                  java.util.TimeZone timeZone,
                                                  java.util.Locale locale)
      • localizedDateString

        public static java.lang.String localizedDateString​(java.sql.Timestamp stamp,
                                                           java.util.TimeZone timeZone,
                                                           java.util.Locale locale)
      • dateTimeString

        public static java.lang.String dateTimeString​(java.sql.Timestamp stamp,
                                                      java.util.TimeZone timeZone,
                                                      java.util.Locale locale)
      • localizedDateTimeString

        public static java.lang.String localizedDateTimeString​(java.sql.Timestamp stamp,
                                                               java.util.TimeZone timeZone,
                                                               java.util.Locale locale)
      • timeString

        public static java.lang.String timeString​(java.sql.Timestamp stamp,
                                                  java.util.TimeZone timeZone,
                                                  java.util.Locale locale)
      • getSize

        public static int getSize​(java.lang.Object obj)
      • endsWith

        public static boolean endsWith​(java.lang.String str1,
                                       java.lang.String str2)
      • indexOf

        public static int indexOf​(java.lang.String str1,
                                  java.lang.String str2)
      • lastIndexOf

        public static int lastIndexOf​(java.lang.String str1,
                                      java.lang.String str2)
      • length

        public static int length​(java.lang.String str1)
      • replace

        public static java.lang.String replace​(java.lang.String str1,
                                               java.lang.String str2,
                                               java.lang.String str3)
      • replaceAll

        public static java.lang.String replaceAll​(java.lang.String str1,
                                                  java.lang.String str2,
                                                  java.lang.String str3)
      • replaceFirst

        public static java.lang.String replaceFirst​(java.lang.String str1,
                                                    java.lang.String str2,
                                                    java.lang.String str3)
      • startsWith

        public static boolean startsWith​(java.lang.String str1,
                                         java.lang.String str2)
      • endString

        public static java.lang.String endString​(java.lang.String str,
                                                 int index)
      • subString

        public static java.lang.String subString​(java.lang.String str,
                                                 int beginIndex,
                                                 int endIndex)
      • trim

        public static java.lang.String trim​(java.lang.String str)
      • toLowerCase

        public static java.lang.String toLowerCase​(java.lang.String str)
      • toUpperCase

        public static java.lang.String toUpperCase​(java.lang.String str)
      • toString

        public static java.lang.String toString​(java.lang.Object obj)
      • sysGetEnv

        public static java.lang.String sysGetEnv​(java.lang.String str)
      • sysGetProp

        public static java.lang.String sysGetProp​(java.lang.String str)
      • label

        public static java.lang.String label​(java.lang.String ressource,
                                             java.lang.String label,
                                             java.util.Locale locale)
      • resolveCurrentScreenId

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

        public static org.w3c.dom.Document readHtmlDocument​(java.lang.String str)
      • readXmlDocument

        public static org.w3c.dom.Document readXmlDocument​(java.lang.String str)
      • writeXmlDocument

        public static boolean writeXmlDocument​(java.lang.String str,
                                               org.w3c.dom.Node node,
                                               java.lang.String encoding,
                                               boolean omitXmlDeclaration,
                                               boolean indent,
                                               int indentAmount)
      • toHtmlString

        public static java.lang.String toHtmlString​(org.w3c.dom.Node node,
                                                    java.lang.String encoding,
                                                    boolean indent,
                                                    int indentAmount)
      • toXmlString

        public static java.lang.String toXmlString​(org.w3c.dom.Node node,
                                                   java.lang.String encoding,
                                                   boolean omitXmlDeclaration,
                                                   boolean indent,
                                                   int indentAmount)