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

Remove a lot of "dead code" around #createVariant logic

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • 14.3.0
    • None
    • None
    • 0.5
    • Quasar
    • Puma Sprint 239, Puma Sprint 240

    Description

      The getParametersInfoAnnotation(Node) in ParametersInfoAnnotationUtils is broken for new style container item components referencing the catalog item: Those container item nodes namely do not have the classname property any more. It was tried to fix this in

      public static ParametersInfo getParametersInfoAnnotation(final Node componentItemNode) throws RepositoryException {
          
      

      by including

       final Node componentNode = componentItemNode.hasProperty(COMPONENT_PROPERTY_COMPONENTDEFINITION) ? componentItemNode.getSession()
                          .getNode(componentItemNode.getProperty(COMPONENT_PROPERTY_COMPONENTDEFINITION).getValue().getString()) : componentItemNode;
      
      

      however the code above can not work since COMPONENT_PROPERTY_COMPONENTDEFINITION does not store an absolute jcr path to a node!

      However, it turns out that the entire invocation chain to org.hippoecm.hst.util.ParametersInfoAnnotationUtils#getParametersInfoAnnotation(javax.jcr.Node) is completely unused! In java code, it is only invoked via

      ContainerItemComponentResourceInterface#createVariant
      

      However the frontend CM code NEVER invokes this method, also not for relevance! Variants are created differently.

      In file community/channel-manager/frontend-api/src/main/resources/org/onehippo/cms7/channelmanager/channeleditor/ComponentVariantAdder.js on line 5 a method gets defined which would call the #createVariant, however that method never gets invoked

      Hence we can and must do the following:

      1) Remove the broken

       final Node componentNode = componentItemNode.hasProperty(COMPONENT_PROPERTY_COMPONENTDEFINITION) ? componentItemNode.getSession()
                          .getNode(componentItemNode.getProperty(COMPONENT_PROPERTY_COMPONENTDEFINITION).getValue().getString()) : componentItemNode;
      

      2) Deprecate org.hippoecm.hst.util.ParametersInfoAnnotationUtils#getParametersInfoAnnotation(javax.jcr.Node) as of 14.3 (it is in commons so fully deleting is too much)

      3) Remove the entire call chain which is unused in the page composer from the HST

      4) Remove the code in the CM which is dead code

      Attachments

        Activity

          People

            ntrajkovski Nikola Trajkovski
            aschrijvers Ard Schrijvers
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: