Search in sources :

Example 1 with NodeVersionDeleteException

use of com.enonic.xp.node.NodeVersionDeleteException in project xp by enonic.

the class DeleteVersionCommand method doExecute.

private void doExecute() {
    final Context currentContext = ContextAccessor.current();
    final NodeVersionMetadata nodeVersionMetadata = this.nodeStorageService.getVersion(this.nodeId, this.nodeVersionId, InternalContext.from(currentContext));
    if (isInUse(nodeVersionMetadata.getNodeId())) {
        throw new NodeVersionDeleteException("Cannot delete version of a node that is in use");
    }
}
Also used : InternalContext(com.enonic.xp.repo.impl.InternalContext) Context(com.enonic.xp.context.Context) NodeVersionMetadata(com.enonic.xp.node.NodeVersionMetadata) NodeVersionDeleteException(com.enonic.xp.node.NodeVersionDeleteException)

Aggregations

Context (com.enonic.xp.context.Context)1 NodeVersionDeleteException (com.enonic.xp.node.NodeVersionDeleteException)1 NodeVersionMetadata (com.enonic.xp.node.NodeVersionMetadata)1 InternalContext (com.enonic.xp.repo.impl.InternalContext)1