org.ofbiz.minilang.method
Class MethodContext

java.lang.Object
  extended by org.ofbiz.minilang.method.MethodContext
All Implemented Interfaces:
java.lang.Iterable<java.util.Map.Entry<java.lang.String,java.lang.Object>>

public class MethodContext
extends java.lang.Object
implements java.lang.Iterable<java.util.Map.Entry<java.lang.String,java.lang.Object>>

A single operation, does the specified operation on the given field


Field Summary
protected  DispatchContext ctx
           
protected  GenericDelegator delegator
           
protected  LocalDispatcher dispatcher
           
protected  java.util.Map<java.lang.String,java.lang.Object> env
           
static int EVENT
           
protected  java.lang.ClassLoader loader
           
protected  java.util.Locale locale
           
protected  int methodType
           
protected  java.util.Map<java.lang.String,java.lang.Object> parameters
           
protected  HttpServletRequest request
           
protected  HttpServletResponse response
           
protected  java.util.Map<java.lang.String,java.lang.Object> results
           
protected  Security security
           
static int SERVICE
           
protected  java.util.TimeZone timeZone
           
protected  GenericValue userLogin
           
 
Constructor Summary
MethodContext(HttpServletRequest request, HttpServletResponse response, java.lang.ClassLoader loader)
           
MethodContext(java.util.Map<java.lang.String,? extends java.lang.Object> context, java.lang.ClassLoader loader, int methodType)
          This is a very simple constructor which assumes the needed objects (dispatcher, delegator, security, request, response, etc) are in the context.
 
Method Summary
 java.lang.String expandString(FlexibleStringExpander originalExdr)
           
 java.lang.String expandString(java.lang.String original)
          Expands environment variables delimited with ${}
 GenericDelegator getDelegator()
           
 LocalDispatcher getDispatcher()
           
<T> T
getEnv(FlexibleMapAccessor<T> fma)
           
<T> T
getEnv(java.lang.String key)
          Gets the named value from the environment.
 java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.Object>> getEnvEntryIterator()
           
 java.util.Map<java.lang.String,java.lang.Object> getEnvMap()
           
 java.lang.ClassLoader getLoader()
           
 java.util.Locale getLocale()
           
 int getMethodType()
           
 java.lang.Object getParameter(java.lang.String key)
           
 java.util.Map<java.lang.String,java.lang.Object> getParameters()
           
 HttpServletRequest getRequest()
           
 HttpServletResponse getResponse()
           
 java.lang.Object getResult(java.lang.String key)
           
 java.util.Map<java.lang.String,java.lang.Object> getResults()
           
 Security getSecurity()
           
 java.util.TimeZone getTimeZone()
           
 GenericValue getUserLogin()
           
 java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.Object>> iterator()
           
 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.
<T> void
putEnv(FlexibleMapAccessor<T> fma, T value)
           
<T> void
putEnv(java.lang.String key, T value)
          Puts the named value in the environment.
 void putParameter(java.lang.String key, java.lang.Object value)
           
 void putResult(java.lang.String key, java.lang.Object value)
           
<T> T
removeEnv(FlexibleMapAccessor<T> fma)
           
<T> T
removeEnv(java.lang.String key)
          Removes the named value from the environment.
 void setErrorReturn(java.lang.String errMsg, SimpleMethod simpleMethod)
           
 void setUserLogin(GenericValue userLogin, java.lang.String userLoginEnvName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EVENT

public static final int EVENT
See Also:
Constant Field Values

SERVICE

public static final int SERVICE
See Also:
Constant Field Values

methodType

protected int methodType

env

protected java.util.Map<java.lang.String,java.lang.Object> env

parameters

protected java.util.Map<java.lang.String,java.lang.Object> parameters

locale

protected java.util.Locale locale

timeZone

protected java.util.TimeZone timeZone

loader

protected java.lang.ClassLoader loader

dispatcher

protected LocalDispatcher dispatcher

delegator

protected GenericDelegator delegator

security

protected Security security

userLogin

protected GenericValue userLogin

request

protected HttpServletRequest request

response

protected HttpServletResponse response

results

protected java.util.Map<java.lang.String,java.lang.Object> results

ctx

protected DispatchContext ctx
Constructor Detail

MethodContext

public MethodContext(HttpServletRequest request,
                     HttpServletResponse response,
                     java.lang.ClassLoader loader)

MethodContext

public MethodContext(java.util.Map<java.lang.String,? extends java.lang.Object> context,
                     java.lang.ClassLoader loader,
                     int methodType)
This is a very simple constructor which assumes the needed objects (dispatcher, delegator, security, request, response, etc) are in the context. Will result in calling method as a service or event, as specified.

Method Detail

setErrorReturn

public void setErrorReturn(java.lang.String errMsg,
                           SimpleMethod simpleMethod)

getMethodType

public int getMethodType()

getEnvMap

public java.util.Map<java.lang.String,java.lang.Object> getEnvMap()

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.

getEnv

public <T> T getEnv(FlexibleMapAccessor<T> fma)

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.

putEnv

public <T> void putEnv(FlexibleMapAccessor<T> fma,
                       T value)

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.


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.

removeEnv

public <T> T removeEnv(FlexibleMapAccessor<T> fma)

iterator

public java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.Object>> iterator()
Specified by:
iterator in interface java.lang.Iterable<java.util.Map.Entry<java.lang.String,java.lang.Object>>

getEnvEntryIterator

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

getParameter

public java.lang.Object getParameter(java.lang.String key)

putParameter

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

getParameters

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

getLoader

public java.lang.ClassLoader getLoader()

getLocale

public java.util.Locale getLocale()

getTimeZone

public java.util.TimeZone getTimeZone()

getDispatcher

public LocalDispatcher getDispatcher()

getDelegator

public GenericDelegator getDelegator()

getSecurity

public Security getSecurity()

getRequest

public HttpServletRequest getRequest()

getResponse

public HttpServletResponse getResponse()

getUserLogin

public GenericValue getUserLogin()

setUserLogin

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

getResult

public java.lang.Object getResult(java.lang.String key)

putResult

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

getResults

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

expandString

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


expandString

public java.lang.String expandString(FlexibleStringExpander originalExdr)