protected Response executeCommand(ParameterMap data) {
RestActionReporter actionReport = ResourceUtil.runCommand(commandName, data, habitat,
ResourceUtil.getResultType(requestHeaders));
ActionReport.ExitCode exitCode = actionReport.getActionExitCode();
ActionReportResult option = options();
ActionReportResult results = new ActionReportResult(commandName, actionReport, option.getMetaData());
results.getActionReport().getExtraProperties().putAll(option.getActionReport().getExtraProperties());
results.setCommandDisplayName(commandDisplayName);
int status =HttpURLConnection.HTTP_OK; /*200 - ok*/
if (exitCode == ActionReport.ExitCode.FAILURE) {
status = HttpURLConnection.HTTP_INTERNAL_ERROR;
results.setErrorMessage(actionReport.getCombinedMessage());
}
return Response.status(status).entity(results).build();
}