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

com.adobe.aemds.guide.service.GuideModelTransformer Maven / Gradle / Ivy

/*************************************************************************
 *
 * ADOBE CONFIDENTIAL
 * __________________
 *
 *  Copyright 2014 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 may be covered by U.S. and Foreign Patents,
 * patents in process, and are protected by trade secret or copyright law.
 * 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.aemds.guide.service;

import com.adobe.aemds.guide.common.GuideContainer;
import com.adobe.aemds.guide.common.GuideValidationResult;
import com.adobe.aemds.guide.model.ValidationOptions;
import com.adobe.aemds.guide.transformer.api.ResourcePropertyTransformer;
import com.adobe.aemds.guide.utils.JSONCreationOptions;
import com.day.cq.i18n.I18n;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.commons.json.JSONException;
import org.apache.sling.commons.json.JSONObject;

import java.util.Locale;
import java.util.Map;

/**
 * Class representing the adaptive form model transformer
 */
public interface GuideModelTransformer {
    /**
     * @deprecated
     * @pad.exclude Exclude from Published API.
     */
    String exportGuideJson(Resource guideContainer,I18n i18n) throws GuideException;

    /**
     * @pad.exclude Exclude from Published API.
     */
    String exportGuideJson(Resource guideContainer,I18n i18n ,Locale locale) throws GuideException;

    /**
     * @deprecated
     * @pad.exclude Exclude from Published API.
     */
    JSONObject exportGuideJsonObject(Resource guideContainer) throws GuideException;

    /**
     * @pad.exclude Exclude from Published API.
     */
    JSONObject exportGuideJsonObject(Resource guideContainer, JSONCreationOptions jsonCreationOptions) throws GuideException;

    /**
     * @deprecated
     * @pad.exclude Exclude from Published API.
     */
    JSONObject exportGuideJsonObject(Resource guideContainer,I18n i18n) throws GuideException;

    /**
     * @pad.exclude Exclude from Published API.
     */
    JSONObject exportGuideJsonObject(Resource guideContainer,I18n i18n, Locale locale) throws GuideException;

    /**
     * @pad.exclude Exclude from Published API.
     */
    Map exportXfaJson(Resource guideContainer) throws GuideException;

    /**
     * @pad.exclude Exclude from Published API.
     */
    String exportGuideState(String guideStatePath) throws GuideException;

    /**
     * @pad.exclude Exclude from Published API.
     */
    String exportGuideStateFromStore(String guideStatePathRef) throws GuideException;

    /**
     * @pad.exclude Exclude from Published API.
     * @deprecated use the getDataJson API
     */
    @Deprecated
    String exportGuideDataJson(Resource guideContainer, String data, I18n i18n) throws GuideException;

    /**
     * @pad.exclude Exclude from Published API.
     * @deprecated use the getDataJson API
     */
    @Deprecated
    String exportGuideDataJsonFromDataRef(Resource guideContainer, String dataRef, I18n i18n) throws GuideException;

    /**
     *
     * @param guideContainer
     * @param locale
     * @throws GuideException
     * @private
     * @pad.exclude Exclude from Published API.
     */
    public Map syncXfaProps(GuideContainer guideContainer, String locale) throws GuideException;



    /**
     * This API should not be used, it is for internal purpose only
     * @param path
     * @private
     * @pad.exclude Exclude from Published API.
     */
    public String readFile(String path);

    /**
     * This API performs Server Side validation for an adaptive form
     * Returns an array of hash map with two keys("som", "errorText")
     * @param dataXml       String representing data of Adaptive Form in XML
     * @param resource      Resource pointing to the Adaptive Form Container
     * @param serverUrl     URL of the Server to be used for conversion of Rest Calls during server side validation
     * @param locale        Locale to be used while getting the merged json from the data xml
     * @param contextPath   context path of the server
     * @param fileAttachmentMap   file attachment map of the file attachments
     * @return Array of HashMap, Suppose the output is stored in a variable named map, then map[0].get("som") will give the som expression of the field not valid
     * and map[0].get("errorText") gives the error message of the invalid field.
     * @throws GuideException
     *
     * @see Resource
     */
    @Deprecated
    public Map[] validate(String dataXml,Resource resource, final String serverUrl, String locale, final String contextPath, final String fileAttachmentMap) throws GuideException;

 /**
     * This API performs Server Side validation for an adaptive form
     * Returns an array of hash map with two keys("som", "errorText")
     * @param dataXml       String representing data of Adaptive Form in XML
     * @param resource      Resource pointing to the Adaptive Form Container
     * @param serverUrl     URL of the Server to be used for conversion of Rest Calls during server side validation
     * @param locale        Locale to be used while getting the merged json from the data xml
     * @param contextPath   context path of the server
     * @return Array of HashMap, Suppose the output is stored in a variable named map, then map[0].get("som") will give the som expression of the field not valid
     * and map[0].get("errorText") gives the error message of the invalid field.
     * @throws GuideException
     *
     * @see Resource
     */
    @Deprecated
    public Map[] validate(String dataXml,Resource resource, final String serverUrl, String locale, final String contextPath) throws GuideException;

    /**
     * This API performs Server Side validation for an adaptive form
     * Returns an array of hash map with two keys("som", "errorText")
     * @param dataXml       String representing data of adaptive form in XML
     * @param resource      Resource pointing to the adaptive form Container
     * @param serverUrl     URL of the Server to be used for conversion of Rest Calls during server side validation
     * @param contextPath   context path of the server
     * @return Array of HashMap, Suppose the output is stored in a variable named map, then map[0].get("som") will give the som expression of the field not valid
     * and map[0].get("errorText") gives the error message of the invalid field.
     * @throws GuideException
     *
     * @see Resource
     */
    @Deprecated
    public Map[] validate(String dataXml,Resource resource, final String serverUrl, final String contextPath) throws GuideException;

    /**
     * This API performs Server Side validation for an adaptive form
     * @param  dataXml       String representing data of adaptive form in XML
     * @param  resource      Resource pointing to the adaptive form Container
     * @param  serverUrl     URL of the Server to be used for conversion of Rest Calls during server side validation
     * @param  contextPath   context path of the server
     * @param fileAttachmentMap   file attachment map of the file attachments
     * @return Result of server side validation
     * @throws GuideException
     *
     * @see GuideValidationResult
     */
    public GuideValidationResult validateData(String dataXml,Resource resource, final String serverUrl, String locale, final String contextPath, final String fileAttachmentMap) throws GuideException;

    /**
     * This API performs Server Side and captcha validation for an adaptive form
     * @param  validationOptions  ValidationOptions object, options input for validation
     * @return Result of server side and captcha validation
     * @throws GuideException
     *
     * @see GuideValidationResult
     */
    public GuideValidationResult validateForm(ValidationOptions validationOptions) throws GuideException;


    /**
     * The API returns the information about the Adaptive Form Elements required by the Expression Editor
     * @param guideContainer Adaptive Form Container resource for which the information is required
     * @return Serialized JSON of the Adaptive Form containing the properties required for each object.
     * @pad.exclude Exclude From Published API
     * @throws JSONException
     */
    public String getAdaptiveFormTreeJSON(Resource guideContainer, ResourcePropertyTransformer transformer) throws JSONException;

    /**
     * Returns the JSON after merging Guide Template with the data XML
     * @param guideContainer Guide Container resource which has to be merged with data XML
     * @param options Options for merging Guide
     * @return JSON representation of adaptive from after merging with data XML(if present)
     * @throws GuideException
     */
    public String getDataJson(Resource guideContainer, JSONCreationOptions options) throws GuideException;
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy