public ResponseEntity<String> primeRapp(Rapp rapp) {
if (rapp.getState().equals(RappState.COMMISSIONED)) {
rapp.setState(RappState.PRIMING);
public ResponseEntity<String> primeRapp(Rapp rapp) {
if (rapp.getState().equals(RappState.COMMISSIONED)) {
rapp.setState(RappState.PRIMING);
} else {
return ResponseEntity.badRequest()
.body(String.format(STATE_TRANSITION_NOT_PERMITTED, RappState.PRIMED.name(),
} else {
return ResponseEntity.badRequest()
.body(String.format(STATE_TRANSITION_NOT_PERMITTED, RappState.PRIMED.name(),
public ResponseEntity<String> deprimeRapp(Rapp rapp) {
if (rapp.getState().equals(RappState.PRIMED) && rapp.getRappInstances().isEmpty()) {
rapp.setState(RappState.DEPRIMING);
public ResponseEntity<String> deprimeRapp(Rapp rapp) {
if (rapp.getState().equals(RappState.PRIMED) && rapp.getRappInstances().isEmpty()) {
rapp.setState(RappState.DEPRIMING);
if (acmDeployer.deprimeRapp(rapp) && dmeDeployer.deprimeRapp(rapp)) {
rapp.setState(RappState.COMMISSIONED);
if (acmDeployer.deprimeRapp(rapp) && dmeDeployer.deprimeRapp(rapp)) {
rapp.setState(RappState.COMMISSIONED);
} else {
if (!rapp.getRappInstances().isEmpty()) {
return ResponseEntity.badRequest().body("Unable to deprime as there are active rapp instances,");
} else {
if (!rapp.getRappInstances().isEmpty()) {
return ResponseEntity.badRequest().body("Unable to deprime as there are active rapp instances,");