Interface definition for object used throughout the Moqui Framework to manage contextual execution information and tool interfaces. One instance of this object will exist for each thread running code and will be applicable for that thread only.
| Type | Name and description |
|---|---|
void |
destroy()This should be called when the ExecutionContext won't be used any more. |
ArtifactExecutionFacade |
getArtifactExecution()For information about artifacts as they are being executed. |
CacheFacade |
getCache()For managing and accessing caches. |
org.moqui.util.ContextStack |
getContext()Returns a Map that represents the current local variable space (context) in whatever is being run. |
org.moqui.util.ContextBinding |
getContextBinding() |
java.util.Map<java.lang.String, java.lang.Object> |
getContextRoot()Returns a Map that represents the global/root variable space (context), ie the bottom of the context stack. |
EntityFacade |
getEntity()For interactions with a relational database. |
ExecutionContextFactory |
getFactory()Get the ExecutionContextFactory this came from. |
L10nFacade |
getL10n()For localization (l10n) functionality, like localizing messages. |
LoggerFacade |
getLogger()For trace, error, etc logging to the console, files, etc. |
MessageFacade |
getMessage()For user messages including general feedback, errors, and field-specific validation errors. |
java.util.List<NotificationMessage> |
getNotificationMessages(java.lang.String topic) |
ResourceFacade |
getResource()For accessing resources by location string (http://, jar://, component://, content://, classpath://, etc). |
ScreenFacade |
getScreen()For rendering screens for general use (mostly for things other than web pages or web page snippets). |
ServiceFacade |
getService()For calling services (local or remote, sync or async or scheduled). |
V |
getTool(java.lang.String toolName, java.lang.Class<V> instanceClass, java.lang.Object... parameters)Get an instance object from the named ToolFactory instance (loaded by configuration). |
TransactionFacade |
getTransaction()For transaction operations use this facade instead of the JTA UserTransaction and TransactionManager. |
UserFacade |
getUser()For information about the user and user preferences (including locale, time zone, currency, etc). |
WebFacade |
getWeb()If running through a web (HTTP servlet) request offers access to the various web objects/information. |
void |
initWebFacade(java.lang.String webappMoquiName, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)This should be called by a filter or servlet at the beginning of an HTTP request to initialize a web facade for the current thread. |
NotificationMessage |
makeNotificationMessage() |
void |
runAsync(groovy.lang.Closure closure)A lightweight asynchronous executor. |
This should be called when the ExecutionContext won't be used any more. Implementations should make sure any active transactions, database connections, etc are closed.
For information about artifacts as they are being executed.
For managing and accessing caches.
Returns a Map that represents the current local variable space (context) in whatever is being run.
Returns a Map that represents the global/root variable space (context), ie the bottom of the context stack.
For interactions with a relational database.
Get the ExecutionContextFactory this came from.
For localization (l10n) functionality, like localizing messages.
For trace, error, etc logging to the console, files, etc.
For user messages including general feedback, errors, and field-specific validation errors.
For accessing resources by location string (http://, jar://, component://, content://, classpath://, etc).
For rendering screens for general use (mostly for things other than web pages or web page snippets).
For calling services (local or remote, sync or async or scheduled).
Get an instance object from the named ToolFactory instance (loaded by configuration). Some tools return a singleton instance, others a new instance each time it is used and that instance is saved with this ExecutionContext to be reused. The instanceClass may be null in scripts or other contexts where static typing is not needed
For transaction operations use this facade instead of the JTA UserTransaction and TransactionManager. See javadoc comments there for examples of code usage.
For information about the user and user preferences (including locale, time zone, currency, etc).
If running through a web (HTTP servlet) request offers access to the various web objects/information. If not running in a web context will return null.
This should be called by a filter or servlet at the beginning of an HTTP request to initialize a web facade for the current thread.
A lightweight asynchronous executor. An alternative to Quartz, still ExecutionContext aware and preserves user from current EC. Runs closure in a worker thread with a new ExecutionContext.