Class ContextHelper


  • public final class ContextHelper
    extends java.lang.Object
    A set of ScriptContext convenience methods for scripting engines.
    • Field Detail

      • module

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

      • ContextHelper

        public ContextHelper​(javax.script.ScriptContext context)
    • Method Detail

      • addBinding

        public java.lang.Object addBinding​(java.lang.String key,
                                           java.lang.Object value)
      • expandString

        public java.lang.String expandString​(java.lang.String original)
        Expands environment variables delimited with ${}
      • getBindings

        public java.util.Map<java.lang.String,​java.lang.Object> getBindings()
      • getDelegator

        public Delegator getDelegator()
      • getEnv

        public <T> T getEnv​(java.lang.String key)
        Gets the named value from the environment. Supports the "." (dot) syntax to access Map members and the "[]" (bracket) syntax to access List entries. This value is expanded, supporting the insertion of other environment values using the "${}" notation.
        Parameters:
        key - The name of the environment value to get. Can contain "." and "[]" syntax elements as described above.
        Returns:
        The environment value if found, otherwise null.
      • getErrorMessages

        public java.util.List<java.lang.String> getErrorMessages()
      • getEnvEntryIterator

        public java.util.Iterator<java.util.Map.Entry<java.lang.String,​java.lang.Object>> getEnvEntryIterator()
      • getLocale

        public java.util.Locale getLocale()
      • getParameter

        public java.lang.Object getParameter​(java.lang.String key)
      • getParameters

        public java.util.Map<java.lang.String,​java.lang.Object> getParameters()
      • getRequest

        public javax.servlet.http.HttpServletRequest getRequest()
      • getResponse

        public javax.servlet.http.HttpServletResponse getResponse()
      • getResult

        public java.lang.Object getResult​(java.lang.String key)
      • getResults

        public java.util.Map<java.lang.String,​java.lang.Object> getResults()
      • getScriptName

        public java.lang.String getScriptName()
      • getSecurity

        public Security getSecurity()
      • getTimeZone

        public java.util.TimeZone getTimeZone()
      • isEvent

        public boolean isEvent()
      • isService

        public boolean isService()
      • putAllEnv

        public void putAllEnv​(java.util.Map<java.lang.String,​? extends java.lang.Object> values)
        Calls putEnv for each entry in the Map, thus allowing for the additional flexibility in naming supported in that method.
      • putEnv

        public <T> void putEnv​(java.lang.String key,
                               T value)
        Puts the named value in the environment. Supports the "." (dot) syntax to access Map members and the "[]" (bracket) syntax to access List entries. If the brackets for a list are empty the value will be appended to end of the list, otherwise the value will be set in the position of the number in the brackets. If a "+" (plus sign) is included inside the square brackets before the index number the value will inserted/added at that index instead of set at that index. This value is expanded, supporting the insertion of other environment values using the "${}" notation.
        Parameters:
        key - The name of the environment value to get. Can contain "." syntax elements as described above.
        value - The value to set in the named environment location.
      • putParameter

        public void putParameter​(java.lang.String key,
                                 java.lang.Object value)
      • putResult

        public void putResult​(java.lang.String key,
                              java.lang.Object value)
      • putResults

        public void putResults​(java.util.Map<java.lang.String,​java.lang.Object> results)
      • removeBinding

        public java.lang.Object removeBinding​(java.lang.String key)
      • removeEnv

        public <T> T removeEnv​(java.lang.String key)
        Removes the named value from the environment. Supports the "." (dot) syntax to access Map members and the "[]" (bracket) syntax to access List entries. This value is expanded, supporting the insertion of other environment values using the "${}" notation.
        Parameters:
        key - The name of the environment value to get. Can contain "." syntax elements as described above.
      • setUserLogin

        public void setUserLogin​(GenericValue userLogin,
                                 java.lang.String userLoginEnvName)