@ Override public List < DocumentRevision > delete ( final String id ) throws DocumentNotFoundException , DocumentStoreException { Misc . checkNotNull ( id , "ID" ) ; try { if ( id . startsWith ( CouchConstants . _local_prefix ) ) { String localId = id . substring ( CouchConstants . _local_prefix . length ( ) ) ; deleteLocalDocument ( localId ) ; // for local documents there is no "new document" to return as the document is // removed rather than updated with a tombstone return Collections . singletonList ( null ) ; } else { return get ( queue . submitTransaction ( new DeleteAllRevisionsCallable ( id ) ) ) ; } } catch ( ExecutionException e ) { // documentnotfoundexception if it was a non-existent local document throwCauseAs ( e , DocumentNotFoundException . class ) ; String message = "Failed to delete document" ; logger . log ( Level . SEVERE , message , e ) ; throw new DocumentStoreException ( message , e . getCause ( ) ) ; } }
delete all leaf nodes