AnalyticsVariableUtil.java 814 Bytes
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  org.apache.commons.lang.StringUtils
 *  org.apache.sling.commons.json.JSONException
 *  org.apache.sling.commons.json.JSONObject
 */
package com.day.cq.analytics.sitecatalyst.util;

import org.apache.commons.lang.StringUtils;
import org.apache.sling.commons.json.JSONException;
import org.apache.sling.commons.json.JSONObject;

public class AnalyticsVariableUtil {
    private AnalyticsVariableUtil() {
    }

    public static int extractNumberFromID(JSONObject jsonObj) throws JSONException {
        String id;
        if (jsonObj != null && (id = jsonObj.getString("id")) != null && !StringUtils.isBlank((String)(id = id.replaceAll("\\D+", "")))) {
            return Integer.parseInt(id);
        }
        return -1;
    }
}