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).
    • Method Detail

      • getCurrentIdentifier

        IMendixIdentifier getCurrentIdentifier()
        Returns the Mendix identifier of the current object.
        Returns:
        the Mendix identifier
      • setExecutionId

        void setExecutionId​(java.lang.String requestId)
      • setExecutionThread

        void setExecutionThread​(java.lang.Thread executionThread)
      • getContextObjects

        java.util.List<IMendixIdentifier> getContextObjects()
        Returns the Mendix identifiers of all objects in the context.
        Returns:
        the object identifiers
      • getVariables

        java.util.Map<java.lang.String,​java.lang.Object> 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

        java.util.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()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • 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 that endTransaction() 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 time startTransaction() is called. If no transaction exists, nothing happens.
      • rollbackTransAction

        @Deprecated
        default void rollbackTransAction()
        Deprecated.
        since version 9.5. Please use rollbackTransaction() instead.
        Rolls back the current transaction for this context (if any). This method will abort the current transaction, regardless of how many times startTransaction() was 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 times startTransaction() was called. If no transaction exists, nothing happens.
      • getExecutionThread

        java.lang.Thread getExecutionThread()
      • getActionStack

        java.util.Stack<ICoreAction<?>> getActionStack()
      • getRequestStartTime

        long getRequestStartTime()
      • getExecutionId

        java.lang.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

        java.util.Map<java.lang.String,​java.lang.Object> 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

        java.util.Optional<com.mendix.m2ee.api.IMxRuntimeRequest> getRuntimeRequest()
        Returns the last incoming run-time request.
        Returns:
        the runtime request, or empty if none exists
      • getRuntimeResponse

        java.util.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