public abstract class AbstractHibernateDataMigration extends Object implements HibernateDataMigration
DataMigration
Modifier and Type | Field and Description |
---|---|
protected org.xwiki.component.manager.ComponentManager |
componentManager
Component manager used to access stores.
|
protected javax.inject.Provider<DataMigrationManager> |
manager |
Constructor and Description |
---|
AbstractHibernateDataMigration() |
Modifier and Type | Method and Description |
---|---|
protected XWikiDBVersion |
getCurrentDBVersion() |
String |
getLiquibaseChangeLog() |
String |
getName() |
String |
getPreHibernateLiquibaseChangeLog() |
protected XWikiHibernateBaseStore |
getStore() |
protected XWikiContext |
getXWikiContext() |
protected abstract void |
hibernateMigrate()
Execute the migration itself.
|
void |
migrate()
Run migration.
|
boolean |
shouldExecute(XWikiDBVersion startupVersion) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDescription, getVersion
@Inject protected org.xwiki.component.manager.ComponentManager componentManager
@Inject @Named(value="hibernate") protected javax.inject.Provider<DataMigrationManager> manager
protected XWikiContext getXWikiContext()
protected XWikiHibernateBaseStore getStore() throws DataMigrationException
DataMigrationException
- if the store could not be reachedpublic String getName()
getName
in interface DataMigration
public boolean shouldExecute(XWikiDBVersion startupVersion)
shouldExecute
in interface DataMigration
startupVersion
- the database version when the migration process starts (before any dataMigration is
applied). This is useful for data migration which need to run only when the database is in a certain
version.protected abstract void hibernateMigrate() throws DataMigrationException, XWikiException
DataMigrationException
- on migration error.XWikiException
- on error from the store.public void migrate() throws DataMigrationException
DataMigration
migrate
in interface DataMigration
DataMigrationException
- if any errorpublic String getPreHibernateLiquibaseChangeLog() throws DataMigrationException
getPreHibernateLiquibaseChangeLog
in interface HibernateDataMigration
DataMigrationException
- on errorpublic String getLiquibaseChangeLog() throws DataMigrationException
getLiquibaseChangeLog
in interface HibernateDataMigration
DataMigrationException
- on errorprotected XWikiDBVersion getCurrentDBVersion() throws DataMigrationException
DataMigrationException
- when failing to get the current DB versionCopyright © 2004–2022 XWiki. All rights reserved.