4.1.3-AS6.1 to 5.0.0-AS6.1

Migrate from Atoti What-If 4.1.3-AS6.1 to 5.0.0-AS6.1. Consult the Atoti What-If 5.0.0-AS6.1 release notes and changelog for a complete view of changes.

Database schema migration

This release adds a PARENTBRANCH column to the DATASTORE_SIMULATIONS table to support chaining branches of what-if simulations.

Automatic migration (Liquibase)

Atoti What-If now uses Liquibase to manage schema migrations. If your application uses the provided Liquibase changelog, the migration is applied automatically on startup:

ALTER TABLE DATASTORE_SIMULATIONS ADD PARENTBRANCH VARCHAR(255);

Liquibase tracks applied changesets in the DATABASECHANGELOG table, so this statement is only ever executed once per database.

Manual migration

If you manage your database schema manually, run the following SQL against your SUBMISSIONS schema before starting the application:

ALTER TABLE DATASTORE_SIMULATIONS ADD PARENTBRANCH VARCHAR(255);

Overview

Atoti What-If 5.0.0 introduces a Spring Boot Starter that auto-configures all necessary beans. This is a major release that simplifies integration while removing several deprecated classes and methods.

  1. Back up your project.
  2. Update the Atoti What-If dependency to use the Spring Boot Starter.
  3. Provide the required beans (IDatabaseService and IWhatIfPersistenceProperties).
  4. Remove manual bean definitions that are now auto-configured.
  5. Configure properties in application.yml or application.properties.
  6. Update code using removed classes, methods, or constructors.
  7. Confirm successful build and startup.

Update dependencies

pom.xml

Update Atoti What-If to version 5.0.0-AS6.1

Replace the old dependency with the new Spring Boot Starter:

  • Atoti What-If 4.1.3-AS6.1:
<dependency>
    <groupId>com.activeviam.apps</groupId>
    <artifactId>whatif</artifactId>
    <version>4.1.3-AS6.1</version>
</dependency>
  • Atoti What-If 5.0.0-AS6.1:
<dependency>
    <groupId>com.activeviam.apps</groupId>
    <artifactId>atoti-what-if-spring-boot-starter</artifactId>
    <version>5.0.0-AS6.1</version>
</dependency>

Provide required beans

The Spring Boot Starter requires two beans from your application:

IDatabaseService

Provided by your Atoti Server application:

@Bean
public IDatabaseService databaseService(IDatastore datastore) {
    return new DatabaseService(datastore);
}

IWhatIfPersistenceProperties

Provides Hibernate configuration for simulation persistence:

@Bean
public IWhatIfPersistenceProperties whatIfPersistenceProperties(
        @Value("classpath:hibernate.properties") Resource resource) throws IOException {
    Properties props = new Properties();
    props.load(resource.getInputStream());
    return () -> props.entrySet().stream()
        .collect(Collectors.toMap(
            e -> String.valueOf(e.getKey()),
            e -> String.valueOf(e.getValue())
        ));
}

Remove manual bean definitions

The following beans are now auto-configured and should be removed from your configuration:

Bean Auto-configuration class
DatabaseSimulationEngine WhatIfCoreConfig
IUniqueIdGenerator WhatIfCoreConfig
ISimulationPersistenceManager WhatIfPersistenceConfig
IDatabaseSimulationsSecurityManager WhatIfSecurityConfig
IDatabaseSimulationsWorkflow WhatIfWorkflowConfig
DatabaseSimulationsRestService WhatIfRestConfig

To override any auto-configured bean, define your own bean of the same type. All auto-configured beans use @ConditionalOnMissingBean.

Configure properties

Security and distribution settings are now managed through properties:

atoti:
  what-if:
    enable: true  # default, set to false to disable all What-If features
    security:
      type: spring  # spring (default), none, or custom
      use-branch-permissions: true
    distribution:
      enabled: false
      query-node-name: ""
      create-distributed-service: true

See the configuration reference for all available properties.

Removed classes

DatabaseSimulationPersistenceManager

DatabaseSimulationPersistenceManager has been removed. Use HibernateSimulationPersistenceManager instead.

  • Before:
@Bean
public ISimulationPersistenceManager persistenceManager(IDatabaseService databaseService) {
    return new DatabaseSimulationPersistenceManager(databaseService);
}
  • After:
// Auto-configured by the starter, or manually:
@Bean
public ISimulationPersistenceManager persistenceManager() {
    return new HibernateSimulationPersistenceManager<>(DatabaseSimulationJPA.class);
}

Exception classes in DatabaseSimulationsRestService

The inner exception classes in DatabaseSimulationsRestService have been removed. Use the standalone classes in com.activeviam.tools.whatif.rest instead:

Removed class Replacement
DatabaseSimulationsRestService.ActiveViamSimulationException com.activeviam.tools.whatif.rest.ActiveViamSimulationException
DatabaseSimulationsRestService.ActiveViamUnauthorizedException com.activeviam.tools.whatif.rest.ActiveViamUnauthorizedException
DatabaseSimulationsRestService.ActiveViamDeletionException com.activeviam.tools.whatif.rest.ActiveViamDeletionException
DatabaseSimulationsRestService.ActiveViamUnknownSimulationException com.activeviam.tools.whatif.rest.ActiveViamUnknownSimulationException

Removed constructors

RestDistributedDatabaseService

The constructors accepting a distributedPivot parameter have been removed. Use the constructors without the pivot parameter.

  • Before:
new RestDistributedDatabaseService(addresses, authenticator, distributedPivot);
new RestDistributedDatabaseService(resultsMerger, addresses, authenticator, distributedPivot);
  • After:
new RestDistributedDatabaseService(addresses, authenticator);
new RestDistributedDatabaseService(resultsMerger, addresses, authenticator);
// Or let the starter auto-configure it when distribution.enabled: true

Removed methods

RestDistributedDatabaseService.isConsistentStatus()

The isConsistentStatus() method has been removed.

Constructor changes

If you are instantiating classes directly (without the starter), note the following changes:

DatabaseSimulationsRestService

DatabaseSimulationsRestService now uses constructor injection with three required parameters:

new DatabaseSimulationsRestService(
    simulationsPersistenceManager,
    simulationsWorkflow,
    databaseService
);

DatabaseSimulationsWorkflow

DatabaseSimulationsWorkflow now uses constructor injection with five required parameters:

new DatabaseSimulationsWorkflow(
    engine,
    databaseSimulationPersistenceManager,
    securityManager,
    databaseService,
    databaseSimulationIdGenerator
);