public interface IModelingSession
The current modeling session can be accessed using the following API:
IModelingSession session = Modelio.getInstance().getModelingSession();
The IModelingSession
interface groups the following features:
Modifier and Type | Method and Description |
---|---|
void |
addModelHandler(IModelChangeHandler handler)
Add a model change listener.
|
void |
addModelListener(IModelChangeListener listener)
Add a model change handler.
|
void |
addStatusHandler(IStatusChangeHandler handler)
Add a status change listener.
|
void |
addStatusListener(IStatusChangeListener listener)
Add a status handler.
|
boolean |
audit(ITransaction transaction)
Launch the audit on the given transaction.
|
void |
commit(ITransaction transaction)
Commit a created transaction.
|
ITransaction |
createTransaction(String transactionName)
Create a new transaction in the project.
|
List<IElement> |
findByAtt(Class<? extends IElement> metaclass,
String att,
String value)
Get an element in the model from its metaclass, a meta attribute name and value .
|
List<IElement> |
findByClass(Class<? extends IElement> metaclass)
Get all elements in the model from their metaclass.
|
IElement |
findByRef(ObRef ref)
Get an element in the model from its ObRef.
|
IElement |
findElementById(String metaclass,
String id)
Get an element in the model from its id and metaclass.
|
IElementStatus |
getElementStatus(IElement element)
Deprecated.
|
IMetamodelExtensions |
getMetamodelExtensions()
Returns the metamodel extension of the project.
|
IUmlModel |
getModel()
Returns the UML Model of the project.
|
String |
getName()
Get the name of this session.
|
IAnalystModel |
getRequirementModel()
Returns the Requirement Model of the project.
|
void |
removeModelHandler(IModelChangeHandler handler)
Remove a model change handler.
|
void |
removeModelListener(IModelChangeListener listener)
Remove a model change listener.
|
void |
removeStatusHandler(IStatusChangeHandler handler)
Remove a status change handler.
|
void |
removeStatusListener(IStatusChangeListener listener)
Remove a status change listener.
|
void |
rollback(ITransaction transaction)
Rollback a created transaction.
|
void addModelHandler(IModelChangeHandler handler)
Handlers can modify the model.
This model listener is used to be notified of the model structural changes, through the use of the
IModelChangeHandler
listener class.
handler
- the model change listener to add.void addModelListener(IModelChangeListener listener)
Added listeners must not modify the model. If model modifications should be done use addModelHandler() method.
This model listener is used to be notified of the model structural changes, through the use of the
IModelChangeListener
listener class.
listener
- the model change listener to add.void addStatusHandler(IStatusChangeHandler handler)
Handlers can modify the model.
This model listener is used to be notified of the model status changes (read/write), through the use of the
IStatusChangeHandler
listener class.
handler
- the model change listener to add.void addStatusListener(IStatusChangeListener listener)
Added listeners must not modify the model. If model modifications should be done use addModelHandler() method.
This model listener is used to be notified of all the model status changes (read/write), through the use of the
IStatusChangeListener
listener class.
listener
- the model change listener to add.boolean audit(ITransaction transaction)
The transaction should not be committed if the audit fails.
transaction
- Transaction to auditvoid commit(ITransaction transaction) throws InvalidTransactionException
All the model updates have to be carried out in the context of a transaction, which has to be created, through
the use of the createTransaction(String)
method, and committed using the current method.
The last created transaction is only the transaction that can be committed. If another transaction is committed,
a InvalidTransactionException
is thrown.
The commit
method invokes the internal modelio audit system to check that changes are valid
regarding the modelio specification. If the transaction audit fails, an InvalidTransactionException
exception is thrown and the transaction is automatically rollbacked. It must then not be rollbacked again.
The main transaction can be undone and redone.
transaction
- the transaction to commit.InvalidTransactionException
- If the transaction audit fails.ITransaction createTransaction(String transactionName)
All the model updates have to be carried out in the context of a transaction, which has to be created, through
the use of this method, and Committed via the commit(ITransaction)
method or rollbacked using the
rollback(ITransaction)
method.
transactionName
- A transaction name. This name is just a label that might be displayed in log files, a console or
dialog boxes.List<IElement> findByAtt(Class<? extends IElement> metaclass, String att, String value)
metaclass
- the metaclass to look for.att
- the name of the meta attribute to check the value in.value
- the value to look for in the attribute.List<IElement> findByClass(Class<? extends IElement> metaclass)
metaclass
- the metaclass to look for.IElement findByRef(ObRef ref)
ref
- the reference to look for.IElement findElementById(String metaclass, String id)
metaclass
- the metaclass to look for.id
- the id to look for.@Deprecated IElementStatus getElementStatus(IElement element)
Each IElement owns a list of specific properties, such as access rights, cms states... that can be accessed using this method.
element
- The element to observeIElementStatus
IMetamodelExtensions getMetamodelExtensions()
The metamodel extensions are added by the tool when modules are deployed. It corresponds to the stereotypes, note types and tag types brought by modules.
IUmlModel getModel()
This method is often used to get the root package using the IUmlModel.getRoot()
method
String getName()
IAnalystModel getRequirementModel()
The requirement model owns three model roots: the requirement container, the dictionary and the requirement administration models.
void removeModelHandler(IModelChangeHandler handler)
handler
- the model change handler to remove.void removeModelListener(IModelChangeListener listener)
listener
- the model change listener to remove.void removeStatusHandler(IStatusChangeHandler handler)
handler
- the status change handler to remove.void removeStatusListener(IStatusChangeListener listener)
listener
- the status change listener to remove.void rollback(ITransaction transaction) throws InvalidTransactionException
All the model updates have to be carried out in the context of a transaction, which has to be created, through
the use of the createTransaction(String)
method. The developer can choose to cancel the updates by
rollbacking the transaction, using the current method.
The last created transaction is only the transaction that can be rollbacked. If another transaction is
rollbacked, a InvalidTransactionException
is thrown.
transaction
- the transaction to rollback.InvalidTransactionException
- If the transaction to rollback is not the current transaction