use of com.enonic.xp.node.NodeCommitEntry in project xp by enonic.
the class CommitNodeHandler method execute.
@Override
public NodeCommitEntryMapper execute() {
final NodeCommitEntry nodeCommitEntry = NodeCommitEntry.create().message(message).build();
final NodeIds nodeIds = getNodeIds();
final NodeCommitEntry createdCommitEntry = nodeService.commit(nodeCommitEntry, nodeIds);
return new NodeCommitEntryMapper(createdCommitEntry);
}
use of com.enonic.xp.node.NodeCommitEntry in project xp by enonic.
the class PublishContentCommand method commitPushedNodes.
private void commitPushedNodes(final NodeBranchEntries branchEntries) {
final String commitEntryMessage = message == null ? ContentConstants.PUBLISH_COMMIT_PREFIX : String.join(ContentConstants.PUBLISH_COMMIT_PREFIX_DELIMITER, ContentConstants.PUBLISH_COMMIT_PREFIX, message);
final NodeCommitEntry commitEntry = NodeCommitEntry.create().message(commitEntryMessage).build();
final RoutableNodeVersionIds.Builder routableNodeVersionIds = RoutableNodeVersionIds.create();
for (NodeBranchEntry branchEntry : branchEntries) {
final RoutableNodeVersionId routableNodeVersionId = RoutableNodeVersionId.from(branchEntry.getNodeId(), branchEntry.getVersionId());
routableNodeVersionIds.add(routableNodeVersionId);
}
nodeService.commit(commitEntry, routableNodeVersionIds.build());
}
use of com.enonic.xp.node.NodeCommitEntry in project xp by enonic.
the class UnpublishContentCommand method commitUnpublishedNode.
private void commitUnpublishedNode(final ContentId contentId) {
final NodeCommitEntry commitEntry = NodeCommitEntry.create().message(ContentConstants.UNPUBLISH_COMMIT_PREFIX).build();
nodeService.refresh(RefreshMode.ALL);
nodeService.commit(commitEntry, NodeIds.from(contentId.toString()));
}
use of com.enonic.xp.node.NodeCommitEntry in project xp by enonic.
the class CommitDumpUpgrader method createCommit.
private void createCommit(final RepositoryId repositoryId) {
tmpDumpWriter.openCommitsMeta(repositoryId);
try {
final NodeCommitEntry nodeCommitEntry = NodeCommitEntry.create().build();
commitId = new NodeCommitId().toString();
final CommitDumpEntryJson commitDumpEntryJson = CommitDumpEntryJson.create().commitId(commitId).message("Dump upgrade").committer(nodeCommitEntry.getCommitter().toString()).timestamp(nodeCommitEntry.getTimestamp().toString()).build();
final byte[] commitDumpEntrySerialized = serialize(commitDumpEntryJson);
tmpDumpWriter.storeTarEntry(commitDumpEntrySerialized, commitId + ".json");
} finally {
tmpDumpWriter.closeMeta();
}
}
use of com.enonic.xp.node.NodeCommitEntry in project xp by enonic.
the class NodeServiceImpl method commit.
@Override
public NodeCommitEntry commit(final NodeCommitEntry nodeCommitEntry, final NodeIds nodeIds) {
verifyContext();
final InternalContext context = InternalContext.from(ContextAccessor.current());
final RoutableNodeVersionIds.Builder routableNodeVersionIds = RoutableNodeVersionIds.create();
final NodeBranchEntries branchNodeVersions = nodeStorageService.getBranchNodeVersions(nodeIds, false, context);
branchNodeVersions.stream().map(branchEntry -> RoutableNodeVersionId.from(branchEntry.getNodeId(), branchEntry.getVersionId())).forEach(routableNodeVersionIds::add);
return nodeStorageService.commit(nodeCommitEntry, routableNodeVersionIds.build(), context);
}
Aggregations