public static Response getBatchDeleteResponse ( App app , List < String > ids ) { try ( final Metrics . Context context = Metrics . time ( app == null ? null : app . getAppid ( ) , RestUtils . class , "batch" , "delete" ) ) { LinkedList < ParaObject > objects = new LinkedList <> ( ) ; if ( app != null && ids != null && ! ids . isEmpty ( ) ) { if ( ids . size ( ) <= Config . MAX_ITEMS_PER_PAGE ) { for ( ParaObject pobj : Para . getDAO ( ) . readAll ( app . getAppIdentifier ( ) , ids , true ) . values ( ) ) { if ( pobj != null && pobj . getId ( ) != null && pobj . getType ( ) != null ) { // deleting apps in batch is not allowed if ( isNotAnApp ( pobj . getType ( ) ) && checkIfUserCanModifyObject ( app , pobj ) ) { objects . add ( pobj ) ; } } } Para . getDAO ( ) . deleteAll ( app . getAppIdentifier ( ) , objects ) ; } else { return getStatusResponse ( Response . Status . BAD_REQUEST , "Limit reached. Maximum number of items to delete is " + Config . MAX_ITEMS_PER_PAGE ) ; } } else { return getStatusResponse ( Response . Status . BAD_REQUEST , "Missing ids." ) ; } return Response . ok ( ) . build ( ) ; } }
Batch delete response as JSON .