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

      @Deprecated void setExecutionId(String requestId)
      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 void setExecutionType(IContext.ExecutionType executionType)
      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 void setExecutionThread(Thread executionThread)
      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

      Map<String,Object> 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. Use createClone() instead.
      Returns a deep copy of this context. Do not use, but use createClone() 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 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)
      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

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