Class AbstractTopiaMigrationCallback

java.lang.Object
org.nuiton.topia.migration.AbstractTopiaMigrationCallback
Direct Known Subclasses:
TopiaMigrationCallbackByClass, TopiaMigrationCallbackByClassNG, TopiaMigrationCallbackByMethod

public abstract class AbstractTopiaMigrationCallback
extends java.lang.Object
Abstract migration callback.
Since:
2.5
Version:
$Id$
Author:
tchemit <chemit@codelutin.com>
  • Constructor Summary

    Constructors 
    Constructor Description
    AbstractTopiaMigrationCallback()  
  • Method Summary

    Modifier and Type Method Description
    abstract boolean askUser​(org.nuiton.version.Version dbVersion, java.util.List<org.nuiton.version.Version> versions)
    Hook to ask user if migration can be performed.
    boolean doMigration​(TopiaContext ctxt, org.nuiton.version.Version dbVersion, boolean showSql, boolean showProgression, java.util.List<org.nuiton.version.Version> versions)
    Tentative de migration depuis la version de la base version la version souhaitee.
    void executeSQL​(TopiaContextImplementor tx, boolean showSql, boolean showProgression, java.lang.String... sqls)
    Executes the given sqls requests.
    void executeSQL​(TopiaContextImplementor tx, java.lang.String... sqls)  
    abstract org.nuiton.version.Version getApplicationVersion()  
    abstract org.nuiton.version.Version[] getAvailableVersions()  
    protected abstract void migrateForVersion​(org.nuiton.version.Version version, TopiaContextImplementor tx, boolean showSql, boolean showProgression)  
    void setTmsVersionPersister​(TMSVersionPersister tmsVersionPersister)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • getAvailableVersions

      public abstract org.nuiton.version.Version[] getAvailableVersions()
      Returns:
      the available versions from the call back
    • getApplicationVersion

      public abstract org.nuiton.version.Version getApplicationVersion()
      Returns:
      the current application version (says the version to use)
    • askUser

      public abstract boolean askUser​(org.nuiton.version.Version dbVersion, java.util.List<org.nuiton.version.Version> versions)
      Hook to ask user if migration can be performed.
      Parameters:
      dbVersion - the actual db version
      versions - the versions to update
      Returns:
      false if migration is canceled, true otherwise.
    • migrateForVersion

      protected abstract void migrateForVersion​(org.nuiton.version.Version version, TopiaContextImplementor tx, boolean showSql, boolean showProgression) throws java.lang.Exception
      Throws:
      java.lang.Exception
    • doMigration

      public boolean doMigration​(TopiaContext ctxt, org.nuiton.version.Version dbVersion, boolean showSql, boolean showProgression, java.util.List<org.nuiton.version.Version> versions) throws MigrationServiceException
      Tentative de migration depuis la version de la base version la version souhaitee. On applique toutes les migrations de version indiquee dans le parametre version. Pour chaque version, on cherche la methode migrateTo_XXX ou XXX est la version transforme en identifiant java via la methode Version.getValidName() et on l'execute. Note: pour chaque version a appliquer, on ouvre une nouvelle transaction.
      Parameters:
      ctxt - topia context de la transaction en cours
      dbVersion - database version
      showSql - drapeau pour afficher les requete sql
      showProgression - drapeau pour afficher la progression
      versions - all versions knwon by service @return migration a ggrement
      Returns:
      true si la migration est accepté, false autrement.
      Throws:
      MigrationServiceException
    • executeSQL

      public void executeSQL​(TopiaContextImplementor tx, java.lang.String... sqls) throws TopiaException
      Throws:
      TopiaException
    • executeSQL

      public void executeSQL​(TopiaContextImplementor tx, boolean showSql, boolean showProgression, java.lang.String... sqls) throws TopiaException
      Executes the given sqls requests.
      Parameters:
      tx - the session
      showSql - flag to see sql requests
      showProgression - flag to see progession on console
      sqls - requests to execute
      Throws:
      TopiaException - if any pb
      Since:
      2.3.0
    • setTmsVersionPersister

      public void setTmsVersionPersister​(TMSVersionPersister tmsVersionPersister)