DPSBannerImpl.java 2.18 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.day.cq.wcm.api.Page
 *  org.apache.sling.api.resource.ValueMap
 *  org.apache.sling.commons.json.JSONException
 *  org.apache.sling.commons.json.JSONObject
 *  org.slf4j.Logger
 *  org.slf4j.LoggerFactory
 */
package com.adobe.cq.mobile.dps.impl.metadata;

import com.adobe.cq.mobile.dps.AdType;
import com.adobe.cq.mobile.dps.DPSBanner;
import com.adobe.cq.mobile.dps.impl.metadata.AbstractDPSEntityImpl;
import com.adobe.cq.mobile.dps.impl.utils.MetadataJSONUtil;
import com.day.cq.wcm.api.Page;
import org.apache.sling.api.resource.ValueMap;
import org.apache.sling.commons.json.JSONException;
import org.apache.sling.commons.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class DPSBannerImpl
extends AbstractDPSEntityImpl
implements DPSBanner {
    private static final Logger LOGGER = LoggerFactory.getLogger(DPSBannerImpl.class);

    public DPSBannerImpl(Page page) {
        super(page);
        if (!this.getDPSResourceType().equals("dps:Banner")) {
            throw new IllegalArgumentException("Underlying page, " + page.getPath() + ", is not a " + "dps:Banner" + ".");
        }
    }

    @Override
    public boolean isAdvertisement() {
        return (Boolean)this.page.getProperties().get("dps-isAdvertisement", (Object)false);
    }

    @Override
    public AdType getAdType() {
        return AdType.getAdType((String)this.page.getProperties().get("dps-adType", String.class));
    }

    @Override
    public String getAdCategory() {
        return (String)this.page.getProperties().get("dps-adCategory", String.class);
    }

    @Override
    public String getAdvertiser() {
        return (String)this.page.getProperties().get("dps-advertiser", String.class);
    }

    @Override
    public String getTapAction() {
        return (String)this.page.getProperties().get("dps-tapAction", String.class);
    }

    @Override
    public String getTapActionURL() {
        return (String)this.page.getProperties().get("dps-tapActionURL", String.class);
    }

    @Override
    public JSONObject toJSON() throws JSONException {
        return MetadataJSONUtil.getBannerJSON(this);
    }
}