Interface MTModelStore


public interface MTModelStore
Utility methods for models, vertices and edges.
Since:
3.0
  • Method Details

    • addMTModelStoreListener

      void addMTModelStoreListener(MTModelStoreListener l)
      Adds a model store listener that will be notified when a model is added, removed or changed through the store api.
      Parameters:
      l - a MTModelStoreListener
    • removeMTModelStoreListener

      void removeMTModelStoreListener(MTModelStoreListener l)
      Removes a model store listener.
      Parameters:
      l - The MTModelStoreListener to remove.
    • addWorkflowRoleListener

      void addWorkflowRoleListener(WorkflowRoleListener l)
    • removeWorkflowRoleListener

      void removeWorkflowRoleListener(WorkflowRoleListener l)
    • addSubscriberListener

      void addSubscriberListener(SubscriberListener l)
    • removeSubscriberListener

      void removeSubscriberListener(SubscriberListener l)
    • removeBreakdown

      void removeBreakdown(MTModelHeader model, MTEdgeHeader edge)
      Removes the breakdown between the edge and the model if one exists, otherwise nothing happens.
      Parameters:
      model - The model part of the breakdown
      edge - The edge part of the breakdown
    • removeBreakdown

      void removeBreakdown(MTModelHeader model, MTSymbolHeader symbol)
      Removes the breakdown between the symbol and the model if one exists, otherwise nothing happens.
      Parameters:
      model - The model part of the breakdown
      symbol - The symbol part of the breakdown
    • createBreakdown

      void createBreakdown(MTModelHeader model, MTEdgeHeader edge)
      Creates a new breakdown from the edge to the model, if one does not already exist. If it already exists, nothing happens.
      Parameters:
      model - the model to break down to
      edge - the edge to break down from
    • createBreakdown

      void createBreakdown(MTModelHeader model, MTSymbolHeader symbol)
      Creates a new breakdown from the model to the symbol if one does not already exist. If it already exists, nothing happens.
      Parameters:
      model - the model to break down to
      symbol - the edge to break down from
    • findModel

      MTModel findModel(long id) throws MTAccessException
      Finds a model by ID.
      Parameters:
      id - The model ID.
      Returns:
      A model or null if no such model exists.
      Throws:
      MTAccessException
      Since:
      3.0
    • findModels

      List<MTModel> findModels(List<Long> idList) throws MTAccessException
      Finds models from a list of model ID:s. The models will be returned in the same order as the ID list. Models which the current user does not have read access to will be filtered out of the result.
      Parameters:
      idList - The ID:s of models to find.
      Returns:
      A list of models with the ID:s in idList.
      Throws:
      MTAccessException
      Since:
      3.0
    • findModelHeaders

      List<MTModelHeader> findModelHeaders(List<Long> idList) throws MTAccessException
      Finds models in the current repository from a list of model ID:s, as headers. The models will be returned in the same order as the ID list. Models which the current user does not have read access to will be filtered out of the result.
      Parameters:
      idList - The ID:s of models to find.
      Returns:
      A list of models with the ID:s in idList.
      Throws:
      MTAccessException
      Since:
      3.0
    • batchLock

      void batchLock(Collection<? extends MTModelHeader> models) throws MTAccessException, MTRemoteChangeException
      Locks all supplied models and returns normally or locks no model and throws an exception. This is the preferred way to lock multiple models. Looping over a collection of models and invoking MTModelHeader.lock() is discourage since it is not possible to either lock all or none. This method is able to either lock all or none.
      Parameters:
      models - The models to lock.
      Throws:
      MTAccessException - If the current user lacks access rights to one of the supplied models.
      MTRemoteChangeException - If one of the supplied models has been locked by someone else or if one of the supplied models is out of date.
    • findVertices

      List<MTVertex> findVertices(List<Long> idList) throws MTAccessException
      Finds vertices in the current repository from a list of vertex ID:s. The vertices will be returned in the same order as the ID list.
      Parameters:
      idList - The ID:s of vertices to find.
      Returns:
      A list of vertices with the ID:s in idList.
      Throws:
      MTAccessException
      Since:
      3.0
    • findVertexHeaders

      List<MTVertexHeader> findVertexHeaders(List<Long> idList) throws MTAccessException
      Finds vertices in the current repository from a list of vertex ID:s, as headers. The vertices will be returned in the same order as the ID list.
      Parameters:
      idList - The ID:s of vertices to find.
      Returns:
      A list of vertices with the ID:s in idList.
      Throws:
      MTAccessException
      Since:
      3.0
    • findEdge

      MTEdge findEdge(long id)
      Finds an edge given its ID.
      Parameters:
      id - The ID of the edge.
      Returns:
      The edge or null.
    • findEdges

      List<MTEdge> findEdges(List<Long> idList) throws MTAccessException
      Finds edges from a list of edge ID:s. The edges will be returned in the same order as the ID list.
      Parameters:
      idList - The ID:s of edges to find.
      Returns:
      A list of edges with the ID:s in idList.
      Throws:
      MTAccessException
      Since:
      3.0
    • findEdgeHeaders

      List<MTEdgeHeader> findEdgeHeaders(List<Long> idList) throws MTAccessException
      Finds edges from a list of edge ID:s, as headers. The edges will be returned in the same order as the ID list.
      Parameters:
      idList - The ID:s of edges to find.
      Returns:
      A list of edges with the ID:s in idList.
      Throws:
      MTAccessException
      Since:
      3.0
    • findHasBreakdown

      Map<MTModelHeader,Boolean> findHasBreakdown(List<MTModelHeader> headers) throws MTAccessException
      Returns a map describing if a model has breakdowns or not.
      Parameters:
      headers - The headers that should be "checked".
      Returns:
      a map describing if a model has breakdowns or not.
      Throws:
      MTAccessException
    • findModel

      MTModelHeader findModel(String modelUUID, int revision) throws MTAccessException
      Finds a model given its UUID and revision.
      Parameters:
      modelUUID - The UUID of the model.
      revision - The revision for the model.
      Returns:
      The model or null.
      Throws:
      MTAccessException
    • getModelBounds

      Rectangle getModelBounds(Collection<? extends MTVertex> vertices, Collection<? extends MTEdge> edges)
      Returns the bounds of a model.
      Parameters:
      vertices - The vertices in the model.
      edges - The edges in the model.
      Returns:
      The model bounds.
      Since:
      3.0
    • findRevisionLogEntries

      List<MTRevisionLogEntry> findRevisionLogEntries(String modelUUID)
      Finds all entries made in the revision log for a model in the current repository. This includes entries for all revisions made of the model.
      Parameters:
      modelUUID - The UUID of the model.
      Returns:
      All revision log entries for the model.
    • setApprovers

      void setApprovers(Map<? extends MTModelHeader,Set<? extends MTUserHeader>> approvers)
      Sets approvers on models.
      Parameters:
      approvers - A map where the keys are models and the values are their respective sets of approvers.
    • setReviewers

      void setReviewers(Map<? extends MTModelHeader,Set<? extends MTUserHeader>> reviewers)
      Sets reviewers on models.
      Parameters:
      reviewers - A map where the keys are models and the values are their respective sets of reviewers.
    • setMaintainers

      void setMaintainers(Map<? extends MTModelHeader,Set<? extends MTUserHeader>> maintainers)
      Sets maintainers on models.
      Parameters:
      maintainers - A map where the keys are models and the values are their respective sets of maintainers.
    • setSubscribers

      void setSubscribers(Map<? extends MTModelHeader,Set<MTSubscriber>> subscribers)
      Sets subscribers on models.
      Parameters:
      subscribers - A map where the keys are models and the values are their respective sets of subscribers.
    • updateSubscriptions

      void updateSubscriptions(Map<Long,Set<Long>> subscriptions)
      Sets model subscriptions for subscribers in the current repository.
      Parameters:
      subscriptions - A map where the keys are subscriber ID:s and the values are their respective sets of ID:s for models to subscribe to.
    • findAttributes

      Map<MTModel,List<MTAttribute>> findAttributes(Collection<MTModel> models, Collection<? extends MTAttributeTypeHeader> types)
      Finds all attributes for a collection of models.