JsonResponseSegmentList.java 1.59 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  org.apache.sling.commons.json.JSONException
 *  org.apache.sling.commons.json.JSONObject
 *  org.slf4j.Logger
 *  org.slf4j.LoggerFactory
 */
package com.adobe.cq.aam.demdex;

import com.adobe.cq.aam.client.spi.AudienceManagerConfiguration;
import com.adobe.cq.aam.client.spi.AudienceManagerItem;
import com.adobe.cq.aam.client.spi.SegmentService;
import com.adobe.cq.aam.demdex.JsonResponseSegmentIdList;
import com.adobe.cq.aam.demdex.SegmentListException;
import java.util.Iterator;
import org.apache.sling.commons.json.JSONException;
import org.apache.sling.commons.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class JsonResponseSegmentList
implements Iterable<AudienceManagerItem> {
    private static final Logger LOGGER = LoggerFactory.getLogger(JsonResponseSegmentList.class);
    private Iterable<AudienceManagerItem> items;

    public JsonResponseSegmentList(SegmentService segmentService, AudienceManagerConfiguration config, JSONObject json) throws SegmentListException {
        JsonResponseSegmentIdList segmentIds = new JsonResponseSegmentIdList(segmentService, config, json);
        this.items = segmentService.getSegments(config, segmentIds, "aam_sid");
        try {
            LOGGER.debug("Items is {} from {} ", this.items, (Object)json.toString(2));
        }
        catch (JSONException e) {
            LOGGER.debug(e.getMessage(), (Throwable)e);
        }
    }

    @Override
    public Iterator<AudienceManagerItem> iterator() {
        return this.items.iterator();
    }
}