use of com.enonic.xp.node.NodeAccessException in project xp by enonic.
the class ArchiveContentCommand method execute.
ArchiveContentsResult execute() {
params.validate();
try {
final ArchiveContentsResult archivedContents = doExecute();
this.nodeService.refresh(RefreshMode.ALL);
return archivedContents;
} catch (MoveNodeException e) {
throw new ArchiveContentException(e.getMessage(), ContentNodeHelper.translateNodePathToContentPath(e.getPath()));
} catch (NodeAccessException e) {
throw new ContentAccessException(e);
}
}
use of com.enonic.xp.node.NodeAccessException in project xp by enonic.
the class ContentServiceImpl method setChildOrder.
@Override
public Content setChildOrder(final SetContentChildOrderParams params) {
try {
final SetNodeChildOrderParams.Builder builder = SetNodeChildOrderParams.create().nodeId(NodeId.from(params.getContentId())).childOrder(params.getChildOrder());
if (params.stopInherit()) {
builder.processor(new SetContentChildOrderProcessor());
}
final Node node = nodeService.setChildOrder(builder.build());
final Content content = translator.fromNode(node, true);
contentAuditLogSupport.setChildOrder(params, content);
return content;
} catch (NodeAccessException e) {
throw new ContentAccessException(e);
}
}
use of com.enonic.xp.node.NodeAccessException in project xp by enonic.
the class MoveContentCommand method execute.
MoveContentsResult execute() {
params.validate();
try {
final MoveContentsResult movedContents = doExecute();
this.nodeService.refresh(RefreshMode.ALL);
return movedContents;
} catch (MoveNodeException e) {
throw new MoveContentException(e.getMessage(), ContentPath.from(e.getPath().toString()));
} catch (NodeAlreadyExistAtPathException e) {
throw new ContentAlreadyExistsException(ContentPath.from(e.getNode().toString()), e.getRepositoryId(), e.getBranch());
} catch (NodeAccessException e) {
throw new ContentAccessException(e);
}
}
use of com.enonic.xp.node.NodeAccessException in project xp by enonic.
the class UpdateContentCommand method execute.
Content execute() {
params.validate();
validateCreateAttachments(params.getCreateAttachments());
try {
return doExecute();
} catch (NodeAccessException e) {
throw new ContentAccessException(e);
}
}
use of com.enonic.xp.node.NodeAccessException in project xp by enonic.
the class AbstractDeleteNodeCommand method deleteNodeWithChildren.
NodeBranchEntries deleteNodeWithChildren(final Node node, final Context context, final DeleteNodeListener deleteNodeListener) {
if (node.isRoot() && !allowDeleteRootNode) {
throw new OperationNotPermittedException("Not allowed to delete root-node");
}
doRefresh();
final NodeBranchEntries nodesToBeDeleted = newResolveNodesToDelete(node);
final NodeIds nodeIds = NodeIds.from(nodesToBeDeleted.getKeys());
final boolean allHasPermissions = NodesHasPermissionResolver.create(this).nodeIds(nodeIds).permission(Permission.DELETE).build().execute();
if (!allHasPermissions) {
throw new NodeAccessException(context.getAuthInfo().getUser(), node.path(), Permission.DELETE);
}
for (final List<NodeId> keysBatch : Iterables.partition(nodeIds, BATCH_SIZE)) {
this.nodeStorageService.delete(NodeIds.from(keysBatch), InternalContext.from(context));
if (deleteNodeListener != null) {
deleteNodeListener.nodesDeleted(keysBatch.size());
}
}
doRefresh();
return nodesToBeDeleted;
}
Aggregations