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) clone()
void
Commits the current transaction for this context (if any).boolean
Stack<CoreAction<?>>
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 the current client execution identifier (if set).long
Optional<com.mendix.m2ee.api.IMxRuntimeRequest>
Returns the last incoming run-time request.Optional<com.mendix.m2ee.api.IMxRuntimeResponse>
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).int
hashCode()
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) void
setExecutionThread
(Thread executionThread) void
setExecutionType
(IContext.ExecutionType executionType) 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
-
setExecutionType
-
setExecutionThread
-
getContextObjects
List<IMendixIdentifier> getContextObjects()Returns the Mendix identifiers of all objects in the context.- Returns:
- the object identifiers
-
getVariables
-
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
-
hashCode
int hashCode() -
equals
-
clone
IContext clone() -
createClone
IContext createClone() -
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
-
getDataValidationList
Collection<DataValidationInfo> getDataValidationList() -
getExecutionThread
Thread getExecutionThread() -
getActionStack
Stack<CoreAction<?>> getActionStack() -
getRequestStartTime
long getRequestStartTime() -
getExecutionType
IContext.ExecutionType getExecutionType() -
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() -
getData
Allows attaching data to the scope of the current request (as in web request). -
getCurrentUserObject
IMendixObject getCurrentUserObject()Return the current user object shared across all cloned contexts. -
getRuntimeRequest
Optional<com.mendix.m2ee.api.IMxRuntimeRequest> getRuntimeRequest()Returns the last incoming run-time request.- Returns:
- the runtime request, or empty if none exists
-
getRuntimeResponse
Optional<com.mendix.m2ee.api.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
-