use of com.enonic.xp.node.NodeVersion in project xp by enonic.
the class RepoDumper method doStoreVersion.
private void doStoreVersion(final VersionsDumpEntry.Builder builder, final NodeVersionMetadata metaData, final RepoDumpResult.Builder dumpResult) {
try {
final NodeVersion nodeVersion = this.nodeService.getByNodeVersionKey(metaData.getNodeVersionKey());
builder.addVersion(VersionMetaFactory.create(metaData));
storeVersionBlob(metaData.getNodeVersionId(), metaData.getNodeVersionKey());
storeVersionBinaries(metaData.getNodeVersionId(), nodeVersion);
} catch (Exception e) {
dumpResult.error(DumpError.error(e.getMessage()));
}
}
use of com.enonic.xp.node.NodeVersion in project xp by enonic.
the class BranchEntryProcessor method addNode.
private void addNode(final EntryLoadResult.Builder result, final BranchDumpEntry branchDumpEntry, final VersionMeta meta) {
final NodeVersion nodeVersion = getVersion(meta);
if (nodeVersion == null) {
reportVersionError(result, meta);
return;
}
final Node node = NodeFactory.create(nodeVersion, NodeBranchEntry.create().nodeId(branchDumpEntry.getNodeId()).nodePath(meta.getNodePath()).timestamp(meta.getTimestamp()).nodeState(meta.getNodeState()).nodeVersionId(meta.getVersion()).build());
try {
this.nodeService.loadNode(LoadNodeParams.create().node(node).nodeCommitId(meta.getNodeCommitId()).build());
validateOrAddBinary(nodeVersion, result);
result.successful();
} catch (Exception e) {
final String message = String.format("Cannot load node with id %s, path %s: %s", node.id(), node.path(), 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 FlattenedPageDumpUpgrader method upgradeBlobRecord.
private void upgradeBlobRecord(final DumpBlobRecord dumpBlobRecord, final FlattenedPageDataUpgrader dataUpgrader) {
final NodeVersion nodeVersion = getNodeVersion(dumpBlobRecord);
final boolean upgraded = dataUpgrader.upgrade(nodeVersion.getData());
if (upgraded) {
writeNodeVersion(nodeVersion, dumpBlobRecord);
}
}
use of com.enonic.xp.node.NodeVersion in project xp by enonic.
the class ReindexExecutor method doReindexBranchNew.
private void doReindexBranchNew(final RepositoryId repositoryId, final ReindexResult.Builder builder, final Branch branch) {
final NodeBranchEntries nodeBranchEntries = GetBranchDataCommand.create().branch(branch).repositoryId(repositoryId).nodeSearchService(this.nodeSearchService).build().execute();
if (listener != null) {
listener.branch(repositoryId, branch, nodeBranchEntries.getSize());
}
for (final NodeBranchEntry nodeBranchEntry : nodeBranchEntries) {
final InternalContext context = InternalContext.create(ContextAccessor.current()).repositoryId(repositoryId).branch(branch).build();
final NodeVersion nodeVersion = this.nodeVersionService.get(nodeBranchEntry.getNodeVersionKey(), context);
final Node node = NodeFactory.create(nodeVersion, nodeBranchEntry);
this.indexDataService.store(node, context);
builder.add(node.id());
if (listener != null) {
listener.branchEntry(nodeBranchEntry);
}
}
}
use of com.enonic.xp.node.NodeVersion in project xp by enonic.
the class NodeStorageServiceImpl method getNode.
@Override
public Node getNode(final NodeId nodeId, final NodeVersionId nodeVersionId, final InternalContext context) {
final NodeVersionMetadata nodeVersionMetadata = versionService.getVersion(nodeId, nodeVersionId, context);
if (nodeVersionMetadata == null) {
return null;
}
final NodeVersion nodeVersion = nodeVersionService.get(nodeVersionMetadata.getNodeVersionKey(), context);
if (nodeVersion == null) {
return null;
}
return constructNode(nodeVersion, nodeVersionMetadata);
}
Aggregations