+ public ResponseEntity<String> deleteRapp(Rapp rApp) {
+ if (rApp.getRappInstances().isEmpty() && rApp.getState().equals(RappState.COMMISSIONED)) {
+ rappCacheService.deleteRapp(rApp);
+ return ResponseEntity.ok().build();
+ } else {
+ if (!rApp.getRappInstances().isEmpty()) {
+ return ResponseEntity.badRequest()
+ .body("Unable to delete '" + rApp.getName() + "' as there are active rApp instances.");
+ } else {
+ return ResponseEntity.badRequest().body("Unable to delete '" + rApp.getName()
+ + "' as the rApp is not in COMMISSIONED state.");
+ }
+ }
+ }
+