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

com.adobe.aemds.guide.service.GuideModelImporter 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.utils.SchemaImportOptions;
import com.adobe.aemds.guide.utils.LazyLoadingOptions;

import org.apache.sling.api.resource.Resource;
import org.apache.sling.commons.json.JSONArray;
import org.apache.sling.commons.json.JSONException;
import org.apache.sling.commons.json.JSONObject;
import org.xml.sax.SAXException;

import java.io.InputStream;
import java.util.Hashtable;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: deepakk
 * Date: 22/11/13
 * Time: 10:43 AM
 * To change this template use File | Settings | File Templates.
 */
/**
 * @pad.exclude Exclude from Published API.
 */
public interface GuideModelImporter {

    /**
     * Returns JSON String of the schema depending on the schemaImportOptions.
     *
     * @param schemaImportOptions
     * @return
     * @throws GuideException
     */
    public String createFormJsonFromSchema(SchemaImportOptions schemaImportOptions) throws GuideException;

    public String createFragmentJsonFromSchema(SchemaImportOptions schemaImportOptions) throws GuideException;
    /*
     *   @deprecated
     *   use createFormJsonFromSchema(SchemaImportOptions schemaImportOptions) instead.
     */
    public String importFromXSD(Resource guideContainer) throws GuideException;

    /*
     *   @deprecated
     *   use createFormJsonFromSchema(SchemaImportOptions schemaImportOptions) instead.
     */
    public String importFromXSD(InputStream xsdStream, String rootElName, String rootElNamespace) throws GuideException;

    /**
     * Depending on the schema Type, the API returns JSONArray containing root Elements of the XSD,
     * Form Data Model or JSON Schema
     *
     * @param schemaType
     * @param schemaPath
     * @return
     * @throws GuideException
     */
    public JSONArray getRootElementsFromSchema(GuideSchemaType schemaType, String schemaPath);

    public String importFromXFA(Resource guideContainer) throws GuideException;

    public Hashtable importFromXFA(String xfaFormdomJson, boolean saveXFAObjects) throws GuideException;

    /*
     * @deprecated
     * use getRootElementsFromSchema instead.
     */
    public JSONArray getXSDRootElements(String xsdPath) throws GuideException;

    /*
     *   @deprecated
     *   use createFormJsonFromSchema(SchemaImportOptions schemaImportOptions) instead.
     */
    public String importFromXSD(String xsdPath, String elementName, String elementNameSpace) throws GuideException;

    public JSONArray getSchemaDefinitions(GuideSchemaType schemaType, String schemaPath) throws GuideException;

    public boolean isSchemaValid(GuideSchemaType schemaType, String schemaPath) throws GuideException;

    public String importFromDataDictionary(Resource guideContainer) throws GuideException;

    public String importFromDataDictionary(String ddRef) throws GuideException;

    public JSONArray getXDPFragmentSubForms(String xfaPath) throws GuideException;

    /*
     *   @deprecated
     *   use getSchemaDefinitions(GuideSchemaType schemaType, String schemaPath) instead.
     */
    public JSONArray getXSDComplexTypes(String xsdPath) throws GuideException;

    /*
     *   @deprecated
     *   use createFragmentJsonFromSchema(SchemaImportOptions) instead.
     */
    public String importFromXSDForFragment(Resource guideContainer) throws GuideException;

    /*
     *   @deprecated
     *   use getDefinitionOfElement(GuideSchemaType schemaType, String schemaRef, String rootName, String bindRef) instead.
     */
    public String getTypeOfElement(String xsdRef, String rootName, String xPath) throws SAXException, JSONException;

    /**
     *
     * This API would return JSON or HTML for a on demand fragment panel or a
     * list of JSON or HTML of all the on demand components of  an AF
     * The API is to be user with the following flags set in lazyLoadingOptions
     * // Todo THIS API has to be marked private
     * GET_CHILD_PANEL_JSON-
     * GET_CHILD_FORM_JSON-
     * GET_JSON_FOR_ALL_LAZY_CHILDERN-
     * GET_CHILD_PANEL_HTML-
     * GET_CHILD_FORM_HTML-
     * GET_HTML_FOR_ALL_LAZY_CHILDREN-
     * GET_RENDER_JSON_FOR_PARENT_FORM-
     * GET_RENDER_HTML_FOR_PARENT_FORM -
     * GET_PIGGY_BANKED_JSON
     *
     * @param lazyLoadingOptions
     * @return  string representing JSON or HTML for the on demand fragment
     * @throws GuideException
     */
    public String getJSONHTMLFragmentOrForm(LazyLoadingOptions lazyLoadingOptions) throws GuideException;


    public List getLazyChildren(Resource guideContainer) throws GuideException;

    /**
     * This API converts the XSD into a JSON representation that contains the values of minOccur, type, bindRef,
     * defaultValue, maxOccur and nillable property for every Node.
     *
     * @param guideContainerResource
     * @return JSONObject representing the XSD
     * @throws GuideException
     */
    public JSONObject getSchemaJson(Resource guideContainerResource) throws GuideException;

    /**
     * Returns the definition of the element at the end of the bindRef. eg- if bindRef is a/b/c , it will return the type of c.
     *
     * @param schemaType - type of schema
     * @param schemaRef - path of schema on CRX
     * @param rootName - String, Name of the root element.
     * @param bindRef - bindRef of the element.
     * @return String
     * @throws GuideException
     */
    public String getDefinitionOfElement(GuideSchemaType schemaType, String schemaRef, String rootName, String bindRef) throws GuideException;

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy