use of com.enonic.xp.node.MoveNodeResult in project xp by enonic.
the class NodeServiceImpl method rename.
@Override
public Node rename(final RenameNodeParams params) {
verifyContext();
final MoveNodeResult moveNodeResult = RenameNodeCommand.create().params(params).indexServiceInternal(this.indexServiceInternal).storageService(this.nodeStorageService).searchService(this.nodeSearchService).build().execute();
if (!moveNodeResult.getMovedNodes().isEmpty()) {
this.eventPublisher.publish(NodeEvents.renamed(moveNodeResult.getMovedNodes().get(0).getPreviousPath(), moveNodeResult.getMovedNodes().get(0).getNode()));
return moveNodeResult.getMovedNodes().get(0).getNode();
} else {
return nodeStorageService.get(params.getNodeId(), InternalContext.from(ContextAccessor.current()));
}
}
use of com.enonic.xp.node.MoveNodeResult in project xp by enonic.
the class NodeServiceImpl method move.
@Override
public Node move(final MoveNodeParams params) {
verifyContext();
final MoveNodeResult moveNodeResult = MoveNodeCommand.create().id(params.getNodeId()).newParent(params.getParentNodePath()).indexServiceInternal(this.indexServiceInternal).storageService(this.nodeStorageService).searchService(this.nodeSearchService).moveListener(params.getMoveListener()).processor(params.getProcessor()).build().execute();
if (!moveNodeResult.getMovedNodes().isEmpty()) {
this.eventPublisher.publish(NodeEvents.moved(moveNodeResult));
return moveNodeResult.getMovedNodes().get(0).getNode();
} else {
return nodeStorageService.get(params.getNodeId(), InternalContext.from(ContextAccessor.current()));
}
}
Aggregations