Atoti What-If Components
Components of the Atoti What-If library
| Component | Description |
|---|---|
| IUniqueIdGenerator | Interface for the creation of unique ID generators. |
| IncrementalUniqueIdGenerator | Implementation of IUniqueIdGenerator which uses an incremental counter starting from the Epoch second. |
| DatabaseSimulationEngine | Internal component wrapping interactions with an IDatabaseService. |
| ISimulationPersistenceManager | Interface for CRUD operations on a persistence layer for simulations. |
| HibernateSimulationPersistenceManager | An implementation of ISimulationPersistenceManager using Hibernate for persistence in a database. |
| IDatabaseSimulationsWorkflow | Interface for a component handling the creation, execution, retrieval and deletion of simulations within an application server. |
| IDatabaseSimulationsSecurityManager | Interface for a component handling branch permissions related to simulations. |
| SpringDatabaseSimulationsSecurityManager | An implementation of IDatabaseSimulationsSecurityManager matching Spring authentication against Atoti Server user roles. |
| NoOpDatabaseSimulationsSecurityManager | An implementation of IDatabaseSimulationsSecurityManager that ignores the user attempting to execute simulations. |
| DatabaseSimulationsWorkflow | Implementation of IDatabaseSimulationsWorkflow using DatabaseSimulationEngine, ISimulationPersistenceManager, IDatabaseSimulationsSecurityManager, IUniqueIdGenerator and IDatabaseService objects to orchestrate the execution of database simulations. |
| ArithmeticUpdateProcedureFactory | Implementation of IUpdateWhereProcedureFactory for update-where procedures that apply an arithmetic operation to a table field. |
| UpdateWithFieldValuesProcedureFactory | Implementation of IUpdateWhereProcedureFactory for update-where procedures that accepts a map of field names and associated objects. |
| UpdateWithListOfValuesProcedureFactory | Implementation of IUpdateWhereProcedureFactory for update-where procedures that accepts a set of keys and updated rows as a list of value maps. |
| IDatabaseSimulationDefinition | Interface for the definition of simulations, an extension of IExtendedPluginValue with methods for retrieving definition parameters, the description, the list of changes made by the simulation and a JsonDatabaseEdit object to use with the IDatabaseService. |
| ADatabaseSimulationDefinition | A serializable abstract implementation of IDatabaseSimulationDefinition that converts the parameters map to a string map, and wraps an array of JsonDatabaseAction objects in a JsonDatabaseEdit. |
| DatabaseSimulationDefinitionDTO | A DTO for the type, parameters and description of a database simulation definition. |
| DatabaseSimulationDiffDTO | A DTO for the before/after values resulting from executing a simulation. |
| IDatabaseSimulation | Interface for simulations, with methods for retrieving information about a specific instance of a simulation. |
| DatabaseSimulation | A serializable implementation of IDatabaseSimulation. |
| DatabaseSimulationDTO | A DTO for the relevant information associated with a database simulation. |
| DatabaseSimulationsUtils | A utility class containing helper methods for the creation of JsonDatabaseAction objects, the creation of duplicate tuples and conversions to and from a JsonNode. |
Auto-configuration
When using the Spring Boot Starter, the following beans are created automatically. All auto-configuration classes are gated by @ConditionalOnWhatIfEnabled, so setting atoti.what-if.enable: false disables all of them.
| Bean | Auto-configuration class | Condition |
|---|---|---|
DatabaseSimulationEngine |
WhatIfCoreConfig |
Always |
IUniqueIdGenerator |
WhatIfCoreConfig |
Always |
ISimulationPersistenceManager |
WhatIfPersistenceConfig |
IWhatIfPersistenceProperties bean present |
IDatabaseSimulationsSecurityManager |
WhatIfSecurityConfig |
Based on security.type property |
IDatabaseSimulationsWorkflow |
WhatIfWorkflowConfig |
Always |
DatabaseSimulationsRestService |
WhatIfRestConfig |
Web application context |
IDistributedQueryResultsMerger |
WhatIfDistributionConfig |
distribution.enabled: true |
RestDistributedDatabaseService |
WhatIfDistributionConfig |
distribution.enabled: true and distribution.create-distributed-service: true |
Auto-configuration classes
| Class | Description |
|---|---|
WhatIfCoreConfig |
Creates the simulation engine and ID generator. |
WhatIfPersistenceConfig |
Creates the Hibernate-based persistence manager. |
WhatIfSecurityConfig |
Creates the security manager based on the configured type. |
WhatIfWorkflowConfig |
Creates the simulation workflow. |
WhatIfRestConfig |
Creates the REST service for UI interactions. |
WhatIfDistributionConfig |
Creates beans for distributed mode. |
How to override auto-configured beans
All auto-configured beans use @ConditionalOnMissingBean, meaning your custom beans take precedence. Define a bean of the same type in your configuration:
@Bean
public IUniqueIdGenerator customIdGenerator() {
return new MyCustomIdGenerator();
}
Simulation and definition objects
In previous versions of Atoti What-If, definitions contained concrete parameters and abstract methods that directly operate on a datastore. Version 2.0 allows for free-form serializable parameters and methods that build objects to be passed to the IDatastoreInstance. The results of the simulation (diffs) are also omitted from the persistence of the simulations. They are now an optional implementation detail for definitions that require them.
DTOs are also provided for both object types, that is, for serialization and REST service implementations.