Interface MTModel

All Superinterfaces:
Comparable<MTNamedObject>, MTDataObject, MTHistoryEnabled, MTModelHeader, MTNamedObject
All Known Subinterfaces:
MTCompleteModel, MTCompleteSwimlaneModel, MTSwimlaneModel

public interface MTModel extends MTModelHeader, MTHistoryEnabled
Full interface for models. A model is the visual representation of for example a business process or an organizational structure. It consists of a collection of vertices and a collection of edges interconnecting these vertices.
Since:
3.0
  • Method Details

    • canUserRead

      boolean canUserRead()
    • canUserWrite

      boolean canUserWrite()
    • getOwner

      MTUserHeader getOwner()
      Returns "access control" owner of this object.
      Returns:
      owner of object
    • setOwner

      void setOwner(MTUserHeader owner)
      Sets "access control" owner of this object.
      Parameters:
      owner - owner of object
    • getSubscribers

      Collection<MTSubscriber> getSubscribers()
      Returns the subscribers of this model.
      Returns:
      The subscribers.
    • setSubscribers

      @Deprecated void setSubscribers(Set<MTSubscriber> subscribers)
      Deprecated.
      This has been replaced by MTModelStore.setSubscribers which can update subscribers on locked revisions of models. This method should only be called to keep the UI up-to-date, the changes will not be persisted when the model is saved.
      Sets the subscribers for this model.
      Parameters:
      subscribers - The new subscribers for this model.
    • getMaintainers

      Collection<MTUserHeader> getMaintainers()
      Returns the users that have permission to maintain this model.
      Returns:
      The maintenance users.
    • setMaintainers

      @Deprecated void setMaintainers(Set<MTUserHeader> users)
      Deprecated.
      This has been replaced by MTModelStore.setMaintainers which can update maintainers on locked revisions of models. This method should only be called to keep the UI up-to-date, the changes will not be persisted when the model is saved.
      Sets the users that have permission to maintain this model.
      Parameters:
      users - The new maintenance users for this model.
    • getApprovers

      Collection<MTUserHeader> getApprovers()
      Returns the users that have permission to approve this model.
      Returns:
      The approvers.
    • setApprovers

      @Deprecated void setApprovers(Set<MTUserHeader> users)
      Deprecated.
      This has been replaced by MTModelStore.setApprovers which can update approvers on locked revisions of models. This method should only be called to keep the UI up-to-date, the changes will not be persisted when the model is saved.
      Sets the users that have permission to approve this model.
      Parameters:
      users - The new approvers for this model.
    • getReviewers

      Collection<MTUserHeader> getReviewers()
      Returns the users that have permission to review this model.
      Returns:
      The reviewers.
    • setReviewers

      @Deprecated void setReviewers(Set<MTUserHeader> users)
      Deprecated.
      This has been replaced by MTModelStore.setReviewers which can update reviewers on locked revisions of models. This method should only be called to keep the UI up-to-date, the changes will not be persisted when the model is saved.
      Sets the users that have permission to review this model.
      Parameters:
      users - The new reviewers for this model.
    • getGroup

      MTPermissionGroup getGroup()
      Returns the "access control" group of this object.
      Returns:
      object group
    • setGroup

      void setGroup(MTPermissionGroup group)
      Set the "access control" group of this object.
      Parameters:
      group - The group.
    • getLastModifiedBy

      MTUserHeader getLastModifiedBy()
      Returns the user that last modified this object.
      Returns:
      the last user that modified this object.
    • setLastModifiedBy

      void setLastModifiedBy(MTUserHeader user)
      Set the last user that modified this object.
      Parameters:
      user - the last user that modified this object.
    • getCreatedBy

      MTUserHeader getCreatedBy()
    • setCreatedBy

      void setCreatedBy(MTUserHeader user)
    • getPermissions

      MTPermissions getPermissions()
      Returns "access control" permissions for this object.
      Returns:
      permissions for object
    • setPermissions

      void setPermissions(MTPermissions permissions)
      Sets "access control" permissions for this object.
      Parameters:
      permissions - permissions for this object
    • setPermissions

      void setPermissions(int permissions)
    • getRemovalHistory

      Map<String,String> getRemovalHistory()
      Returns the "history" of removals made in this model. Each time a vertex or edge is removed from a model the UUID will be stored together with the "history path" at the time of removal. Note: This map will not be automatically updated when remove() is called for vertices and edges, you will have to reload the model to get updated data. This should not be a problem since the main purpose of this data is for use when importing/merging models to the repository.
      Returns:
      A map where the keys are the UUID:s of removed vertices/edges and the values are their "history paths" at the time of removal.
    • addToRemovalHistory

      void addToRemovalHistory(String removedEntityUUID, String historyPath)
      Adds to the models entries for removed entities (vertices and edges). Note: This method should only be used when importing entities, in order to correctly set the removal history for a newly created model. When removing vertices/edges in existing models through the store API these entries will be created automatically.
      Parameters:
      removedEntityUUID - The UUID of the removed vertex/edge.
      historyPath - The history path of the vertex/edge at the time of removal.
    • setLastModified

      void setLastModified(Date date)
      Sets the last modified date for the model. This should only be used to override the date (for example when importing), otherwise it is automatically updated when the model is saved.
      Parameters:
      date - The new last modified date
    • setCreated

      void setCreated(Date date)
      Sets the creation date for the model. This should only be used to override the date (for example when importing), otherwise it is automatically updated when the model is saved.
      Parameters:
      date - The new last modified date
    • getPropertyProviders

      Set<String> getPropertyProviders()
      Returns all providers that have stored properties.
      Returns:
      A set of provider ID:s
      Since:
      3.0
    • getPropertyKeys

      Set<String> getPropertyKeys(String provider)
      Returns the property names of all properties stored by a provider.
      Parameters:
      provider - The provider ID.
      Returns:
      A set of property names.
    • getProperty

      String getProperty(String provider, String name)
      Returns a property value.
      Parameters:
      provider - The ID of the provider that set this property.
      name - The property name.
      Returns:
      The property value or null.
      Since:
      3.0
    • setProperty

      void setProperty(String provider, String name, String value)
      Sets a property value.
      Parameters:
      provider - The ID of the provider setting this property.
      name - The property name.
      value - The new property value. Values longer than 255 characters will be truncated.
      Since:
      3.0
    • removeProperty

      void removeProperty(String provider, String name)
      Removes a property.
      Parameters:
      provider - The ID of the provider setting this property.
      name - The property name.
    • setTranslated

      void setTranslated(MTLanguage lang, boolean translated)
      Marks this symbol as translated in the given language.
      Parameters:
      lang - The language.
      translated - The state to set.
      Since:
      3.1
    • setType

      void setType(ModelType type)
      Sets the type of the model. This will not remove existing data but might prevent access to the data if the new type is not recognized as having that data. This is specifically the case for plugin data. Generally, one should not change the type defined by a certain model extension to a type defined by another model extension.
      Parameters:
      type - The new type of the model
    • getRevisionLog

      List<MTRevisionLogEntry> getRevisionLog()
      Returns the revision log for this revision of the model.
      Returns:
      The revision log.
      Since:
      3.0
    • setReferenceID

      void setReferenceID(String referenceID)
      Sets the reference ID of the model. This is the reference ID used to identify the model for example when creating HTML pages. If no reference ID has been set the UUID will be used.
      Parameters:
      referenceID - referenceID The new reference ID or null to clear the reference ID.
      Since:
      3.1
    • setTitle

      void setTitle(String title)
      Sets the title of the model in the current language.
      Parameters:
      title - The new title.
      Since:
      3.0
    • setTitle

      void setTitle(MTLanguageHeader language, String title)
      Sets the title of the model in a given language.
      Parameters:
      language - The language.
      title - The new title.
      Since:
      3.0
    • setPrefix

      void setPrefix(String prefix)
      Sets a prefix used to identify this model. If used the prefix can be used for filtering/finding models easier.
      Parameters:
      prefix - The prefix to set.
    • setPrefixLocked

      void setPrefixLocked(boolean locked)
      Locks the current prefix so it cannot be modified.
      Parameters:
      locked - True to lock prefix, false to unlock.
    • setWorkflowState

      void setWorkflowState(WorkflowState state)
      Sets the current workflow state.
      Parameters:
      state - The new workflow state for the model.
    • setNotify

      void setNotify(boolean notify)
      Sets whether notifications should be sent in next publication.
      Parameters:
      notify - True to notify, false otherwise.
    • getAttributes

      List<MTAttribute> getAttributes(Predicate<MTAttribute> predicate)
      Returns the attributes connected to the model as a read-only list.
      Parameters:
      predicate - A predicate to filter the resulting list.
      Returns:
      The attributes connected to the model.
      Since:
      5.0
    • getAttribute

      MTAttribute getAttribute(MTAttributeTypeHeader type)
      Returns the attribute of the given type.
      Parameters:
      type - the type of the attribute to return
      Returns:
      the attribute of the given type
      Throws:
      IllegalArgumentException - If the attribute type is not connected to this model's type
      Since:
      5.0
    • addDocument

      void addDocument(MTDocumentHeader document)
      Adds a document to the model.
      Parameters:
      document - The document to add.
      Throws:
      MTAccessException - If an MTAccessException occurs.
      Since:
      3.0
    • removeDocument

      void removeDocument(MTDocumentHeader document)
      Removes a document from the model.
      Parameters:
      document - The document to remove.
      Throws:
      MTAccessException - If an MTAccessException occurs.
      Since:
      3.0
    • connectDocument

      default void connectDocument(Document document)
      Connects a document to a model.
      Parameters:
      document - The document to connect.
    • connectDocument

      default void connectDocument(Document.DocumentID id)
      Connects a document to a model.
      Parameters:
      id - The id of the document to connect.
    • disconnectDocument

      default void disconnectDocument(Document document)
      Disconnects a document from the model.
      Parameters:
      document - The document to disconnect.
    • disconnectDocument

      default void disconnectDocument(Document.DocumentID id)
      Disconnects a document from the model.
      Parameters:
      id - The id of the document to disconnect.
    • save

      Saves changes made to the model. A model can only be saved in the current workspace.
      Throws:
      MTAccessException - If an MTAccessException occurs.
      MTRemoteChangeException - If an MTRemoteChangeException occurs.
      Since:
      3.0
    • hasPluginData

      boolean hasPluginData()
      Returns true if there is plug-in data connected to the entity.
      Returns:
      true if there is plugin data, false otherwise.
    • lockRevision

      MTRevisionOperation lockRevision()
      Prepares for locking the current revision of the model. Calling this method does not actually lock the revision. It checks against storage which objects will be affected and tries to obtain locks on all the affected models and symbols. The returned operation object can be used to actually perform the lock operation.
      Returns:
      A revision operation object that can be used to perform the lock operation assuming that locks could be obtained successfully.
    • changeRevision

      MTRevisionOperation changeRevision()
      Prepares for a change to the current revision of the model, i.e. add a message to the revision log of the current revision. Calling this method does not actually change the revision. It obtains a lock on the model. The returned operation object can be used to actually commit the change to the revision.
      Returns:
      A revision operation object that can be used to perform the change operation assuming that a lock could be obtained successfully.
    • createRevision

      MTRevisionOperation createRevision()
      Prepares for creating a new revision of the model. Calling this method does not actually create the revision. It checks against storage which objects will be affected and tries to obtain locks on all the affected models and symbols. The returned operation object can be used to actually perform the create operation.
      Returns:
      A revision operation object that can be used to perform the create operation assuming that locks could be obtained successfully.
    • revertToRevision

      MTRevisionOperation revertToRevision(MTRevisionInfo rev)
      Prepares for reverting to an earlier revision of the model. If the current revision of this model is open, the data from the earlier revision will be copied to this revision of the model. If the current revision is lost a new revision will be created in the current workspace and the data will be copied to this revision. Note that reverting to a previous revision of a model might cause reverting of the symbols used in the models as well, which might in turn cause new revisions of other models in the workspace using these symbols.
      Parameters:
      rev - The revision to revert to.
      Returns:
      A revision operation object that can be used to perform the revert operation assuming that locks could be obtained successfully.