Package org.nuiton.topia.migration
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 booleanaskUser(org.nuiton.version.Version dbVersion, java.util.List<org.nuiton.version.Version> versions)Hook to ask user if migration can be performed.booleandoMigration(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.voidexecuteSQL(TopiaContextImplementor tx, boolean showSql, boolean showProgression, java.lang.String... sqls)Executes the givensqlsrequests.voidexecuteSQL(TopiaContextImplementor tx, java.lang.String... sqls)abstract org.nuiton.version.VersiongetApplicationVersion()abstract org.nuiton.version.Version[]getAvailableVersions()protected abstract voidmigrateForVersion(org.nuiton.version.Version version, TopiaContextImplementor tx, boolean showSql, boolean showProgression)voidsetTmsVersionPersister(TMSVersionPersister tmsVersionPersister)
-
Constructor Details
-
AbstractTopiaMigrationCallback
public AbstractTopiaMigrationCallback()
-
-
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 versionversions- the versions to update- Returns:
falseif migration is canceled,trueotherwise.
-
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 MigrationServiceExceptionTentative de migration depuis la version de la base version la version souhaitee. On applique toutes les migrations de version indiquee dans le parametreversion. Pour chaque version, on cherche la methode migrateTo_XXX ou XXX est la version transforme en identifiant java via la methodeVersion.getValidName()et on l'execute. Note: pour chaque version a appliquer, on ouvre une nouvelle transaction.- Parameters:
ctxt- topia context de la transaction en coursdbVersion- database versionshowSql- drapeau pour afficher les requete sqlshowProgression- drapeau pour afficher la progressionversions- all versions knwon by service @return migration a ggrement- Returns:
truesi la migration est accepté,falseautrement.- Throws:
MigrationServiceException
-
executeSQL
- Throws:
TopiaException
-
executeSQL
public void executeSQL(TopiaContextImplementor tx, boolean showSql, boolean showProgression, java.lang.String... sqls) throws TopiaExceptionExecutes the givensqlsrequests.- Parameters:
tx- the sessionshowSql- flag to see sql requestsshowProgression- flag to see progession on consolesqls- requests to execute- Throws:
TopiaException- if any pb- Since:
- 2.3.0
-
setTmsVersionPersister
-