Interface MTPluginData


public interface MTPluginData
Plug-in specific data.
Since:
3.1
  • Method Details

    • getID

      long getID()
      Returns the unique ID of the plug-in data.
      Returns:
      The unique ID.
      Since:
      3.1
    • getProviderUUID

      String getProviderUUID()
      Returns the data provider.
    • isRoot

      boolean isRoot()
      Returns true if this data entry is a root entry. A root entry is an entry that is directly connected to the model, symbol or document.
      Returns:
      true if root entity
    • isPersisted

      boolean isPersisted()
      Returns true if this plugin-data is saved in storage.
      Returns:
      true if the plugin-data is saved in storage.
      Since:
      3.3
    • getUUID

      String getUUID()
      Returns the Universally Unique Identifier (UUID) for this plug-in data.
      Returns:
      The UUID.
      Since:
      3.1
    • setUUID

      void setUUID(String uuid)
      Sets the UUID of the plug-in data.
      Parameters:
      uuid - The new UUID.
      Since:
      3.3
    • getKey

      String getKey()
      Returns the key that this data is stored under.
      Returns:
      The key.
      Since:
      3.1
    • setKey

      void setKey(String key)
      Sets the key that this data is stored under.
      Parameters:
      key - The new key.
      Since:
      3.1
    • getBinaryContent

      byte[] getBinaryContent()
      Returns the stored binary content.
      Returns:
      The binary content.
      Since:
      3.1
    • getTextContent

      String getTextContent()
      Returns the stored text content.
      Returns:
      The text content.
      Since:
      3.1
    • setBinaryContent

      void setBinaryContent(byte[] content)
      Sets the binary content.
      Parameters:
      content - The new binary content
      Since:
      3.1
    • setTextContent

      void setTextContent(String content)
      Sets the text content.
      Parameters:
      content - The new text content
      Since:
      3.1
    • addRelation

      void addRelation(String relationType, MTPluginData related, boolean strong)
      Adds a relation from this data to another plug-in data. The related data will be returned as part of the result when findRelations() is called for the same relation type. The relation will be saved when this plug-in data is saved.
      Parameters:
      relationType - The relation type.
      related - The related plug-in data.
      strong - If true, when this entity is removed, the related entity will be removed as well.
      Since:
      3.1
    • addRelations

      void addRelations(String relationType, Collection<MTPluginData> related, boolean strong)
      Adds a relation from this data to other plug-in data. The related data will be returned as part of the result when findRelations() is called for the same relation type. The relations will be saved when this plug-in data is saved.
      Parameters:
      relationType - The relation type.
      related - The related plug-in data.
      strong - If true, when these entities are removed, the related entity will be removed as well.
      Since:
      3.1
    • setRelationOrder

      void setRelationOrder(String relationType, List<MTPluginData> newOrder)
      Updates the order of related entities. By default related entities are ordered in insertion order, i.e. when addRelation() is called. To reorder the related entities pass in a list with the related entities in the new desired order.
      Parameters:
      relationType - The relation type.
      newOrder - The related entities, in the new desired order.
    • removeRelation

      void removeRelation(String relationType, MTPluginData related)
      Removes a relation from this data to another plug-in data. The relation will be removed when this plug-in data is saved.
      Parameters:
      relationType - The relation type.
      related - The related plug-in data.
      Since:
      3.1
    • removeRelations

      void removeRelations(String relationType, Collection<MTPluginData> related)
      Removes relations from this data to other plug-in data. The relations will be removed when this plug-in data is saved.
      Parameters:
      relationType - The relation type.
      related - The related plug-in data.
      Since:
      3.1
    • save

      Saves new plug-in data or saves changes to existing plug-in data.
      Throws:
      MTAccessException
      MTRemoteChangeException
      Since:
      3.1
    • remove

      void remove() throws MTRemoteChangeException
      Removes this plug-in data. This will also remove the entire graph of strongly related plug-in data. If this is not the desired behaviour then remove these relations first and call save() before calling remove().
      Throws:
      MTAccessException
      MTRemoteChangeException
      Since:
      3.1
    • findRelations

      List<MTPluginData> findRelations(String relationType) throws MTAccessException
      Finds related plug-in data.
      Parameters:
      relationType - The relation type.
      Throws:
      MTAccessException
      Since:
      3.1
    • findRelationIDs

      List<Long> findRelationIDs(String relationType) throws MTAccessException
      Finds the ID:s for related plug-in data.
      Parameters:
      relationType - The relation type.
      Throws:
      MTAccessException
      Since:
      3.2
    • reload

      MTPluginData reload()
      Reloads the plugin data from storage and returns a new reference containing the latest data.
      Returns:
      For a persisted plugin-data, a new reference containing the latest data from storage. For a new, non-persisted plugin-data this is a no-op and the same reference is returned.
    • createPluginData

      MTPluginData createPluginData(String key)
      Creates a new plug-in data with the same provider and the same root entity (model, symbol or document) as the current data.
      Parameters:
      key - The key to store the data under.
      Returns:
      A new plug-in data.
      Since:
      3.1