Package org.apache.ofbiz.minilang.method
Class MethodContext
- java.lang.Object
-
- org.apache.ofbiz.minilang.method.MethodContext
-
public final class MethodContext extends java.lang.Object
A container for the Mini-language script engine state.
-
-
Constructor Summary
Constructors Constructor Description 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.MethodContext(HttpServletRequest request, HttpServletResponse response, java.lang.ClassLoader loader)
MethodContext(DispatchContext ctx, java.util.Map<java.lang.String,? extends java.lang.Object> context, java.lang.ClassLoader loader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Delegator
getDelegator()
LocalDispatcher
getDispatcher()
<T> T
getEnv(java.lang.String key)
Gets the named value from the environment.<T> T
getEnv(FlexibleMapAccessor<T> fma)
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()
int
getTraceLogLevel()
GenericValue
getUserLogin()
boolean
isTraceOn()
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(java.lang.String key, T value)
Puts the named value in the environment.<T> void
putEnv(FlexibleMapAccessor<T> fma, T value)
void
putParameter(java.lang.String key, java.lang.Object value)
void
putResult(java.lang.String key, java.lang.Object value)
<T> T
removeEnv(java.lang.String key)
Removes the named value from the environment.<T> T
removeEnv(FlexibleMapAccessor<T> fma)
void
setTraceOff()
void
setTraceOn(int logLevel)
void
setUserLogin(GenericValue userLogin, java.lang.String userLoginEnvName)
-
-
-
Field Detail
-
EVENT
public static final int EVENT
- See Also:
- Constant Field Values
-
SERVICE
public static final int SERVICE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MethodContext
public MethodContext(DispatchContext ctx, java.util.Map<java.lang.String,? extends java.lang.Object> context, java.lang.ClassLoader loader)
-
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
-
getDelegator
public Delegator getDelegator()
-
getDispatcher
public LocalDispatcher getDispatcher()
-
getEnv
public <T> T getEnv(FlexibleMapAccessor<T> fma)
-
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.
-
getEnvMap
public java.util.Map<java.lang.String,java.lang.Object> getEnvMap()
-
getLoader
public java.lang.ClassLoader getLoader()
-
getLocale
public java.util.Locale getLocale()
-
getMethodType
public int getMethodType()
-
getParameter
public java.lang.Object getParameter(java.lang.String key)
-
getParameters
public java.util.Map<java.lang.String,java.lang.Object> getParameters()
-
getRequest
public HttpServletRequest getRequest()
-
getResponse
public HttpServletResponse getResponse()
-
getResult
public java.lang.Object getResult(java.lang.String key)
-
getResults
public java.util.Map<java.lang.String,java.lang.Object> getResults()
-
getSecurity
public Security getSecurity()
-
getTimeZone
public java.util.TimeZone getTimeZone()
-
getTraceLogLevel
public int getTraceLogLevel()
-
getUserLogin
public GenericValue getUserLogin()
-
isTraceOn
public boolean isTraceOn()
-
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(FlexibleMapAccessor<T> fma, T value)
-
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)
-
removeEnv
public <T> T removeEnv(FlexibleMapAccessor<T> fma)
-
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.
-
setTraceOff
public void setTraceOff()
-
setTraceOn
public void setTraceOn(int logLevel)
-
setUserLogin
public void setUserLogin(GenericValue userLogin, java.lang.String userLoginEnvName)
-
-