Search in sources :

Example 1 with ReorderChildContentsResult

use of com.enonic.xp.content.ReorderChildContentsResult in project xp by enonic.

the class ContentServiceImpl method reorderChildren.

@Override
public ReorderChildContentsResult reorderChildren(final ReorderChildContentsParams params) {
    final ReorderChildNodesParams.Builder builder = ReorderChildNodesParams.create();
    for (final ReorderChildParams param : params) {
        builder.add(ReorderChildNodeParams.create().nodeId(NodeId.from(param.getContentToMove())).moveBefore(param.getContentToMoveBefore() == null ? null : NodeId.from(param.getContentToMoveBefore())).build());
    }
    if (params.stopInherit()) {
        builder.processor(new SetContentChildOrderProcessor());
    }
    final ReorderChildNodesResult reorderChildNodesResult = this.nodeService.reorderChildren(builder.build());
    this.nodeService.refresh(RefreshMode.SEARCH);
    final ReorderChildContentsResult result = new ReorderChildContentsResult(reorderChildNodesResult.getSize());
    contentAuditLogSupport.reorderChildren(params, result);
    return result;
}
Also used : ReorderChildParams(com.enonic.xp.content.ReorderChildParams) ReorderChildNodesParams(com.enonic.xp.node.ReorderChildNodesParams) ReorderChildNodesResult(com.enonic.xp.node.ReorderChildNodesResult) ReorderChildContentsResult(com.enonic.xp.content.ReorderChildContentsResult)

Aggregations

ReorderChildContentsResult (com.enonic.xp.content.ReorderChildContentsResult)1 ReorderChildParams (com.enonic.xp.content.ReorderChildParams)1 ReorderChildNodesParams (com.enonic.xp.node.ReorderChildNodesParams)1 ReorderChildNodesResult (com.enonic.xp.node.ReorderChildNodesResult)1