GetStatus.java 2.24 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.adobe.dps.client.producer.EntityProducerDAO
 *  com.adobe.dps.client.producer.exceptions.ProducerException
 *  com.adobe.dps.client.producer.exceptions.ProducerRequestException
 *  com.adobe.dps.client.producer.utils.AccessToken
 *  com.adobe.dps.client.producer.utils.Session
 *  com.adobe.dps.producer.entity.dto.StatusList
 *  org.apache.sling.commons.json.JSONException
 *  org.apache.sling.commons.json.JSONObject
 */
package com.adobe.cq.mobile.dps.impl.service.actions;

import com.adobe.cq.mobile.dps.impl.service.actions.AbstractCallableDPSAction;
import com.adobe.cq.mobile.dps.impl.ui.PerfTimer;
import com.adobe.cq.mobile.dps.impl.utils.MetadataJSONUtil;
import com.adobe.dps.client.producer.EntityProducerDAO;
import com.adobe.dps.client.producer.exceptions.ProducerException;
import com.adobe.dps.client.producer.exceptions.ProducerRequestException;
import com.adobe.dps.client.producer.utils.AccessToken;
import com.adobe.dps.client.producer.utils.Session;
import com.adobe.dps.producer.entity.dto.StatusList;
import java.util.concurrent.Callable;
import org.apache.sling.commons.json.JSONException;
import org.apache.sling.commons.json.JSONObject;

public class GetStatus
extends AbstractCallableDPSAction
implements Callable<JSONObject> {
    public static final String KEY_ID = "id";
    public static final String KEY_STATUS = "status";
    private final String entityHref;

    public GetStatus(EntityProducerDAO entityAccess, AccessToken accessToken, Session session, String entityHref) {
        super(entityAccess, accessToken, session);
        this.entityHref = entityHref;
    }

    @Override
    public JSONObject call() throws Exception {
        return this.getStatus();
    }

    private JSONObject getStatus() throws ProducerException, ProducerRequestException, JSONException {
        PerfTimer perfTimer = PerfTimer.startTimer(this, this.getClass().getName());
        JSONObject statusJSON = new JSONObject();
        StatusList status = this.getStatus(this.entityHref);
        statusJSON.put("id", (Object)this.entityHref);
        statusJSON.put("status", (Object)MetadataJSONUtil.getStatusJSON(status));
        perfTimer.end();
        return statusJSON;
    }
}