use of com.enonic.xp.node.NodeId in project xp by enonic.
the class GetActiveVersionHandler method execute.
@Override
public Object execute() {
final NodeId nodeId = getNodeId(key);
if (nodeId == null) {
return null;
}
final Branch branch = ContextAccessor.current().getBranch();
final GetActiveNodeVersionsParams params = GetActiveNodeVersionsParams.create().nodeId(nodeId).branches(Branches.from(branch)).build();
final NodeVersionMetadata nodeVersionMetadata = nodeService.getActiveVersions(params).getNodeVersions().get(branch);
if (nodeVersionMetadata == null) {
return null;
}
return new NodeVersionMapper(nodeVersionMetadata);
}
use of com.enonic.xp.node.NodeId in project xp by enonic.
the class CreateNodeParamsFactory method setName.
private void setName(final String name, final CreateNodeParams.Builder builder) {
if (isNullOrEmpty(name)) {
final NodeId nodeId = new NodeId();
builder.setNodeId(nodeId);
builder.name(nodeId.toString());
} else {
builder.name(name);
}
}
use of com.enonic.xp.node.NodeId in project xp by enonic.
the class FindVersionsHandler method execute.
@Override
public Object execute() {
final NodeVersionQueryResult result;
NodeId nodeId = getNodeId(key);
if (nodeId == null) {
result = NodeVersionQueryResult.empty(0);
} else {
GetNodeVersionsParams params = GetNodeVersionsParams.create().nodeId(nodeId).from(from).size(size).build();
result = nodeService.findVersions(params);
}
return new NodeVersionsQueryResultMapper(result);
}
use of com.enonic.xp.node.NodeId in project xp by enonic.
the class PushNodeHandler method doResolve.
private void doResolve(final NodeIds nodeIds, final NodeIds.Builder toBePushed, final NodeIds.Builder toBeDeleted) {
for (final NodeId nodeId : nodeIds) {
final ResolveSyncWorkResult result = this.nodeService.resolveSyncWork(SyncWorkResolverParams.create().nodeId(nodeId).branch(targetBranch).excludedNodeIds(getNodeIds(exclude)).includeChildren(includeChildren).build());
result.getNodeComparisons().forEach(nodeComparison -> {
if (nodeComparison.getCompareStatus().equals(CompareStatus.PENDING_DELETE)) {
toBeDeleted.add(nodeComparison.getNodeId());
} else {
toBePushed.add(nodeComparison.getNodeId());
}
});
}
}
use of com.enonic.xp.node.NodeId in project xp by enonic.
the class FindNodesByParentResultMapper method serialize.
private void serialize(final MapGenerator gen, final NodeIds nodeIds) {
gen.array("hits");
for (NodeId nodeId : nodeIds) {
gen.map();
gen.value("id", nodeId);
gen.end();
}
gen.end();
}
Aggregations