use of com.enonic.xp.node.PushNodesResult in project xp by enonic.
the class PushNodesResultMapperTest method complex.
@Test
public void complex() throws Exception {
final PushNodesResult result = PushNodesResult.create().addSuccess(createEntry("a")).addSuccess(createEntry("b")).addSuccess(createEntry("c")).addFailed(createEntry("d"), PushNodesResult.Reason.ACCESS_DENIED).addFailed(createEntry("e"), PushNodesResult.Reason.PARENT_NOT_FOUND).addFailed(createEntry("f"), PushNodesResult.Reason.PARENT_NOT_FOUND).build();
final JsonMapGenerator jsonGenerator = new JsonMapGenerator();
new PushNodesResultMapper(result, NodeIds.from("g", "h", "i")).serialize(jsonGenerator);
assertJson("nodeResult/full.json", jsonGenerator);
}
use of com.enonic.xp.node.PushNodesResult in project xp by enonic.
the class PushNodeHandler method execute.
@Override
public Object execute() {
final NodeIds.Builder toBePushed = NodeIds.create();
final NodeIds.Builder toBeDeleted = NodeIds.create();
final NodeIds nodeIds = getNodeIds();
if (resolve) {
doResolve(nodeIds, toBePushed, toBeDeleted);
} else {
toBePushed.addAll(getNodeIds());
}
final PushNodesResult push = this.nodeService.push(toBePushed.build(), targetBranch);
final NodeIds deletedNodes = doDelete(toBeDeleted);
return new PushNodesResultMapper(push, deletedNodes);
}
Aggregations