Interface MTStore


public interface MTStore
Provides an entry point for accessing MT classes, which can be used to query and update data in the modeling tool.
Since:
3.0
  • Method Details

    • getCurrentUser

      MTUser getCurrentUser()
      Returns the currently logged in user or null if no such user can be found, that is, if the end-user is not logged in.
      Returns:
      null or the currently logged in user.
      Since:
      3.0
    • getCurrentPermissionGroup

      MTPermissionGroup getCurrentPermissionGroup()
      Returns the current permission group. This is the permissions that will be initially set on all objects created by the user.
    • setCurrentPermissionGroup

      default void setCurrentPermissionGroup(MTPermissionGroup group)
      Sets the current permission group to work in.
    • getCurrentPermissionGroups

      default Set<MTPermissionGroup> getCurrentPermissionGroups()
      Returns the currently available permission groups.
    • getCurrentRepository

      MTRepository getCurrentRepository()
      Returns the current repository.
      Returns:
      The current repository or null if no workspace is currently opened.
      Since:
      3.0
    • getCurrentWorkspace

      MTWorkspace getCurrentWorkspace()
      Returns the current workspace.
      Returns:
      The current workspace or null if no workspace is currently opened.
      Since:
      3.0
    • getCurrentLanguage

      MTLanguage getCurrentLanguage()
      Returns the current language.
      Returns:
      The current language or null if no workspace is currently opened.
      Since:
      3.0
    • setCurrentLanguage

      void setCurrentLanguage(MTLanguage language)
      Sets the current language.
      Parameters:
      language - The language to switch to.
      Throws:
      IllegalArgumentException - If the language is not one of the languages in the current repository.
    • getLanguage

      MTLanguage getLanguage(String uuid)
      Returns the language with uuid 'uuid'
      Returns:
      The the language with uuid 'uuid' or null if no exists
      Since:
      3.1
    • getCurrentLanguages

      List<MTLanguage> getCurrentLanguages()
      Returns the languages in the current repository.
      Returns:
      The languages in the current repository.
      Since:
      3.0
    • getModelStore

      MTModelStore getModelStore()
      Returns a model store.
      Returns:
      A model store.
      Since:
      3.0
    • getNotificationStore

      MTNotificationStore getNotificationStore()
      Returns a notification store.
      Returns:
      A notification store.
    • getUserStore

      MTUserStore getUserStore()
      Returns a user store.
      Returns:
      A user store.
      Since:
      3.0
    • getDocumentStore

      MTDocumentStore getDocumentStore()
      Returns a document store.
      Returns:
      A document store.
      Since:
      3.0
    • getSymbolStore

      MTSymbolStore getSymbolStore()
      Returns a symbol store.
      Returns:
      A symbol store.
      Since:
      3.0
    • createBatchIterator

      MTIterator createBatchIterator(Class mtClass, List<Long> idList)
      Creates and returns an iterator over a list of MT objects that fetches information from the underlying store in batches as the iterator is traversed. Iterators can be created for the following types: MTDocumentHeader.class MTDocument.class MTDocumentTypeHeader.class MTDocumentType.class MTModelHeader.class MTModel.class MTSymbolHeader.class MTSymbol.class MTVertexHeader.class MTVertex.class
      Parameters:
      mtClass - The MT class to iterate over, e.g. MTModelHeader or MTModel
      idList - The list of ID:s of the objects to iterate through
      Returns:
      An MT batch iterator over the objects with the given ID:s.
    • isLocal

      boolean isLocal()
      Checks if the current connection is a "local" connection. Also returns true if no connection to a repository is currently made.
      Returns:
      false if connected to a remote server, true otherwise.
      Since:
      3.0
    • isRemote

      boolean isRemote()
      Returns true if the current connection is "remote", i.e. connected to a remote repository or in repository manager with an active server connection.
    • isConnected

      boolean isConnected()
      Returns true if we have a connection to any database, i.e. a server connection or connected to a local repository.
      Returns:
      true if connected, otherwise false
    • getServer

      MTServer getServer()
      Returns the current server connection or null if no such connection exists.
      Returns:
      Returns the current server connection or null if not currently connected to a server.
      Since:
      3.1
    • addRepositoryStateListener

      void addRepositoryStateListener(MTRepositoryStateListener l)
    • removeRepositoryStateListener

      void removeRepositoryStateListener(MTRepositoryStateListener l)
    • addLanguageListener

      void addLanguageListener(MTLanguageListener l)
    • removeLanguageListener

      void removeLanguageListener(MTLanguageListener l)
    • addListListener

      void addListListener(MTListListener l)
    • removeListListener

      void removeListListener(MTListListener l)
    • addMTDocumentListener

      void addMTDocumentListener(MTDocumentListener l)
    • removeMTDocumentListener

      void removeMTDocumentListener(MTDocumentListener l)
    • addMTDocumentTypeListener

      void addMTDocumentTypeListener(MTDocumentTypeListener l)
    • removeMTDocumentTypeListener

      void removeMTDocumentTypeListener(MTDocumentTypeListener l)
    • addMTAttributeTypeListener

      void addMTAttributeTypeListener(MTAttributeTypeListener l)
    • removeMTAttributeTypeListener

      void removeMTAttributeTypeListener(MTAttributeTypeListener l)
    • addVariableListener

      void addVariableListener(MTVariableListener l)
    • removeVariableListener

      void removeVariableListener(MTVariableListener l)
    • addSubscriberListener

      void addSubscriberListener(MTSubscriberListener l)
    • removeSubscriberListener

      void removeSubscriberListener(MTSubscriberListener l)
    • findRepository

      MTRepository findRepository(long repositoryID)
      Finds a repository by ID.
    • runUnsafeSQL

      List runUnsafeSQL(String sql)
    • getConnection

      MTConnection getConnection()
      Returns the current connection, if any.
    • getRepositoryConnection

      MTRepositoryConnection getRepositoryConnection()
      Returns the current repository connection. Returns null if not currently connected to a repository.
    • getServerConnection

      MTServerConnection getServerConnection()
      Returns the current repository connection. Returns null if not currently connected to a repository.
    • setDataSourceConnection

      void setDataSourceConnection(MTConnection connection)
      Used when switching between local repositories and servers.
    • service

      @Deprecated <T> T service(Class<T> service)
      Deprecated.
      Not part of the public API.
    • rest

      default <T> T rest(Class<T> service)
    • updateColorScheme

      void updateColorScheme()
    • queueEdits

      default void queueEdits(LinkedHashSet<MTEdit> edits)
      Queues edits that needs to be saved in a single transaction for saving later on the edit queue. For edits that can be saved individually without affecting other edits, use the specific implementation methods instead, e.g. MTVertex.queueSave(), MTSymbol.queueSave().
      Parameters:
      edits - The edits to save in the same transaction.