Search in sources :

Example 1 with NodeCommitEntry

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);
}
Also used : NodeIds(com.enonic.xp.node.NodeIds) NodeCommitEntryMapper(com.enonic.xp.lib.node.mapper.NodeCommitEntryMapper) NodeCommitEntry(com.enonic.xp.node.NodeCommitEntry)

Example 2 with NodeCommitEntry

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());
}
Also used : RoutableNodeVersionIds(com.enonic.xp.node.RoutableNodeVersionIds) RoutableNodeVersionId(com.enonic.xp.node.RoutableNodeVersionId) NodeCommitEntry(com.enonic.xp.node.NodeCommitEntry) NodeBranchEntry(com.enonic.xp.node.NodeBranchEntry)

Example 3 with NodeCommitEntry

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()));
}
Also used : NodeCommitEntry(com.enonic.xp.node.NodeCommitEntry)

Example 4 with NodeCommitEntry

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();
    }
}
Also used : NodeCommitEntry(com.enonic.xp.node.NodeCommitEntry) NodeCommitId(com.enonic.xp.node.NodeCommitId) CommitDumpEntryJson(com.enonic.xp.repo.impl.dump.serializer.json.CommitDumpEntryJson)

Example 5 with NodeCommitEntry

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);
}
Also used : RoutableNodeVersionIds(com.enonic.xp.node.RoutableNodeVersionIds) NodeBranchEntries(com.enonic.xp.node.NodeBranchEntries) FindNodePathsByQueryResult(com.enonic.xp.node.FindNodePathsByQueryResult) NodePaths(com.enonic.xp.node.NodePaths) Nodes(com.enonic.xp.node.Nodes) SetNodeStateResult(com.enonic.xp.node.SetNodeStateResult) FindNodesByMultiRepoQueryResult(com.enonic.xp.node.FindNodesByMultiRepoQueryResult) RepositoryService(com.enonic.xp.repository.RepositoryService) NodeComparison(com.enonic.xp.node.NodeComparison) NodesHasChildrenResult(com.enonic.xp.node.NodesHasChildrenResult) Branch(com.enonic.xp.branch.Branch) Trace(com.enonic.xp.trace.Trace) NodeCommitId(com.enonic.xp.node.NodeCommitId) RepositoryId(com.enonic.xp.repository.RepositoryId) ContextAccessor(com.enonic.xp.context.ContextAccessor) NodeService(com.enonic.xp.node.NodeService) PushNodesResult(com.enonic.xp.node.PushNodesResult) BinaryReference(com.enonic.xp.util.BinaryReference) NodeSearchService(com.enonic.xp.repo.impl.search.NodeSearchService) CreateRootNodeParams(com.enonic.xp.node.CreateRootNodeParams) NodeComparisons(com.enonic.xp.node.NodeComparisons) AccessControlList(com.enonic.xp.security.acl.AccessControlList) Collectors(java.util.stream.Collectors) NodeId(com.enonic.xp.node.NodeId) RenameNodeParams(com.enonic.xp.node.RenameNodeParams) NodeCommitEntry(com.enonic.xp.node.NodeCommitEntry) OrderExpr(com.enonic.xp.query.expr.OrderExpr) RoutableNodeVersionId(com.enonic.xp.node.RoutableNodeVersionId) MoveNodeResult(com.enonic.xp.node.MoveNodeResult) BinaryService(com.enonic.xp.repo.impl.binary.BinaryService) ImportNodeVersionParams(com.enonic.xp.node.ImportNodeVersionParams) ReorderChildNodesResult(com.enonic.xp.node.ReorderChildNodesResult) IndexServiceInternal(com.enonic.xp.repo.impl.index.IndexServiceInternal) NodeVersion(com.enonic.xp.node.NodeVersion) Context(com.enonic.xp.context.Context) ApplyNodePermissionsResult(com.enonic.xp.node.ApplyNodePermissionsResult) LoadNodeResult(com.enonic.xp.node.LoadNodeResult) NodeCommitQuery(com.enonic.xp.node.NodeCommitQuery) FindNodesByParentParams(com.enonic.xp.node.FindNodesByParentParams) FindNodesByQueryResult(com.enonic.xp.node.FindNodesByQueryResult) PushNodesListener(com.enonic.xp.node.PushNodesListener) SyncWorkResolverParams(com.enonic.xp.node.SyncWorkResolverParams) Repository(com.enonic.xp.repository.Repository) RefreshMode(com.enonic.xp.node.RefreshMode) NodeVersionQuery(com.enonic.xp.node.NodeVersionQuery) ResolveSyncWorkResult(com.enonic.xp.node.ResolveSyncWorkResult) NodeStorageService(com.enonic.xp.repo.impl.storage.NodeStorageService) EventPublisher(com.enonic.xp.event.EventPublisher) RoutableNodeVersionIds(com.enonic.xp.node.RoutableNodeVersionIds) CreateNodeParams(com.enonic.xp.node.CreateNodeParams) MultiRepoNodeQuery(com.enonic.xp.node.MultiRepoNodeQuery) GetActiveNodeVersionsParams(com.enonic.xp.node.GetActiveNodeVersionsParams) Node(com.enonic.xp.node.Node) DuplicateNodeParams(com.enonic.xp.node.DuplicateNodeParams) NodeCommitQueryResult(com.enonic.xp.node.NodeCommitQueryResult) NodeNotFoundException(com.enonic.xp.node.NodeNotFoundException) ReorderChildNodesParams(com.enonic.xp.node.ReorderChildNodesParams) GetActiveNodeVersionsResult(com.enonic.xp.node.GetActiveNodeVersionsResult) ImportNodeResult(com.enonic.xp.node.ImportNodeResult) ImportNodeCommitParams(com.enonic.xp.node.ImportNodeCommitParams) Component(org.osgi.service.component.annotations.Component) SetNodeChildOrderParams(com.enonic.xp.node.SetNodeChildOrderParams) Tracer(com.enonic.xp.trace.Tracer) NodeVersionId(com.enonic.xp.node.NodeVersionId) NodeVersionQueryResult(com.enonic.xp.node.NodeVersionQueryResult) NodeEvents(com.enonic.xp.repo.impl.NodeEvents) FieldOrderExpr(com.enonic.xp.query.expr.FieldOrderExpr) Activate(org.osgi.service.component.annotations.Activate) ByteSource(com.google.common.io.ByteSource) NodeQuery(com.enonic.xp.node.NodeQuery) VersionIndexPath(com.enonic.xp.repo.impl.version.VersionIndexPath) InternalContext(com.enonic.xp.repo.impl.InternalContext) NodeVersionKey(com.enonic.xp.blob.NodeVersionKey) NodePath(com.enonic.xp.node.NodePath) GetNodeVersionsParams(com.enonic.xp.node.GetNodeVersionsParams) MoveNodeListener(com.enonic.xp.node.MoveNodeListener) UpdateNodeParams(com.enonic.xp.node.UpdateNodeParams) ImportNodeParams(com.enonic.xp.node.ImportNodeParams) NodeBranchEntries(com.enonic.xp.node.NodeBranchEntries) SetNodeStateParams(com.enonic.xp.node.SetNodeStateParams) BranchNotFoundException(com.enonic.xp.repository.BranchNotFoundException) ApplyNodePermissionsParams(com.enonic.xp.node.ApplyNodePermissionsParams) DeleteNodeListener(com.enonic.xp.node.DeleteNodeListener) FindNodesByParentResult(com.enonic.xp.node.FindNodesByParentResult) Reference(org.osgi.service.component.annotations.Reference) LoadNodeParams(com.enonic.xp.node.LoadNodeParams) MoveNodeParams(com.enonic.xp.node.MoveNodeParams) NodeIds(com.enonic.xp.node.NodeIds) RepositoryNotFoundException(com.enonic.xp.repository.RepositoryNotFoundException) InternalContext(com.enonic.xp.repo.impl.InternalContext)

Aggregations

NodeCommitEntry (com.enonic.xp.node.NodeCommitEntry)10 NodeCommitId (com.enonic.xp.node.NodeCommitId)5 RoutableNodeVersionId (com.enonic.xp.node.RoutableNodeVersionId)4 NodeIds (com.enonic.xp.node.NodeIds)3 NodeVersionMetadata (com.enonic.xp.node.NodeVersionMetadata)3 RoutableNodeVersionIds (com.enonic.xp.node.RoutableNodeVersionIds)3 Context (com.enonic.xp.context.Context)2 ContextAccessor (com.enonic.xp.context.ContextAccessor)2 EventPublisher (com.enonic.xp.event.EventPublisher)2 CreateNodeParams (com.enonic.xp.node.CreateNodeParams)2 CreateRootNodeParams (com.enonic.xp.node.CreateRootNodeParams)2 DuplicateNodeParams (com.enonic.xp.node.DuplicateNodeParams)2 FindNodesByParentParams (com.enonic.xp.node.FindNodesByParentParams)2 FindNodesByParentResult (com.enonic.xp.node.FindNodesByParentResult)2 GetActiveNodeVersionsParams (com.enonic.xp.node.GetActiveNodeVersionsParams)2 GetActiveNodeVersionsResult (com.enonic.xp.node.GetActiveNodeVersionsResult)2 GetNodeVersionsParams (com.enonic.xp.node.GetNodeVersionsParams)2 MoveNodeParams (com.enonic.xp.node.MoveNodeParams)2 Node (com.enonic.xp.node.Node)2 NodeCommitQuery (com.enonic.xp.node.NodeCommitQuery)2