Class AbstractHibernateDataMigration
- java.lang.Object
-
- com.xpn.xwiki.store.migration.hibernate.AbstractHibernateDataMigration
-
- All Implemented Interfaces:
DataMigration,HibernateDataMigration
- Direct Known Subclasses:
AbstractDropNotNullDataMigration,AbstractResizeMigration,LegacyDataMigration,R1008010XWIKI10092DataMigration,R1138000XWIKI16709DataMigration,R130200000XWIKI17200DataMigration,R140000000XWIKI19125DataMigration,R140200000XWIKI19352DataMigration,R15428XWIKI2977DataMigration,R35100XWIKI7564DataMigration,R35101XWIKI7645DataMigration,R35102XWIKI7771DataMigration,R40000XWIKI6990DataMigration,R42000XWIKI7726DataMigration,R43000XWIKI6691DataMigration,R4340XWIKI883DataMigration,R4359XWIKI1459DataMigration,R54600TranslationDataMigration,R6079XWIKI1878DataMigration,R72000XWIKI12153DataMigration,R72001XWIKI12228DataMigration,R73000XWIKI12277DataMigration,R7350XWIKI2079DataMigration,R90000XWIKI13474DataMigration
public abstract class AbstractHibernateDataMigration extends Object implements HibernateDataMigration
Template for data migration of hibernate store.- Since:
- 3.4M1
- Version:
- $Id: 1b7c46117dda483db1fe2d01ba46eaf8debad23a $
- See Also:
DataMigration
-
-
Field Summary
Fields Modifier and Type Field Description protected org.xwiki.component.manager.ComponentManagercomponentManagerComponent manager used to access stores.protected javax.inject.Provider<DataMigrationManager>manager
-
Constructor Summary
Constructors Constructor Description AbstractHibernateDataMigration()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected XWikiDBVersiongetCurrentDBVersion()StringgetLiquibaseChangeLog()StringgetName()StringgetPreHibernateLiquibaseChangeLog()protected XWikiHibernateBaseStoregetStore()protected XWikiContextgetXWikiContext()protected abstract voidhibernateMigrate()Execute the migration itself.voidmigrate()Run migration.booleanshouldExecute(XWikiDBVersion startupVersion)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.xpn.xwiki.store.migration.DataMigration
getDescription, getVersion
-
-
-
-
Field Detail
-
componentManager
@Inject protected org.xwiki.component.manager.ComponentManager componentManager
Component manager used to access stores.
-
manager
@Inject @Named("hibernate") protected javax.inject.Provider<DataMigrationManager> manager
-
-
Method Detail
-
getXWikiContext
protected XWikiContext getXWikiContext()
- Returns:
- XWikiContext to access the store
-
getStore
protected XWikiHibernateBaseStore getStore() throws DataMigrationException
- Returns:
- store system for execute store-specific actions.
- Throws:
DataMigrationException- if the store could not be reached
-
getName
public String getName()
- Specified by:
getNamein interfaceDataMigration- Returns:
- the data migration hint. For example "R4340XWIKI883".
-
shouldExecute
public boolean shouldExecute(XWikiDBVersion startupVersion)
- Specified by:
shouldExecutein interfaceDataMigration- Parameters:
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.- Returns:
- true if the migration should be executed or false otherwise
-
hibernateMigrate
protected abstract void hibernateMigrate() throws DataMigrationException, XWikiExceptionExecute the migration itself.- Throws:
DataMigrationException- on migration error.XWikiException- on error from the store.
-
migrate
public void migrate() throws DataMigrationExceptionDescription copied from interface:DataMigrationRun migration.- Specified by:
migratein interfaceDataMigration- Throws:
DataMigrationException- if any error
-
getPreHibernateLiquibaseChangeLog
public String getPreHibernateLiquibaseChangeLog() throws DataMigrationException
- Specified by:
getPreHibernateLiquibaseChangeLogin interfaceHibernateDataMigration- Returns:
- some liquibase changelogs for refactoring the database before the hibernate schema update is processed
- Throws:
DataMigrationException- on error
-
getLiquibaseChangeLog
public String getLiquibaseChangeLog() throws DataMigrationException
- Specified by:
getLiquibaseChangeLogin interfaceHibernateDataMigration- Returns:
- some liquibase changelogs for refactoring the database after the hibernate schema update has been processed
- Throws:
DataMigrationException- on error
-
getCurrentDBVersion
protected XWikiDBVersion getCurrentDBVersion() throws DataMigrationException
- Returns:
- the current DB version (after executing the previous migrations)
- Throws:
DataMigrationException- when failing to get the current DB version- Since:
- 11.0
-
-