Class DesignImporterContext

  • public class DesignImporterContext
    extends java.lang.Object
    The context that encapsulates the information related to a design import request.

    A context object is created for an import request and passed along to various classes participating in the import process. The participant classes (e.g. TagHandlers) can use the contextual information as per their needs.

    • Field Detail

      • designNode

        public Node designNode
        Represents the design node that gets created during the design import process.

        While importing a design package, the design importer unloads all the referenced assets(images, icons, styles, scripts etc.) into a design node that is uniquely associated with the page under construction. This node acts as the design path for the page that gets constructed after the import process.

      • page

        public Page page
        Represents the CQ Page that initiates the import request

        The current import workflow involves dropping of the design package on an existing page with a drop zone. The existing page itself gets transformed into the resultant page.

      • currentPage

        public Page currentPage
        The page being worked upon. This could be different from page for secondary canvases
      • componentSuffixGenerator

        public ComponentSuffixGenerator componentSuffixGenerator
        The suffix generator that generates suffixes per component names to uniquely identify them in the node hierarchy.
      • canvasBuilder

        public CanvasBuilder canvasBuilder
        The CanvasBuilder object associated with the current import request
      • htmlName

        public java.lang.String htmlName
        The name of the HTML file for which the CQ page is getting constructed.

        The design package should typically contain an index.html file at archive root level. However, it is possible to create multiple CQ pages from one design package itself. The mobile page creation exemplifies this fact. The htmlName identifies the html document the CQ page for which is getting constructed.

      • bundleContext

        public BundleContext bundleContext
        The OSGi BundleContext that may be used by the TagHandlers to interact with the OSGi framework
      • slingHttpServletRequest

        public SlingHttpServletRequest slingHttpServletRequest
        Usage of this field has been removed (keeping this field for backward compatibility)
        The sling request object associated with the current import request.

        public static final java.lang.String CHAR_ENCODING_KEY
        See Also:
        Constant Field Values
      • importWarnings

        public java.util.List<java.lang.String> importWarnings
        Placeholder for import warnings. Various participating classes may choose to log import errors in this list.
    • Constructor Detail

      • DesignImporterContext

        public DesignImporterContext​(Page page,
                                     Node designNode)
        page -
        designNode -
      • DesignImporterContext

        public DesignImporterContext​(Page page,
                                     Node designNode,
                                     java.lang.String htmlName)
        page -
        designNode -
        htmlName -
      • DesignImporterContext

        public DesignImporterContext​(Page page,
                                     Node designNode,
                                     java.lang.String htmlName,
                                     CanvasBuilder canvasBuilder)
      • DesignImporterContext

        public DesignImporterContext​(Page page,
                                     Node designNode,
                                     java.lang.String htmlName,
                                     CanvasBuilder canvasBuilder,
                                     BundleContext bundleContext)
      • DesignImporterContext

        public DesignImporterContext​(Page page,
                                     Node designNode,
                                     java.lang.String htmlName,
                                     CanvasBuilder canvasBuilder,
                                     BundleContext bundleContext,
                                     java.util.ArrayList<java.lang.String> extractedResources)
    • Method Detail

      • getAttributes

        public java.util.Map<java.lang.Object,​java.lang.Object> getAttributes()
      • getAttribute

        public java.lang.Object getAttribute​(java.lang.Object key)
      • setAttribute

        public java.lang.Object setAttribute​(java.lang.Object key,
                                             java.lang.Object value)
      • setImporter

        public void setImporter​(Resource importer)
      • getImporter

        public Resource getImporter()
      • getExtractedResources

        public java.util.ArrayList<java.lang.String> getExtractedResources()
      • addResourcesToRemove

        public void addResourcesToRemove​(java.util.Set<java.lang.String> resources)
        Registers resources that can be removed after the import has finished.
        resources - A set of paths relative to the design node
      • getResourcesToRemove

        public java.util.Set<java.lang.String> getResourcesToRemove()
        Returns the resources that can be removed after the import has finished.
        A set of paths relative to the design node