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
,R140600000XWIKI19869DataMigration
,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.ComponentManager
componentManager
Component 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 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)
-
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:
getName
in interfaceDataMigration
- Returns:
- the data migration hint. For example "R4340XWIKI883".
-
shouldExecute
public boolean shouldExecute(XWikiDBVersion startupVersion)
- Specified by:
shouldExecute
in 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, XWikiException
Execute the migration itself.- Throws:
DataMigrationException
- on migration error.XWikiException
- on error from the store.
-
migrate
public void migrate() throws DataMigrationException
Description copied from interface:DataMigration
Run migration.- Specified by:
migrate
in interfaceDataMigration
- Throws:
DataMigrationException
- if any error
-
getPreHibernateLiquibaseChangeLog
public String getPreHibernateLiquibaseChangeLog() throws DataMigrationException
- Specified by:
getPreHibernateLiquibaseChangeLog
in 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:
getLiquibaseChangeLog
in 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
-
-