use of com.enonic.xp.node.NodeComparisons in project xp by enonic.
the class PushNodesCommand method execute.
public InternalPushNodesResult execute() {
final Context context = ContextAccessor.current();
refresh();
final NodeBranchEntries nodeBranchEntries = getNodeBranchEntries();
final NodeComparisons comparisons = getNodeComparisons(nodeBranchEntries);
final InternalPushNodesResult.Builder builder = pushNodes(context, nodeBranchEntries, comparisons);
refresh();
return builder.build();
}
use of com.enonic.xp.node.NodeComparisons in project xp by enonic.
the class FindNodesDependenciesCommandTest method several_layers_of_dependencies_stopped_by_status.
@Test
public void several_layers_of_dependencies_stopped_by_status() throws Exception {
final Node node1 = createNodeWithReference("n1", NodePath.ROOT, "n1_1");
final Node node1_1 = createNodeWithReference("n1_1", node1.path(), "n1_1_1");
createNodeWithReference("n1_1_1", node1_1.path());
final NodeIds dependants = FindNodesDependenciesCommand.create().recursive(true).nodeIds(NodeIds.from(node1.id())).indexServiceInternal(this.indexServiceInternal).searchService(this.searchService).storageService(this.storageService).recursionFilter(nodeIds -> {
final NodeIds.Builder filteredNodeIds = NodeIds.create();
final NodeComparisons currentLevelNodeComparisons = CompareNodesCommand.create().nodeIds(nodeIds).storageService(this.storageService).target(ContextAccessor.current().getBranch()).build().execute();
nodeIds.stream().filter(nodeId -> !CompareStatus.EQUAL.equals(currentLevelNodeComparisons.get(nodeId).getCompareStatus())).forEach(filteredNodeIds::add);
return filteredNodeIds.build();
}).build().execute();
assertEquals(1, dependants.getSize(), "Should contain 'node1_1', contains " + dependants.getAsStrings());
}
use of com.enonic.xp.node.NodeComparisons in project xp by enonic.
the class CompareContentsCommand method execute.
public CompareContentResults execute() {
this.nodeService.refresh(RefreshMode.ALL);
final NodeIds nodeIds = ContentNodeHelper.toNodeIds(this.contentIds);
final NodeComparisons comparisons = this.nodeService.compare(nodeIds, this.target);
return CompareResultTranslator.translate(comparisons);
}
Aggregations