Interface IContext
public interface IContext
Defines the context interface. The context defines the following aspects of requests:
- Which session the request belongs to.
- Which user executes the request and what roles that user has.
- What data is available during the request.
- Security: which attributes and associations are readable.
- Security: which attributes and associations are writable.
- How transactions are handled.
- How data is internationalized (=localized).
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
Defines the available types of request execution. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDataValidation
(DataValidationInfo newDvInfo) Add validation feedback to this context.clone()
Deprecated.since 9.24.Returns a deep copy of this context.Returns a deep copy of this context without any access control.void
Commits the current transaction for this context (if any).Stack
<ICoreAction<?>> Returns the stack for the action that is currently executing in this stack.Returns the Mendix identifiers of all objects in the context.Returns the Mendix identifier of the current object.Return the current user object shared across all cloned contexts.getData()
Allows attaching data to the scope of the current request (as in web request).Returns all validation feedback of this context.Returns the current client execution identifier (if set).Returns the thread that is executing in this context.Returns the execution type of context.long
Returns the timestamp (in milliseconds since the Unix epoch) of the request that started this context.Returns the last incoming run-time request.Returns the last outgoing run-time response.Returns the session for this context.Returns the configuration of the Mendix runtime.The identifier of the current transaction (if any).Returns the variables that are set in this context.boolean
Returns whether a transaction exists, or not.boolean
isSudo()
Returns whether this context executes without access restrictions.void
Rolls back the current transaction for this context (if any).void
setExecutionId
(String requestId) Deprecated.since 9.23.void
setExecutionThread
(Thread executionThread) Deprecated.since 9.23.void
setExecutionType
(IContext.ExecutionType executionType) Deprecated.since 9.23.void
Starts a new transaction for this context.
-
Method Details
-
getCurrentIdentifier
IMendixIdentifier getCurrentIdentifier()Returns the Mendix identifier of the current object.- Returns:
- the Mendix identifier
-
setExecutionId
Deprecated.since 9.23. This method was exposed for internal purposes. There is no replacement.Sets the execution ID of this context. This method is internal and should not be used.- Parameters:
requestId
- the execution ID to set
-
setExecutionType
Deprecated.since 9.23. This method was exposed for internal purposes. There is no replacement.Sets the execution type of this context. This method is internal and should not be used.- Parameters:
executionType
- the execution type to set
-
setExecutionThread
Deprecated.since 9.23. This method was exposed for internal purposes. There is no replacement.Sets the executing thread type of this context. This method is internal and should not be used.- Parameters:
executionThread
- the thread that is executing in this context
-
getContextObjects
List<IMendixIdentifier> getContextObjects()Returns the Mendix identifiers of all objects in the context.- Returns:
- the object identifiers
-
getVariables
Returns the variables that are set in this context.- Returns:
- the context variables
-
getSession
ISession getSession()Returns the session for this context.- Returns:
- the session
-
isInTransaction
boolean isInTransaction()Returns whether a transaction exists, or not.- Returns:
- true if a transaction exists, false otherwise
-
getTransactionId
UUID getTransactionId()The identifier of the current transaction (if any). If one exists, all actions are executed within it.- Returns:
- the transaction identifier if one exists, null otherwise
-
clone
Deprecated.since 9.24. UsecreateClone()
instead.Returns a deep copy of this context. Do not use, but usecreateClone()
instead.- Returns:
- the cloned context
-
createClone
IContext createClone()Returns a deep copy of this context.- Returns:
- the cloned context
-
isSudo
boolean isSudo()Returns whether this context executes without access restrictions.- Returns:
- false if access restrictions apply, false otherwise
-
startTransaction
void startTransaction()Starts a new transaction for this context. If a transaction already exists for this context, a new savepoint is added. Note thatendTransaction()
must be called an equal amount of times to properly end the transaction. -
endTransaction
void endTransaction()Commits the current transaction for this context (if any). This will end this transaction or remove the last save point. This method must be called for each timestartTransaction()
is called. If no transaction exists, nothing happens. -
rollbackTransaction
void rollbackTransaction()Rolls back the current transaction for this context (if any). This method will abort the current transaction, regardless of how many timesstartTransaction()
was called. If no transaction exists, nothing happens. -
addDataValidation
Add validation feedback to this context.- Parameters:
newDvInfo
- the validation feedback to add
-
getDataValidationList
Collection<DataValidationInfo> getDataValidationList()Returns all validation feedback of this context.- Returns:
- all validation feedback
-
getExecutionThread
Thread getExecutionThread()Returns the thread that is executing in this context.- Returns:
- the executing thread
-
getActionStack
Stack<ICoreAction<?>> getActionStack()Returns the stack for the action that is currently executing in this stack. If no action is executing an empty stack is returned.- Returns:
- the action stack
-
getRequestStartTime
long getRequestStartTime()Returns the timestamp (in milliseconds since the Unix epoch) of the request that started this context.- Returns:
- the timestamp
-
getExecutionType
IContext.ExecutionType getExecutionType()Returns the execution type of context.- Returns:
- the execution type
-
getExecutionId
String getExecutionId()Returns the current client execution identifier (if set). This is an identifier that is unique within this context.- Returns:
- the client execution identifier
-
createSudoClone
IContext createSudoClone()Returns a deep copy of this context without any access control.- Returns:
- the cloned context
-
getData
Allows attaching data to the scope of the current request (as in web request).- Returns:
- the data attached to this context
-
getCurrentUserObject
IMendixObject getCurrentUserObject()Return the current user object shared across all cloned contexts.- Returns:
- the current user object
-
getRuntimeRequest
Optional<IMxRuntimeRequest> getRuntimeRequest()Returns the last incoming run-time request.- Returns:
- the runtime request, or empty if none exists
-
getRuntimeResponse
Optional<IMxRuntimeResponse> getRuntimeResponse()Returns the last outgoing run-time response.- Returns:
- the runtime response, or empty if none exists
-
getSystemConfiguration
Configuration getSystemConfiguration()Returns the configuration of the Mendix runtime.- Returns:
- the mendix runtime configuration
-