Package se.conciliate.extensions.store
Interface MTPluginData
public interface MTPluginData
Plug-in specific data.
- Since:
- 3.1
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addRelation
(String relationType, MTPluginData related, boolean strong) Adds a relation from this data to another plug-in data.void
addRelations
(String relationType, Collection<MTPluginData> related, boolean strong) Adds a relation from this data to other plug-in data.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.findRelationIDs
(String relationType) Finds the ID:s for related plug-in data.findRelations
(String relationType) Finds related plug-in data.byte[]
Returns the stored binary content.long
getID()
Returns the unique ID of the plug-in data.getKey()
Returns the key that this data is stored under.Returns the data provider.Returns the stored text content.getUUID()
Returns the Universally Unique Identifier (UUID) for this plug-in data.boolean
Returns true if this plugin-data is saved in storage.boolean
isRoot()
Returns true if this data entry is a root entry.reload()
Reloads the plugin data from storage and returns a new reference containing the latest data.void
remove()
Removes this plug-in data.void
removeRelation
(String relationType, MTPluginData related) Removes a relation from this data to another plug-in data.void
removeRelations
(String relationType, Collection<MTPluginData> related) Removes relations from this data to other plug-in data.void
save()
Saves new plug-in data or saves changes to existing plug-in data.void
setBinaryContent
(byte[] content) Sets the binary content.void
Sets the key that this data is stored under.void
setRelationOrder
(String relationType, List<MTPluginData> newOrder) Updates the order of related entities.void
setTextContent
(String content) Sets the text content.void
Sets the UUID of the plug-in data.
-
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
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
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
Sets the text content.- Parameters:
content
- The new text content- Since:
- 3.1
-
addRelation
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
- Iftrue
, when this entity is removed, the related entity will be removed as well.- Since:
- 3.1
-
addRelations
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
- Iftrue
, when these entities are removed, the related entity will be removed as well.- Since:
- 3.1
-
setRelationOrder
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
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
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
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
Finds related plug-in data.- Parameters:
relationType
- The relation type.- Throws:
MTAccessException
- Since:
- 3.1
-
findRelationIDs
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
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
-