Modelio API audit services provide a programmatic access to Modelio audit functions.
Modelio' audit permanently checks the changes in the model, whether these changes are carried out by a end-user or by a program (module). The performed controls are of two kind:
- core controls
- audit rules
Core controls are checked by Modelio for each batch of modifications of the model (See Transaction) and before the changes are committed. The role of the core controls is to protect the Modelio core implementation from errors that could lead to severe defects in the model (including crashing in the worst cases). The core controls cannot be disabled or customized. They are run synchronously in any case prior to committing any changes in the model.
Audit rules check the model against UML rules to help designing a well-formed model. Some audit rules produce error report while some others produce warnings or simple tips. Audit rules are run asynchronously after some changes have been committed in a separate background thread. an Audit rule cannot cancel or prevent a model change even if this change is breaking this rule. The rule can only produce a diagnostic in the audit view. For more information, please see the audit rule list.
Performance considerations The core controls are run synchronously with the changes made in the model thereby possibly slowing down the execution of the changes. This is why core controls have been limited to detecting dangerous situations for the tool. Audit rules are far more detailed and accurate as they try to control model correctness against UML design rules. This can be costly and this is why audit rules checks are run asynchronously in a separate thread. Furthermore, to reduce computation costs, only those audit rules that are relevant for the model changes that occurred are fired by Modelio (this is currently done by analyzing the ‘what’ has been modified in the transaction). The combination of these two approach ensures a reactive tool to the end-user.
Modelio audit service allows for:
- firing audit rules checking on a particular element.
- firing core controls on a particular element.
IAuditService object provided by Modelio is the access point to the model component API.
Using the audit API consists in:
- getting the IAuditService
- calling one of the provided methods
Audit of a model element¶
audit() method of
IAuditService can be called to fire the audit rules on a particular element.
1... 2IAuditService auditService = Modelio.getInstance().getAuditService(); 3... 4Element aModelElement = ...; 5 6auditService.audit(aModelElement); 7 8...
The code (line 6) is straightforward: just call the audit method while passing it aModelElement, the element to audit.
Nothing special excepted that the audit method will perform the following operations on it:
- audit aModelElement itself as if all the possible changes have been made on it, ie firing all the applicable rules for this element
- audit all the model elements that are owned by aModelElement (ie its children in the explorer)
- and proceed recursively!
Imagine that you are calling the
audit() method on the project root, then your complete model will be audit for all the defined rules. Be sure that this is what you really need as this task might require a significant amount of time and resources…
Audit diagnostics are displayed in the Audit View of Modelio.