use of com.enonic.xp.repo.impl.dump.upgrade.obsoletemodel.pre4.Pre4BranchDumpEntryJson in project xp by enonic.
the class VersionIdDumpUpgrader method upgradeBranchEntry.
@Override
protected byte[] upgradeBranchEntry(final RepositoryId repositoryId, final String entryContent) {
final Pre2BranchDumpEntryJson sourceEntry = deserializeValue(entryContent, Pre2BranchDumpEntryJson.class);
final Pre4BranchDumpEntryJson upgradedEntry = Pre4BranchDumpEntryJson.create().nodeId(sourceEntry.getNodeId()).meta(upgradeVersion(sourceEntry.getMeta())).binaries(sourceEntry.getBinaries()).build();
return serialize(upgradedEntry);
}
use of com.enonic.xp.repo.impl.dump.upgrade.obsoletemodel.pre4.Pre4BranchDumpEntryJson in project xp by enonic.
the class FlattenedPageDumpUpgrader method upgradeBranch.
private void upgradeBranch(final Branch branch) {
final Path branchEntriesFile = dumpReader.getBranchEntriesFile(REPOSITORY_ID, branch);
if (Files.exists(branchEntriesFile)) {
// Gathers the template -> controller mappings
final TemplateControllerMappings templateControllerMappings = new TemplateControllerMappings();
processEntries((entryContent, entryName) -> {
final Pre4BranchDumpEntryJson sourceEntry = deserializeValue(entryContent, Pre4BranchDumpEntryJson.class);
addTemplateControllerMapping(sourceEntry.getMeta(), templateControllerMappings);
}, branchEntriesFile);
final Map<String, String> templateControllerMap = templateControllerMappings.getMappings();
// Update contents with pages
final FlattenedPageDataUpgrader dataUpgrader = FlattenedPageDataUpgrader.create().templateControllerMap(templateControllerMap).build();
processEntries((entryContent, entryName) -> {
result.processed();
try {
final Pre4BranchDumpEntryJson sourceEntry = deserializeValue(entryContent, Pre4BranchDumpEntryJson.class);
upgradeVersionMeta(sourceEntry.getMeta(), dataUpgrader);
} catch (Exception e) {
result.error();
LOG.error("Error while upgrading branch entry [" + entryName + "]", e);
}
}, branchEntriesFile);
} else {
throw new DumpUpgradeException("Branch entries file missing for repository [" + REPOSITORY_ID + "] and branch [" + branch + "]");
}
}
use of com.enonic.xp.repo.impl.dump.upgrade.obsoletemodel.pre4.Pre4BranchDumpEntryJson in project xp by enonic.
the class IndexAccessSegmentsDumpUpgrader method upgradeBranchEntry.
@Override
protected byte[] upgradeBranchEntry(final RepositoryId repositoryId, final String entryContent) {
final Pre4BranchDumpEntryJson branchDumpEntry = deserializeValue(entryContent, Pre4BranchDumpEntryJson.class);
final Pre6VersionDumpEntryJson upgradedVersionDumpEntry = upgradeVersionDumpEntry(repositoryId, branchDumpEntry.getMeta());
final Pre6BranchDumpEntryJson upgradedBranchDumpEntry = Pre6BranchDumpEntryJson.create().nodeId(branchDumpEntry.getNodeId()).binaries(branchDumpEntry.getBinaries()).meta(upgradedVersionDumpEntry).build();
return serialize(upgradedBranchDumpEntry);
}
Aggregations