class LockRestrictor implements DeleteRestrictor,
                                       RenameRestrictor {

    @Override
    public PathOperationRestriction hasRestriction(final Path path) {
        final LockInfo lockInfo = lockService.retrieveLockInfo(path);
        if (lockInfo != null && lockInfo.isLocked() && !identity.getIdentifier().equals(lockInfo.lockedBy())) {
            return new PathOperationRestriction() {
                @Override
                public String getMessage(final Path path) {
                    return path.toURI() + " cannot be deleted, moved or renamed. It is locked by: " + lockInfo.lockedBy();
                }
            };
        }

        final List<LockInfo> lockInfos = lockService.retrieveLockInfos(path,
                                                                       true);
        if (lockInfos != null && !lockInfos.isEmpty()) {
            return new PathOperationRestriction() {
                @Override
                public String getMessage(final Path path) {
                    return path.toURI() + " cannot be deleted, moved or renamed. It contains the following locked files: " + lockInfos;
                }
            };
        }

        return null;
    }

}