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

Expose residual parameters on PMA

    XMLWordPrintable

Details

    • Task
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • 14.3.0
    • None
    • None
    • Pulsar
    • Pulsar 236 -Dynamic Components, Pulsar 237 -DynamicComponents2

    Description

      In the current implementation of PMA, component parameters are exposed in _meta attribute in Component Window Model in JSON output. The paramsInfo attribute includes all annotation based parameters that are defined in the relevant ParametersInfo interface. This interface is attached to the component class with @ParametersInfo annotation as the example below.

       

       

      @ParametersInfo(type = EssentialsBannerComponentInfo.class)
      public class EssentialsBannerComponent extends EssentialsDocumentComponent {
      } 
      

       

      When a request comes to PMA, PageModelAggregationValve evaluates the methods of the proxy instance of the ParametersInfo interface and serializes the parameters and their actual values in paramsInfo attribute. If the parameter doesn't have any actual value, it exposes its default value.

      Another attribute with the name params in the  _meta attribute contains the parameter names and their values that exist on the jcr node of the instance component, specifically in hst:parameternames and  hst:parametervalues properties.

       

      "_meta": {
        "paramsInfo": {
            "document": "banners/banner1"
         },
         "params": {
             "document": "banners/banner1",
             "org.hippoecm.hst.core.component.template":        
                  "webfile:/freemarker/hstdefault/essentials-banner.ftl"
          }
      },
      

       

       

      A Dynamic Component Info interface implements the DynamicComponentInfo interface. DynamicComponentInfo allows residual parameters to be exposed in the paramsInfo attribute. When the getResidualParameterValues method is invoked, the parameters that are defined on the relevant catalog item are added to the return map with the current values. A sample result JSON is as follows.

       

       

      "_meta": {
        "paramsInfo": {
            "document": "banners/banner1"
            "newparamName": "newparamValue"
         },
         "params": {
             "document": "banners/banner1",
             "org.hippoecm.hst.core.component.template":        
                  "webfile:/freemarker/hstdefault/essentials-banner.ftl"
          }
      }, 
      

       

      Since paramsInfo covers all the parameters, there is no need to add params attributes to the JSON output.

       

      The technical design document of Headless Dynamic Components is available on https://docs.google.com/document/d/1iA5knck2021FuhEmkY_U9Hg_HCokmXCpcMCytzSqq5k/edit#

       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            sshepelevich Sergey Shepelevich
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: