Search in sources :

Example 1 with BranchDumpEntryJson

use of com.enonic.xp.repo.impl.dump.serializer.json.BranchDumpEntryJson in project xp by enonic.

the class IndexConfigUpgrader method upgradeBranchEntry.

@Override
protected byte[] upgradeBranchEntry(final RepositoryId repositoryId, final String entryContent) {
    final BranchDumpEntryJson sourceBranchEntry = deserializeValue(entryContent, BranchDumpEntryJson.class);
    final VersionDumpEntryJson sourceVersionEntry = sourceBranchEntry.getMeta();
    final VersionDumpEntryJson upgradedVersionEntry = upgradeVersionMeta(sourceVersionEntry);
    if (!sourceVersionEntry.equals(upgradedVersionEntry)) {
        return serialize(BranchDumpEntryJson.create(sourceBranchEntry).meta(upgradedVersionEntry).build());
    }
    return entryContent.getBytes(StandardCharsets.UTF_8);
}
Also used : VersionDumpEntryJson(com.enonic.xp.repo.impl.dump.serializer.json.VersionDumpEntryJson) BranchDumpEntryJson(com.enonic.xp.repo.impl.dump.serializer.json.BranchDumpEntryJson)

Example 2 with BranchDumpEntryJson

use of com.enonic.xp.repo.impl.dump.serializer.json.BranchDumpEntryJson in project xp by enonic.

the class CommitDumpUpgrader method upgradeBranchEntry.

@Override
protected byte[] upgradeBranchEntry(final RepositoryId repositoryId, final String entryContent) {
    if (processingMaster) {
        final Pre6BranchDumpEntryJson sourceEntry = deserializeValue(entryContent, Pre6BranchDumpEntryJson.class);
        commitedNodeIds.add(sourceEntry.getNodeId());
        commitedVersionIds.add(sourceEntry.getMeta().getVersion());
        final BranchDumpEntryJson upgradedEntry = upgradeBranchDumpEntry(sourceEntry, true);
        return serialize(upgradedEntry);
    } else {
        final Pre6BranchDumpEntryJson sourceEntry = deserializeValue(entryContent, Pre6BranchDumpEntryJson.class);
        final boolean commit = commitedVersionIds.contains(sourceEntry.getMeta().getVersion());
        final BranchDumpEntryJson upgradedEntry = upgradeBranchDumpEntry(sourceEntry, commit);
        return serialize(upgradedEntry);
    }
}
Also used : Pre6BranchDumpEntryJson(com.enonic.xp.repo.impl.dump.upgrade.obsoletemodel.pre6.Pre6BranchDumpEntryJson) BranchDumpEntryJson(com.enonic.xp.repo.impl.dump.serializer.json.BranchDumpEntryJson) Pre6BranchDumpEntryJson(com.enonic.xp.repo.impl.dump.upgrade.obsoletemodel.pre6.Pre6BranchDumpEntryJson)

Example 3 with BranchDumpEntryJson

use of com.enonic.xp.repo.impl.dump.serializer.json.BranchDumpEntryJson in project xp by enonic.

the class HtmlAreaDumpUpgrader method upgradeBranchEntry.

@Override
protected void upgradeBranchEntry(final RepositoryId repositoryId, final String entryContent) {
    final BranchDumpEntryJson branchDumpEntryJson = deserializeValue(entryContent, BranchDumpEntryJson.class);
    final VersionDumpEntryJson versionDumpEntryJson = branchDumpEntryJson.getMeta();
    upgradeVersionMeta(versionDumpEntryJson);
}
Also used : VersionDumpEntryJson(com.enonic.xp.repo.impl.dump.serializer.json.VersionDumpEntryJson) BranchDumpEntryJson(com.enonic.xp.repo.impl.dump.serializer.json.BranchDumpEntryJson)

Aggregations

BranchDumpEntryJson (com.enonic.xp.repo.impl.dump.serializer.json.BranchDumpEntryJson)3 VersionDumpEntryJson (com.enonic.xp.repo.impl.dump.serializer.json.VersionDumpEntryJson)2 Pre6BranchDumpEntryJson (com.enonic.xp.repo.impl.dump.upgrade.obsoletemodel.pre6.Pre6BranchDumpEntryJson)1