use of com.enonic.xp.content.CompareContentResult in project xp by enonic.
the class PublishContentCommand method pushAndDelete.
private void pushAndDelete(final CompareContentResults results) {
NodeIds.Builder pushNodesIds = NodeIds.create();
NodeIds.Builder deletedNodesIds = NodeIds.create();
for (CompareContentResult compareResult : results) {
if (compareResult.getCompareStatus() == CompareStatus.PENDING_DELETE) {
deletedNodesIds.add(NodeId.from(compareResult.getContentId()));
} else {
pushNodesIds.add(NodeId.from(compareResult.getContentId()));
}
}
final ContentIds pushContentsIds = ContentIds.from(pushNodesIds.build().stream().map((n) -> ContentId.from(n.toString())).toArray(ContentId[]::new));
final boolean validContents = checkIfAllContentsValid(pushContentsIds);
if (validContents) {
doPushNodes(pushNodesIds.build());
} else {
this.resultBuilder.setFailed(pushContentsIds);
}
doDeleteNodes(deletedNodesIds.build());
}
use of com.enonic.xp.content.CompareContentResult in project xp by enonic.
the class ContentServiceImplTest_publish method assertStatus.
private void assertStatus(final ContentId id, CompareStatus status) {
final CompareContentResult compare = this.contentService.compare(new CompareContentParams(id, WS_OTHER));
assertEquals(status, compare.getCompareStatus());
}
Aggregations