All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.adobe.forms.common.service.DataOptions Maven / Gradle / Ivy

/*
 * ADOBE CONFIDENTIAL
 *   ___________________
 *
 *    Copyright 2016 Adobe Systems Incorporated
 *    All Rights Reserved.
 *
 *   NOTICE:  All information contained herein is, and remains
 *   the property of Adobe Systems Incorporated and its suppliers,
 *   if any.  The intellectual and technical concepts contained
 *   herein are proprietary to Adobe Systems Incorporated and its
 *   suppliers and are protected by all applicable intellectual property
 *   laws, including trade secret and copyright laws.
 *   Dissemination of this information or reproduction of this material
 *   is strictly forbidden unless prior written permission is obtained
 *   from Adobe Systems Incorporated.
 */
package com.adobe.forms.common.service;

import org.apache.sling.api.resource.Resource;

import java.util.Map;

/**
 * The DataOptions captures the set of parameters to be passed to the DataProvider for getting the data
 * for a form. The following options are supported currently
 * dataRef : path of the data
 * formResource : resource of the Form for which the data is required
 * pagePath : path of the page which renders the form
 * aemFormContainer : If the Form is being embedded inside an AEM Form Container than the path of the AEM Form Container
 *                    resource. It can be null if the form is not being embedded inside a Container.
 * content type : content type of the data
 */
public class DataOptions {
    private String dataRef;
    private Resource formResource;
    private String pagePath;
    private Resource aemFormContainer;
    private String serviceName;
    private Map extras;
    private ContentType contentType;

    /**
     * path of the data being passed as the sling request parameter or request attribute.
     * @return path of the data being passed as the sling request parameter or request attribute or null if nothing passed
     */
    public String getDataRef() {
        return dataRef;
    }

    /**
     * set the path of the data from where the data has to be obtained
     * @param dataRef path of the data from where the data has to be obtained
     */
    public void setDataRef(String dataRef) {
        this.dataRef = dataRef;
    }

    /**
     * Form resource present inside DAM for which the data is required.
     * @return resource of the form that is being rendered
     */
    public Resource getFormResource() {
        return formResource;
    }

    /**
     * Form resource present inside DAM for which the data is required.
     * @param formResource Form resource present inside DAM for which the data is required.
     */
    public void setFormResource(Resource formResource) {
        this.formResource = formResource;
    }

    /**
     * Path of the page where the form resides. For adaptive form it will be the path of the page and for mobile form
     * it will be the path of the profile which is rendering the Form.
     * @return Path of the page where the form resides
     */
    public String getPagePath() {
        return pagePath;
    }

    /**
     * Path of the page/profile (for MF) where the form resides.
     * @param pagePath Path of the page/profile (for MF) where the form resides.
     */
    public void setPagePath(String pagePath) {
        this.pagePath = pagePath;
    }

    /**
     * Container (if any) resource in which the form is being embedded.
     * @return container if the form is being embedded otherwise null
     */
    public Resource getAemFormContainer() {
        return aemFormContainer;
    }

    /**
     * Container (if any) resource in which the form is being embedded.
     * @param aemFormContainer Container (if any) resource in which the form is being embedded.
     */
    public void setAemFormContainer(Resource aemFormContainer) {
        this.aemFormContainer = aemFormContainer;
    }

    /**
     * returns the name of the service to be used for getting the data.
     * @return name of the service or null if nothing is set
     */
    public String getServiceName() {
        return serviceName;
    }

    /**
     * set the name of the service to be used for getting the data. If none provided, all the available service
     * will be queried for the data
     * @param serviceName name of the service to be used for getting the data.
     */
    public void setServiceName(String serviceName) {
        this.serviceName = serviceName;
    }

    /**
     * Returns the parameter map
     * @return map containing the parameters
     */
    public Map getExtras(){
        return extras;
    }

    /**
     * Sets the extra parameter map. This parameter map is any custom payload which has to be made
     * available to the prefill service
     * A sample example could be to fetch a map from a request attribute and set it to this params.
     * @param extras map of extra parameters.
     */
    public void setExtras(Map extras){
        this.extras = extras;
    }

    /**
     * Returns the content type
     * @return content type
     */
    public ContentType getContentType() {
        return contentType;
    }

    /**
     * Sets the content type to the data options.
     * @param contentType
     */
    public void setContentType(ContentType contentType) {
        this.contentType = contentType;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy