+ rapp.setState(RappState.PRIMED);
+ throw new RappHandlerException(HttpStatus.BAD_GATEWAY, rapp.getReason());
+ }
+ if (!rapp.getRappInstances().isEmpty()) {
+ throw new RappHandlerException(HttpStatus.BAD_REQUEST,
+ "Unable to deprime as there are active rapp instances.");
+ } else {
+ throw new RappHandlerException(HttpStatus.BAD_REQUEST,
+ String.format(STATE_TRANSITION_NOT_PERMITTED, RappState.COMMISSIONED.name(),
+ rapp.getState().name()));
+ }
+ }
+
+ public ResponseEntity<String> deleteRapp(Rapp rApp) {
+ if (rApp.getRappInstances().isEmpty() && rApp.getState().equals(RappState.COMMISSIONED)) {
+ rappCacheService.deleteRapp(rApp);