@ DELETE @ Produces ( "text/plain" ) @ RequiresPermissions ( I18nPermissions . KEY_DELETE ) public Response deleteKeys ( @ QueryParam ( IS_MISSING ) Boolean isMissing , @ QueryParam ( IS_APPROX ) Boolean isApprox , @ QueryParam ( IS_OUTDATED ) Boolean isOutdated , @ QueryParam ( SEARCH_NAME ) String searchName ) { KeySearchCriteria keySearchCriteria = new KeySearchCriteria ( isMissing , isApprox , isOutdated , searchName ) ; long numberOfDeletedKeys ; if ( shouldDeleteWithoutFilter ( keySearchCriteria ) ) { numberOfDeletedKeys = keyRepository . size ( ) ; keyRepository . clear ( ) ; // If no filter are precised use the "deleteAll()" method which is more optimized } else { numberOfDeletedKeys = deleteFilteredKeys ( keySearchCriteria ) ; } return Response . ok ( String . format ( "%d deleted keys" , numberOfDeletedKeys ) ) . build ( ) ; }
Deletes all the filtered keys .