use of com.enonic.xp.node.NodeVersion in project xp by enonic.
the class VersionEntryProcessor method addVersions.
private void addVersions(final EntryLoadResult.Builder result, final VersionsDumpEntry versionsDumpEntry, final Set<VersionMeta> versions) {
for (final VersionMeta version : versions) {
final NodeVersion nodeVersion = getVersion(version);
if (nodeVersion == null) {
reportVersionError(result, version);
return;
}
try {
this.nodeService.importNodeVersion(ImportNodeVersionParams.create().nodeId(versionsDumpEntry.getNodeId()).timestamp(version.getTimestamp()).nodePath(version.getNodePath()).nodeVersion(nodeVersion).nodeVersionId(version.getVersion()).nodeCommitId(version.getNodeCommitId()).build());
validateOrAddBinary(nodeVersion, result);
result.successful();
} catch (Exception e) {
final String message = String.format("Cannot load version with id %s, path %s: %s", versionsDumpEntry.getNodeId(), version.getNodePath(), e.getMessage());
result.error(EntryLoadError.error(message));
LOG.error(message, e);
}
}
}
use of com.enonic.xp.node.NodeVersion in project xp by enonic.
the class IndexConfigUpgrader method upgradeVersionMeta.
private VersionDumpEntryJson upgradeVersionMeta(final VersionDumpEntryJson version) {
final DumpBlobRecord nodeBlobRecord = dumpReader.getDumpBlobStore().getRecord(NODE_SEGMENT, BlobKey.from(version.getNodeBlobKey()));
final NodeVersionDataJson nodeVersionDataJson = getNode(nodeBlobRecord);
final NodeVersion nodeVersion = nodeVersionDataJson.fromJson().build();
if (ContentConstants.CONTENT_NODE_COLLECTION.equals(nodeVersion.getNodeType())) {
final BlobKey newIndexConfigBlob = upgradeIndexConfigDocument(BlobKey.from(version.getIndexConfigBlobKey()), nodeVersion);
return VersionDumpEntryJson.create(version).indexConfigBlobKey(newIndexConfigBlob.toString()).build();
}
return version;
}
use of com.enonic.xp.node.NodeVersion in project xp by enonic.
the class RepositoryIdDumpUpgrader method upgradeNodeVersionBlob.
private void upgradeNodeVersionBlob(final String nodeBlobKey) {
final DumpBlobRecord dumpBlobRecord = dumpReader.getDumpBlobStore().getRecord(SEGMENT, BlobKey.from(nodeBlobKey));
final NodeVersionDataJson sourceNodeVersion = getNodeVersion(dumpBlobRecord);
final NodeVersion updatedNodeVersion = sourceNodeVersion.fromJson().id(NodeId.from(upgradeString(sourceNodeVersion.getId()))).build();
writeNodeVersion(updatedNodeVersion, dumpBlobRecord);
}
use of com.enonic.xp.node.NodeVersion in project xp by enonic.
the class FlattenedPageDumpUpgrader method addTemplateControllerMapping.
private void addTemplateControllerMapping(final Pre4VersionDumpEntryJson version, final TemplateControllerMappings templateControllerMapping) {
final DumpBlobRecord dumpBlobRecord = dumpReader.getDumpBlobStore().getRecord(SEGMENT, BlobKey.from(version.getBlobKey()));
final NodeVersion nodeVersion = getNodeVersion(dumpBlobRecord);
templateControllerMapping.handle(nodeVersion.getId(), nodeVersion.getData());
}
use of com.enonic.xp.node.NodeVersion in project xp by enonic.
the class HtmlAreaDumpUpgrader method upgradeBlobRecord.
private void upgradeBlobRecord(final DumpBlobRecord nodeDumpBlobRecord, final DumpBlobRecord indexDumpBlobRecord) {
final NodeVersion nodeVersion = getNodeVersion(nodeDumpBlobRecord);
final PatternIndexConfigDocument indexConfigDocument = getIndexConfigDocument(indexDumpBlobRecord);
final boolean upgraded = upgradeNodeVersion(nodeVersion, indexConfigDocument);
if (upgraded) {
writeNodeVersion(nodeVersion, nodeDumpBlobRecord);
}
}
Aggregations