Code that invokes the methods of DBCleanService must have JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION permission.
There are several methods of DBCleanerService :
| public static void cleanWorkspaceData(WorkspaceEntry wsEntry) | Clean workspace data from database |
| public static void cleanRepositoryData(RepositoryEntry repoEntry) | Cleanup repository data from database |
| public static DBCleaner getWorkspaceDBCleaner(Connection jdbcConn, WorkspaceEntry wsEntry) | Returns database cleaner of workspace. |
| public static DBCleaner getRepositoryDBCleaner(Connection jdbcConn, RepositoryEntry repoEntry) | Returns database cleaner of repository. Returns null in case of multi-db configuration. |
The cleaning is a part of restoring from backup and it is used in the following restore phases:
| clean | dbCleaner.executeCleanScripts(); |
| restore | does nothing with DBCleaner |
| commit | dbCleaner.executeCommitScripts(); |
| rollback | connection.rollback(); |
Different approaches are used for database cleaning depending on database and JCR configuration.