Search in sources :

Example 1 with VersionDumpEntryJson

use of com.enonic.xp.repo.impl.dump.serializer.json.VersionDumpEntryJson 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 VersionDumpEntryJson

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

the class IndexConfigUpgrader method upgradeVersionEntry.

@Override
protected byte[] upgradeVersionEntry(final RepositoryId repositoryId, final String entryContent) {
    final VersionsDumpEntryJson sourceVersionsEntry = deserializeValue(entryContent, VersionsDumpEntryJson.class);
    final Collection<VersionDumpEntryJson> upgradedVersionList = sourceVersionsEntry.getVersions().stream().map(this::upgradeVersionMeta).collect(Collectors.toList());
    final VersionsDumpEntryJson upgradedVersionsEntry = VersionsDumpEntryJson.create().nodeId(sourceVersionsEntry.getNodeId()).versions(upgradedVersionList).build();
    return !sourceVersionsEntry.equals(upgradedVersionsEntry) ? serialize(upgradedVersionsEntry) : entryContent.getBytes(StandardCharsets.UTF_8);
}
Also used : VersionDumpEntryJson(com.enonic.xp.repo.impl.dump.serializer.json.VersionDumpEntryJson) VersionsDumpEntryJson(com.enonic.xp.repo.impl.dump.serializer.json.VersionsDumpEntryJson)

Example 3 with VersionDumpEntryJson

use of com.enonic.xp.repo.impl.dump.serializer.json.VersionDumpEntryJson 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

VersionDumpEntryJson (com.enonic.xp.repo.impl.dump.serializer.json.VersionDumpEntryJson)3 BranchDumpEntryJson (com.enonic.xp.repo.impl.dump.serializer.json.BranchDumpEntryJson)2 VersionsDumpEntryJson (com.enonic.xp.repo.impl.dump.serializer.json.VersionsDumpEntryJson)1