Package se.conciliate.extensions.store
Interface MTModelStore
public interface MTModelStore
Utility methods for models, vertices and edges.
- Since:
- 3.0
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a model store listener that will be notified when a model is added, removed or changed through the store api.void
void
void
batchLock
(Collection<? extends MTModelHeader> models) Locks all supplied models and returns normally or locks no model and throws an exception.void
createBreakdown
(MTModelHeader model, MTEdgeHeader edge) Creates a new breakdown from the edge to the model, if one does not already exist.void
createBreakdown
(MTModelHeader model, MTSymbolHeader symbol) Creates a new breakdown from the model to the symbol if one does not already exist.findAttributes
(Collection<MTModel> models, Collection<? extends MTAttributeTypeHeader> types) Finds all attributes for a collection of models.findEdge
(long id) Finds an edge given its ID.findEdgeHeaders
(List<Long> idList) Finds edges from a list of edge ID:s, as headers.Finds edges from a list of edge ID:s.findHasBreakdown
(List<MTModelHeader> headers) Returns a map describing if a model has breakdowns or not.findModel
(long id) Finds a model by ID.Finds a model given its UUID and revision.findModelHeaders
(List<Long> idList) Finds models in the current repository from a list of model ID:s, as headers.findModels
(List<Long> idList) Finds models from a list of model ID:s.findRevisionLogEntries
(String modelUUID) Finds all entries made in the revision log for a model in the current repository.findVertexHeaders
(List<Long> idList) Finds vertices in the current repository from a list of vertex ID:s, as headers.findVertices
(List<Long> idList) Finds vertices in the current repository from a list of vertex ID:s.getModelBounds
(Collection<? extends MTVertex> vertices, Collection<? extends MTEdge> edges) Returns the bounds of a model.void
removeBreakdown
(MTModelHeader model, MTEdgeHeader edge) Removes the breakdown between the edge and the model if one exists, otherwise nothing happens.void
removeBreakdown
(MTModelHeader model, MTSymbolHeader symbol) Removes the breakdown between the symbol and the model if one exists, otherwise nothing happens.void
Removes a model store listener.void
void
void
setApprovers
(Map<? extends MTModelHeader, Set<? extends MTUserHeader>> approvers) Sets approvers on models.void
setMaintainers
(Map<? extends MTModelHeader, Set<? extends MTUserHeader>> maintainers) Sets maintainers on models.void
setReviewers
(Map<? extends MTModelHeader, Set<? extends MTUserHeader>> reviewers) Sets reviewers on models.void
setSubscribers
(Map<? extends MTModelHeader, Set<MTSubscriber>> subscribers) Sets subscribers on models.void
updateSubscriptions
(Map<Long, Set<Long>> subscriptions) Sets model subscriptions for subscribers in the current repository.
-
Method Details
-
addMTModelStoreListener
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
Removes a model store listener.- Parameters:
l
- The MTModelStoreListener to remove.
-
addWorkflowRoleListener
-
removeWorkflowRoleListener
-
addSubscriberListener
-
removeSubscriberListener
-
removeBreakdown
Removes the breakdown between the edge and the model if one exists, otherwise nothing happens.- Parameters:
model
- The model part of the breakdownedge
- The edge part of the breakdown
-
removeBreakdown
Removes the breakdown between the symbol and the model if one exists, otherwise nothing happens.- Parameters:
model
- The model part of the breakdownsymbol
- The symbol part of the breakdown
-
createBreakdown
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 toedge
- the edge to break down from
-
createBreakdown
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 tosymbol
- the edge to break down from
-
findModel
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
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
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 invokingMTModelHeader.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
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
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
Finds an edge given its ID.- Parameters:
id
- The ID of the edge.- Returns:
- The edge or
null
.
-
findEdges
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
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
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
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
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
Sets approvers on models.- Parameters:
approvers
- A map where the keys are models and the values are their respective sets of approvers.
-
setReviewers
Sets reviewers on models.- Parameters:
reviewers
- A map where the keys are models and the values are their respective sets of reviewers.
-
setMaintainers
Sets maintainers on models.- Parameters:
maintainers
- A map where the keys are models and the values are their respective sets of maintainers.
-
setSubscribers
Sets subscribers on models.- Parameters:
subscribers
- A map where the keys are models and the values are their respective sets of subscribers.
-
updateSubscriptions
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.
-