private ResultStatus getResultStatusForException(Exception ex) {
    Validate.notNull(ex);
    if (ex.getClass() == AuthorizationException.class) {
      return new ResultStatus(ResultStatus.STATUS.FORBIDDEN, ex);
    } else if (ex.getClass() == SystemException.class) {
      return new ResultStatus(ResultStatus.STATUS.SERVER_ERROR, ex);
    } else if (ex instanceof ObjectNotFoundException) {
      return new ResultStatus(ResultStatus.STATUS.NOT_FOUND, ex);
    } else if (ex.getClass() == UnsupportedPropertyException.class) {
      return new ResultStatus(ResultStatus.STATUS.BAD_REQUEST, ex);
    } else {
      return new ResultStatus(ResultStatus.STATUS.SERVER_ERROR, ex);
    }
  }
Factory method to create {@link ResultStatus} object for Exception.

@param ex - exception
@return ResultStatus
ambari-server/src/main/java/org/apache/ambari/server/api/services/DeleteResultMetadata.java