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 Details

    • getCurrentIdentifier

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

      void setExecutionId(String requestId)
    • setExecutionType

      void setExecutionType(IContext.ExecutionType executionType)
    • setExecutionThread

      void setExecutionThread(Thread executionThread)
    • getContextObjects

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

      Map<String,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

      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 Object
    • equals

      boolean equals(Object obj)
      Overrides:
      equals in class Object
    • 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 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

      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.
    • addDataValidation

      void addDataValidation(DataValidationInfo newDvInfo)
    • 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

      Map<String,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

      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