- if (responseString.equals("success")) {
- loggingContext.transactionEnded();
- PolicyLogger.info("Policy successfully deleted!");
- PolicyLogger.audit("Policy successfully deleted!");
- response.setStatus(HttpServletResponse.SC_OK);
- response.addHeader("successMapKey", "success");
- response.addHeader("operation", "delete");
- return;
- } else if (responseString.equals("No Group")) {
- String message = XACMLErrorConstants.ERROR_DATA_ISSUE + "Group update had bad input.";
- PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " Group update had bad input.");
- response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- response.addHeader(ERROR, "groupUpdate");
- response.addHeader("message", message);
- return;
- } else if (responseString.equals("DB Error")) {
- PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW + " Error while updating group in the database");
- response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- response.addHeader(ERROR, "deleteDB");
- return;
- } else {
- PolicyLogger.error(MessageCodes.ERROR_UNKNOWN + " Failed to delete the policy for an unknown reason. Check the file system and other logs for further information.");
- response.addHeader(ERROR, UNKNOWN);
- response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR );
- return;
+ switch (responseString) {
+ case "success":
+ loggingContext.transactionEnded();
+ PolicyLogger.info("Policy successfully deleted!");
+ PolicyLogger.audit("Policy successfully deleted!");
+ response.setStatus(HttpServletResponse.SC_OK);
+ response.addHeader("successMapKey", "success");
+ response.addHeader("operation", "delete");
+ break;
+ case "No Group":
+ String message = XACMLErrorConstants.ERROR_DATA_ISSUE + "Group update had bad input.";
+ PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " Group update had bad input.");
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ response.addHeader(ERROR, "groupUpdate");
+ response.addHeader("message", message);
+ break;
+ case "DB Error":
+ PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW + " Error while updating group in the database");
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ response.addHeader(ERROR, "deleteDB");
+ break;
+ default:
+ PolicyLogger.error(MessageCodes.ERROR_UNKNOWN +
+ " Failed to delete the policy for an unknown reason. Check the file system and other logs " +
+ "for " +
+ "further information.");
+ response.addHeader(ERROR, UNKNOWN);
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ break;