Class ContextHelper

java.lang.Object
org.apache.ofbiz.common.scripting.ContextHelper

public final class ContextHelper extends Object
A set of ScriptContext convenience methods for scripting engines.
  • Method Details

    • addBinding

      public Object addBinding(String key, Object value)
    • expandString

      public String expandString(String original)
      Expands environment variables delimited with ${}
    • getDelegator

      public Delegator getDelegator()
    • getDispatcher

      public LocalDispatcher getDispatcher()
    • getEnv

      public <T> T getEnv(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 List<String> getErrorMessages()
    • getEnvEntryIterator

      public Iterator<Map.Entry<String,Object>> getEnvEntryIterator()
    • getLocale

      public Locale getLocale()
    • getVisualTheme

      public VisualTheme getVisualTheme()
    • getParameter

      public Object getParameter(String key)
    • getParameters

      public Map<String,Object> getParameters()
    • getRequest

      public HttpServletRequest getRequest()
    • getResponse

      public HttpServletResponse getResponse()
    • getResult

      public Object getResult(String key)
    • getResults

      public Map<String,Object> getResults()
    • getSecurity

      public Security getSecurity()
    • getTimeZone

      public TimeZone getTimeZone()
    • getUserLogin

      public GenericValue getUserLogin()
    • isEvent

      public boolean isEvent()
    • isService

      public boolean isService()
    • putAllEnv

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

      public void putParameter(String key, Object value)
    • removeBinding

      public Object removeBinding(String key)
    • removeEnv

      public <T> T removeEnv(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, String userLoginEnvName)