BatchInput.java 2.79 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.adobe.aemfd.docmanager.Document
 *  org.apache.sling.api.resource.Resource
 */
package com.adobe.aemds.guide.batch.api;

import com.adobe.aemfd.docmanager.Document;
import java.util.HashMap;
import java.util.List;
import org.apache.sling.api.resource.Resource;

public class BatchInput
extends HashMap<String, Object> {
    private static final long serialVersionUID = -3422334046132064737L;
    public static final String templateId = "templateId";
    public static final String adaptiveDocument = "adaptiveDocument";
    public static final String dataXML = "dataXML";
    public static final String dataXMLs = "dataXMLs";

    public BatchInput(String templateId, Document dataXML) {
        this.setTemplateId(templateId);
        this.setDataXML(dataXML);
    }

    public BatchInput(String templateId, List<Document> dataXMLs) {
        this.setTemplateId(templateId);
        this.setDataXMLs(dataXMLs);
    }

    public BatchInput(Resource adaptiveDocument, Document dataXML) {
        this.setResource(adaptiveDocument);
        this.setDataXML(dataXML);
    }

    public BatchInput(Resource adaptiveDocument, List<Document> dataXMLs) {
        this.setResource(adaptiveDocument);
        this.setDataXMLs(dataXMLs);
    }

    public String getTemplateId() {
        return (String)this.get("templateId");
    }

    public void setTemplateId(String templateId) {
        if (this.getResource() != null) {
            throw new IllegalStateException("Input may be supplied either as a template or as a resource, but not both");
        }
        this.put("templateId", templateId);
    }

    public Resource getResource() {
        return (Resource)this.get("adaptiveDocument");
    }

    public void setResource(Resource adaptiveDocument) {
        if (this.getTemplateId() != null) {
            throw new IllegalStateException("Input may be supplied either as a template or as a resource, but not both");
        }
        this.put("adaptiveDocument", adaptiveDocument);
    }

    public Document getDataXML() {
        return (Document)this.get("dataXML");
    }

    public void setDataXML(Document dataXML) {
        if (this.getDataXMLs() != null) {
            throw new IllegalStateException("Data may be supplied either as a single monolithic XML or multiple individual XMLs, but not both");
        }
        this.put("dataXML", dataXML);
    }

    public List<Document> getDataXMLs() {
        return (List)this.get("dataXMLs");
    }

    public void setDataXMLs(List<Document> dataXMLs) {
        if (this.getDataXML() != null) {
            throw new IllegalStateException("Data may be supplied either as a single monolithic XML or multiple individual XMLs, but not both");
        }
        this.put("dataXMLs", dataXMLs);
    }
}