Class ContextHelper
java.lang.Object
org.apache.ofbiz.common.scripting.ContextHelper
A set of
ScriptContext
convenience methods for scripting engines.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddBinding
(String key, Object value) expandString
(String original) Expands environment variables delimited with ${}<T> T
Gets the named value from the environment.<T> T
getEnv
(FlexibleMapAccessor<T> fma) getParameter
(String key) boolean
isEvent()
boolean
void
Calls putEnv for each entry in the Map, thus allowing for the additional flexibility in naming supported in that method.<T> void
Puts the named value in the environment.<T> void
putEnv
(FlexibleMapAccessor<T> fma, T value) void
putParameter
(String key, Object value) void
void
putResults
(Map<String, Object> results) removeBinding
(String key) <T> T
Removes the named value from the environment.<T> T
removeEnv
(FlexibleMapAccessor<T> fma) void
setUserLogin
(GenericValue userLogin, String userLoginEnvName)
-
Constructor Details
-
ContextHelper
-
-
Method Details
-
addBinding
-
expandString
Expands environment variables delimited with ${} -
getBindings
-
getDelegator
-
getDispatcher
-
getEnv
-
getEnv
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
-
getEnvEntryIterator
-
getLocale
-
getVisualTheme
-
getParameter
-
getParameters
-
getRequest
-
getResponse
-
getResult
-
getResults
-
getScriptName
-
getSecurity
-
getTimeZone
-
getUserLogin
-
isEvent
public boolean isEvent() -
isService
public boolean isService() -
putAllEnv
Calls putEnv for each entry in the Map, thus allowing for the additional flexibility in naming supported in that method. -
putEnv
-
putEnv
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
-
putResult
-
putResults
-
removeBinding
-
removeEnv
-
removeEnv
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
-