Uploaded image for project: 'Hippo CMS'
  1. Hippo CMS
  2. CMS-13590

Leverage HST XPage Layouts while creating a new Experience Page Document

    XMLWordPrintable

Details

    • New Feature
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • 14.3.0
    • None

    Description

      In CMS-13433, support has been added to select an XPage layout

      We now need to select the XPage layouts provided by the HST

      Part 1: Repository Folder Workflow changes

      In CMS-13436, support has been added for subprototypes when creating a new document via the FolderWorkflow. It was based on the folder workflow being able to added mixin or child nodes to the newly created document.

      However it turns out to be too limiting : In CMS-13433 it turned out that when creating an hst:xpage below an XPage document variant, a transformation of the node structure is needed (eg hippo:identifier property must be taken and used as nodename below the hst:xpage of the document variant). Hence, simple copy-as-is in the Folder Workflow does not give us enough flexibility.

      Instead, we need a more flexible approach where a downstream project to the repository can create more advanced new documents. The approach we will take is as follows: To the FolderWorkflow we add:

         /**
           * @param jcrTemplateNode the JcrTemplateNode that will instruct which mixins, properties and children to add to the newly created document
           * @see #add(String, String, String) only including an JcrTemplateNode object to add extra mixins, properties and children to
           * the newly created node
           */
          String add(String category, String type, String relPath, JcrTemplateNode jcrTemplateNode)
                  throws WorkflowException, MappingException, RepositoryException, RemoteException;
      
        
          /**
           * @param jcrTemplateNode the JcrTemplateNode that will instruct which mixins, properties and children to add to the newly created document
           * @see #add(String, String, Map) only including an JcrTemplateNode object to add extra mixins, properties and children to
           * the newly created node
           */
          String add(String category, String type, Map<String, String> arguments, JcrTemplateNode jcrTemplateNode)
                  throws WorkflowException, MappingException, RepositoryException, RemoteException;
      

      The 'JcrTemplateNode' can contain mixins/properties to be added to the document variant AND it can have chilren. The JcrTemplateNode will be translated to Jcr Nodes.

      Downstream projects can inject any JcrTemplateNode they want.

      Part 2. HST / CMS changes

      Originally the plan was to get the available XPageLayout instances for
      an Experience Page folder via getting hold of the right Channel and on
      the Channel object we would get #getXpageLayouts.

      However, this turned out to be problematic: Namely, all Channel objects are
      loading actively when loading the HST Model, BUT the Hst Configurations
      (HstSite) PER Channel are loaded lazily and on request. However, the
      XPageLayout objects would need the 'hst:xpages' section from the hst
      channel configuration to be loaded, which is however only loaded as part of
      the HstSite. Storing the XPageLayout objects in a Channel object could thus
      only be done by killing the lazy loading of HstSite objects, which is not
      an option.

      A second problem was that typically the cms user adding a new XPage document
      is not allowed to read the hst XPage layout configuration nodes at all. That
      would then have to be done by some other jcr session.

      Also, during a single request, all objects resulting from hst configuration
      should have the lifecycle of the HST Model itself

      For the above reasons, it was clear that the way to go forward was:

      1. Not exposing XPageLayout objects any more via Channel since simply not
        possible
      2. During Hst Model HstComponentConfigurationService instance loading,
        directly for XPage layout pages load the JcrTemplateNode for such an
        XPage HstComponentConfigurationService instance and make sure this
        JcrTemplateNode is sealed (aka immutable)
      3. To the ChannelService, add the method
        Map<String, XPageLayout> getXPageLayouts(String channelId);
        

        which gives the CMS the possibility to invoke the following code:

        final ChannelService channelService = HippoServiceRegistry
                           .getService(PlatformServices.class).getChannelService();
        final Map<String, XPageLayout> xPageLayouts = channelService.getXPageLayouts(channelId);
        

      Only TODO is to support mixins in JcrTemplateNodeConverter which requires
      mixin support on HstNode

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              aschrijvers Ard Schrijvers
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: