MergedVariable.java 1.53 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  org.apache.commons.collections.map.MultiValueMap
 *  org.apache.commons.lang.StringUtils
 *  org.apache.sling.commons.json.JSONArray
 *  org.apache.sling.commons.json.JSONException
 *  org.apache.sling.commons.json.JSONObject
 */
package com.day.cq.analytics.sitecatalyst.rsmerger;

import java.util.Collection;
import java.util.Set;
import org.apache.commons.collections.map.MultiValueMap;
import org.apache.commons.lang.StringUtils;
import org.apache.sling.commons.json.JSONArray;
import org.apache.sling.commons.json.JSONException;
import org.apache.sling.commons.json.JSONObject;

@Deprecated
public class MergedVariable {
    private JSONObject jsonVar;
    private MultiValueMap rsidMap;

    public MergedVariable(JSONObject jsonVar) {
        this.jsonVar = jsonVar;
        this.rsidMap = new MultiValueMap();
    }

    public JSONObject getJSONVar() {
        return this.jsonVar;
    }

    public String getName() throws JSONException {
        JSONArray array = new JSONArray();
        for (Object key : this.rsidMap.keySet()) {
            String rsid = StringUtils.join((Collection)this.rsidMap.getCollection(key), (char)',');
            JSONObject jsonObj = new JSONObject();
            jsonObj.put("name", key);
            jsonObj.put("rsid", (Object)rsid);
            array.put((Object)jsonObj);
        }
        return array.toString();
    }

    public void put(String name, String rsid) {
        this.rsidMap.put((Object)name, (Object)rsid);
    }
}