Search in sources :

Example 1 with Pre4BranchDumpEntryJson

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);
}
Also used : Pre4BranchDumpEntryJson(com.enonic.xp.repo.impl.dump.upgrade.obsoletemodel.pre4.Pre4BranchDumpEntryJson) Pre2BranchDumpEntryJson(com.enonic.xp.repo.impl.dump.upgrade.obsoletemodel.pre2.Pre2BranchDumpEntryJson)

Example 2 with Pre4BranchDumpEntryJson

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 + "]");
    }
}
Also used : Path(java.nio.file.Path) Pre4BranchDumpEntryJson(com.enonic.xp.repo.impl.dump.upgrade.obsoletemodel.pre4.Pre4BranchDumpEntryJson) DumpUpgradeException(com.enonic.xp.repo.impl.dump.upgrade.DumpUpgradeException) DumpUpgradeException(com.enonic.xp.repo.impl.dump.upgrade.DumpUpgradeException) IOException(java.io.IOException) RepoDumpException(com.enonic.xp.repo.impl.dump.RepoDumpException)

Example 3 with Pre4BranchDumpEntryJson

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);
}
Also used : Pre4BranchDumpEntryJson(com.enonic.xp.repo.impl.dump.upgrade.obsoletemodel.pre4.Pre4BranchDumpEntryJson) Pre6VersionDumpEntryJson(com.enonic.xp.repo.impl.dump.upgrade.obsoletemodel.pre6.Pre6VersionDumpEntryJson) Pre6BranchDumpEntryJson(com.enonic.xp.repo.impl.dump.upgrade.obsoletemodel.pre6.Pre6BranchDumpEntryJson)

Aggregations

Pre4BranchDumpEntryJson (com.enonic.xp.repo.impl.dump.upgrade.obsoletemodel.pre4.Pre4BranchDumpEntryJson)3 RepoDumpException (com.enonic.xp.repo.impl.dump.RepoDumpException)1 DumpUpgradeException (com.enonic.xp.repo.impl.dump.upgrade.DumpUpgradeException)1 Pre2BranchDumpEntryJson (com.enonic.xp.repo.impl.dump.upgrade.obsoletemodel.pre2.Pre2BranchDumpEntryJson)1 Pre6BranchDumpEntryJson (com.enonic.xp.repo.impl.dump.upgrade.obsoletemodel.pre6.Pre6BranchDumpEntryJson)1 Pre6VersionDumpEntryJson (com.enonic.xp.repo.impl.dump.upgrade.obsoletemodel.pre6.Pre6VersionDumpEntryJson)1 IOException (java.io.IOException)1 Path (java.nio.file.Path)1