class ResourceException extends RuntimeException {

    public static int codeForSymbol(String sym) {
        String symbol = sym.toUpperCase();
        if (symbol.contains("OK")) {
            return OK;
        } else if ("CREATED".equals(symbol)) {
            return CREATED;
        } else if ("ACCEPTED".equals(symbol)) {
            return ACCEPTED;
        } else if ("NO_CONTENT".equals(symbol)) {
            return NO_CONTENT;
        } else if ("MOVED_PERMANENTLY".equals(symbol)) {
            return MOVED_PERMANENTLY;
        } else if ("FOUND".equals(symbol)) {
            return FOUND;
        } else if ("SEE_OTHER".equals(symbol)) {
            return SEE_OTHER;
        } else if ("NOT_MODIFIED".equals(symbol)) {
            return NOT_MODIFIED;
        } else if ("TEMPORARY_REDIRECT".equals(symbol)) {
            return TEMPORARY_REDIRECT;
        } else if ("BAD_REQUEST".equals(symbol)) {
            return BAD_REQUEST;
        } else if ("UNAUTHORIZED".equals(symbol)) {
            return UNAUTHORIZED;
        } else if ("FORBIDDEN".equals(symbol)) {
            return FORBIDDEN;
        } else if ("NOT_FOUND".equals(symbol)) {
            return NOT_FOUND;
        } else if ("CONFLICT".equals(symbol)) {
            return CONFLICT;
        } else if ("GONE".equals(symbol)) {
            return GONE;
        } else if ("PRECONDITION_FAILED".equals(symbol)) {
            return PRECONDITION_FAILED;
        } else if ("INTERNAL_SERVER_ERROR".equals(symbol)) {
            return INTERNAL_SERVER_ERROR;
        } else if ("NOT_IMPLEMENTED".equals(symbol)) {
            return NOT_IMPLEMENTED;
        } else if ("UNSUPPORTED_MEDIA_TYPE".equals(symbol)) {
            return UNSUPPORTED_MEDIA_TYPE;
        } else if ("SERVICE_UNAVAILABLE".equals(symbol)) {
            return SERVICE_UNAVAILABLE;
        } else {
            try {
                return Integer.parseInt(sym);
            } catch (NumberFormatException ignored) {
            }
        }
        return 0;
    }

    public  ResourceException(int code);
    public  ResourceException(int code, Object data);

}