Hello developers,
In the course of rewriting the import UI (XWIKI-4692), I've also
integrated a modified version of Ludovic's patch for XWIKI-831 "Import
wizard should conserve version history".
It's not a huge refactoring, but since I'm deprecating APIs and
introducing new ones, I'd like to be sure it's ok with you before I
commit.
The goal was not to rewrite the whole plugin (which would be needed
thought), but rather to fix major bugs and make possible the "add a
version to existing document" option upon import.
As I wrote on JIRA, here's basically what the patch does:
* It deprecated the notions of backupPack, preserveVersion and
isWithVersions in the installer (or "PackageAPI")
* It introduces a notion of HistoryStrategy (an enum with 3 options: ADD,
REPLACE and RESET) that replace the former preserveVersion and
isWithVersions which meaning was defined nowhere and was not very clear
(preserveVersion came from the package.xml file, and did not mean too much
except "there are history revisions included in this package")
* It introduce a notion of importAsBackup to replace isBackupPack . This
means that its no longer the package.xml file that decides if the package
should be imported as a backup or not, it's up to "the one that import"
(that is, to the importer UI for example; or to a consumer of the
packaging plugin API)
I keep compatibility with the "old" notions of preserveVersion and
isWithVersions. Actually, the compatibility code is a good start to
understand the change :
if (this.historyStrategy == null) {
// Compatibility code to handle consumers of this plugin that do
not use yet the
// versionStrategy (introduced in 2.2M1)
// We set here the versionStrategy based on former parameters
(now deprecated)
if (this.withVersions && this.preserveVersion) {
this.historyStrategy = HistoryStrategy.REPLACE;
}
else if (this.preserveVersion) {
this.historyStrategy = HistoryStrategy.RESET;
}
else {
this.historyStrategy = HistoryStrategy.ADD_VERSION;
}
}
I made the whole patch available on JIRA.
Here is my +1 to commit it.
Please let me know what you think. If you can give me feedback tonight or
tomorrow, that would be great, as I'd like to commit the importer for
2.2M1. Sorry for the short notice, I should have send this a bit earlier.
Thanks,
Jerome.