use of com.enonic.xp.node.ResolveSyncWorkResult in project xp by enonic.
the class ResolveContentsToBePublishedCommand method getWorkResult.
private ResolveSyncWorkResult getWorkResult(final ContentId contentId) {
final NodeIds nodeIds = excludedContentIds != null ? NodeIds.from(excludedContentIds.stream().map(id -> NodeId.from(id.toString())).collect(Collectors.toList())) : NodeIds.empty();
final boolean includeChildren = excludeChildrenIds == null || !this.excludeChildrenIds.contains(contentId);
return nodeService.resolveSyncWork(SyncWorkResolverParams.create().includeChildren(includeChildren).includeDependencies(this.includeDependencies).nodeId(NodeId.from(contentId.toString())).excludedNodeIds(nodeIds).branch(this.target).statusesToStopDependenciesSearch(Set.of(CompareStatus.EQUAL)).build());
}
use of com.enonic.xp.node.ResolveSyncWorkResult in project xp by enonic.
the class ResolveContentsToBePublishedCommand method resolveDependencies.
private void resolveDependencies() {
for (final ContentId contentId : this.contentIds) {
final ResolveSyncWorkResult syncWorkResult = getWorkResult(contentId);
this.resultBuilder.addAll(CompareResultTranslator.translate(syncWorkResult.getNodeComparisons()));
}
}
use of com.enonic.xp.node.ResolveSyncWorkResult in project xp by enonic.
the class ResolveSyncWorkResultMapperTest method full.
@Test
public void full() throws Exception {
final ResolveSyncWorkResult result = ResolveSyncWorkResult.create().add(new NodeComparison(createEntry("a"), createEntry("a"), CompareStatus.NEW)).add(new NodeComparison(createEntry("b"), createEntry("b"), CompareStatus.MOVED)).add(new NodeComparison(createEntry("c"), createEntry("c"), CompareStatus.NEWER)).build();
final JsonMapGenerator jsonGenerator = new JsonMapGenerator();
new ResolveSyncWorkResultMapper(result).serialize(jsonGenerator);
assertJson("resolveSyncWork/full.json", jsonGenerator);
}
use of com.enonic.xp.node.ResolveSyncWorkResult 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());
}
});
}
}
Aggregations