Class DesignImporterContext

java.lang.Object
com.day.cq.wcm.designimporter.DesignImporterContext

public class DesignImporterContext extends 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 Details

    • 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 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

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

      public static final String CHAR_ENCODING_KEY
      See Also:
    • importWarnings

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

    • DesignImporterContext

      public DesignImporterContext(Page page, Node designNode)
      Parameters:
      page -
      designNode -
    • DesignImporterContext

      public DesignImporterContext(Page page, Node designNode, String htmlName)
      Constructor
      Parameters:
      page -
      designNode -
      htmlName -
    • DesignImporterContext

      public DesignImporterContext(Page page, Node designNode, String htmlName, CanvasBuilder canvasBuilder)
    • DesignImporterContext

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

      public DesignImporterContext(Page page, Node designNode, String htmlName, CanvasBuilder canvasBuilder, BundleContext bundleContext, ArrayList<String> extractedResources)
  • Method Details

    • getAttributes

      public Map<Object,Object> getAttributes()
    • getAttribute

      public Object getAttribute(Object key)
    • setAttribute

      public Object setAttribute(Object key, Object value)
    • setImporter

      public void setImporter(Resource importer)
    • getImporter

      public Resource getImporter()
    • getExtractedResources

      public ArrayList<String> getExtractedResources()
    • addResourcesToRemove

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

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