use of com.enonic.xp.node.Node in project xp by enonic.
the class NodeServiceImpl method getByPath.
@Override
public Node getByPath(final NodePath path) {
final Trace trace = Tracer.newTrace("node.getByPath");
if (trace == null) {
return executeGetByPath(path);
}
return Tracer.trace(trace, () -> {
trace.put("path", path);
final Node node = executeGetByPath(path);
if (node != null) {
trace.put("id", node.id());
}
return node;
});
}
use of com.enonic.xp.node.Node in project xp by enonic.
the class NodeServiceImpl method getByIdAndVersionId.
@Override
public Node getByIdAndVersionId(final NodeId id, final NodeVersionId versionId) {
final Trace trace = Tracer.newTrace("node.getByIdAndVersionId");
if (trace == null) {
return executeGetByIdAndVersionId(id, versionId);
}
return Tracer.trace(trace, () -> {
trace.put("id", id);
trace.put("versionId", versionId);
final Node node = executeGetByIdAndVersionId(id, versionId);
trace.put("path", node.path());
return node;
});
}
use of com.enonic.xp.node.Node in project xp by enonic.
the class NodeServiceImpl method getRoot.
@Override
public Node getRoot() {
verifyContext();
final Node node = doGetByPath(NodePath.ROOT);
if (node == null || node.isRoot()) {
return node;
}
throw new RuntimeException("Expected node with path " + NodePath.ROOT + " to be of type RootNode, found " + node.id());
}
use of com.enonic.xp.node.Node in project xp by enonic.
the class ReorderChildNodeCommand method resolveInsertInbetweenOrderValue.
private Long resolveInsertInbetweenOrderValue(final Long nodeAfterOrderValue, final SearchResult result) {
final NodeId nodeBeforeInsertId = NodeId.from(result.getHits().getFirst().getId());
final Node nodeBeforeInsert = doGetById(nodeBeforeInsertId);
return (nodeAfterOrderValue + nodeBeforeInsert.getManualOrderValue()) / 2;
}
use of com.enonic.xp.node.Node in project xp by enonic.
the class ReorderChildNodeCommand method resolveInsertLastOrderValue.
private Long resolveInsertLastOrderValue(final SearchResult result) {
final NodeId lastNodeId = NodeId.from(result.getHits().getFirst().getId());
final Node lastNode = doGetById(lastNodeId);
if (lastNode.getManualOrderValue() == null) {
throw new IllegalArgumentException("Node with id [" + lastNode.id() + "] missing manual order value");
}
return lastNode.getManualOrderValue() - NodeManualOrderValueResolver.ORDER_SPACE;
}
Aggregations