Class NodeStructureUtils

    • Field Detail

      • GUIDECONTAINER_NODENAME

        public static final java.lang.String GUIDECONTAINER_NODENAME
        Static name of all guide related nodes
        See Also:
        Constant Field Values
      • GUIDE_FRAG_ROOT_PANEL

        public static final java.lang.String GUIDE_FRAG_ROOT_PANEL
        See Also:
        Constant Field Values
      • ROOTPANEL_NODENAME

        public static final java.lang.String ROOTPANEL_NODENAME
        See Also:
        Constant Field Values
      • ROOTPANEL_NODECLASS

        public static final java.lang.String ROOTPANEL_NODECLASS
        See Also:
        Constant Field Values
      • DEFAULT_LAYOUT_GUIDECONTAINER

        public static final java.lang.String DEFAULT_LAYOUT_GUIDECONTAINER
        See Also:
        Constant Field Values
      • DEFAULT_LAYOUT_ROOTPANEL

        public static final java.lang.String DEFAULT_LAYOUT_ROOTPANEL
        See Also:
        Constant Field Values
      • DEFAULT_LAYOUT_PANEL

        public static final java.lang.String DEFAULT_LAYOUT_PANEL
        See Also:
        Constant Field Values
      • RT_GUIDES_PREFIX

        public static java.lang.String RT_GUIDES_PREFIX
        The prefix for all guide related resource types.
      • RT_GUIDES_LAYOUT_PREFIX

        public static java.lang.String RT_GUIDES_LAYOUT_PREFIX
        The prefix for all guide related layouts.
      • RT_GUIDES_ROOTPANEL

        public static final java.lang.String RT_GUIDES_ROOTPANEL
        The resource type for a root panel
      • RT_GUIDES_LAYOUT_GUIDECONTAINER

        public static final java.lang.String RT_GUIDES_LAYOUT_GUIDECONTAINER
        The default layout for a guide container
      • RT_GUIDES_LAYOUT_ROOTPANEL

        public static final java.lang.String RT_GUIDES_LAYOUT_ROOTPANEL
        The default layout for a root panel
      • RT_GUIDES_LAYOUT_PANEL

        public static final java.lang.String RT_GUIDES_LAYOUT_PANEL
        The default layout for a panel
      • LAYOUT_PATH_PROPERTY

        public static final java.lang.String LAYOUT_PATH_PROPERTY
        See Also:
        Constant Field Values
      • ELEMENT_PROPERTY_NAME

        public static final java.lang.String ELEMENT_PROPERTY_NAME
        See Also:
        Constant Field Values
      • RT_PARSYS

        @Deprecated
        public static final java.lang.String RT_PARSYS
        Deprecated.
        See Also:
        Constant Field Values
    • Constructor Detail

      • NodeStructureUtils

        public NodeStructureUtils()
    • Method Detail

      • getInstance

        public static NodeStructureUtils getInstance()
        Singleton instance of NodeStructureUtils.
        Returns:
        a NodeStructureUtils
      • getLayoutProperties

        public static java.util.Map<java.lang.String,​java.lang.Object> getLayoutProperties​(SlingHttpServletRequest request,
                                                                                                 Resource elementResource,
                                                                                                 java.lang.String cmpName)
                                                                                          throws PersistenceException
        Check if the layout node exists. If it doesn't creates one and returns the map of properties present in it
        Returns:
        Map containing the properites
        Throws:
        PersistenceException
      • getLayoutDescription

        public static java.lang.String getLayoutDescription​(Resource rsrc)
        Returns the description of the layout resource
        Parameters:
        rsrc - The resource
        Returns:
        The parameter name.
      • getLayoutQtip

        public static java.lang.String getLayoutQtip​(Resource rsrc)
        Returns qtip of the layout resource
        Parameters:
        rsrc -
        Returns:
        layout qtip
      • getGuideNavigatorTabProperty

        public static java.lang.String getGuideNavigatorTabProperty​(Resource rsrc)
        Returns guideNavigatorTab property of the layout resource
        Parameters:
        rsrc - - the layout resource
        Returns:
        guideNavigatorTab property
      • getFragPrefixString

        public static java.lang.String getFragPrefixString​(Resource fragRefNode,
                                                           java.lang.String previousPrefixId)
        This API generates ID prefix for fragments. Suppose we have a structure GC-> rootPanel -> PanelA -> PanelB -> FragmentA -> ChildItem1 -> ChildItem2 -> FragmentB (Instance1) -> FragmentB (Instance2) Id of frag a should be gc-rootPanel-PanelB-FragmentA so prefix ID for FragmentA should be gC-rootPanel-PanelB and prefix for FragmentB (Instance1) should be gc-rootPanel-PanelB-FragmentA and prefix for Instance2 would be gc-rootPanel-PanelB. This logic is implemented by generating ID by path and removing name to get prefix
        Parameters:
        fragRefNode -
      • getGuideNodeHtmlId

        public static java.lang.String getGuideNodeHtmlId​(Resource elementResource)
        NOTE: If the ID generation logic is changed here, it has to be changed in AuthorUtils as well
      • getGuideNodeHtmlId

        public static java.lang.String getGuideNodeHtmlId​(Resource elementResource,
                                                          java.lang.String fragPrefixId)
      • getLayoutProperties

        public static java.util.Map<java.lang.String,​java.lang.Object> getLayoutProperties​(Resource elementResource,
                                                                                                 SlingHttpServletRequest request)
                                                                                          throws PersistenceException
        This function assumes that the elementResource contains layout node under it. Will return the map containing properties
        Returns:
        Map containing the properites
        Throws:
        PersistenceException
      • getRootPanel

        public static java.util.Map<java.lang.String,​java.lang.Object> getRootPanel​(SlingHttpServletRequest request,
                                                                                          Resource elementResource)
                                                                                   throws javax.jcr.RepositoryException
        Check if the root panel node exists. If it doesn't creates one and returns the map of properties present in it
        Returns:
        Map containing the properites
        Throws:
        javax.jcr.RepositoryException
      • getItems

        public static java.util.List getItems​(SlingHttpServletRequest request,
                                              Resource elementResource)
                                       throws javax.jcr.RepositoryException
        Check if the item node exists. If it doesn't creates one and returns the list of elements present inside the resource
        Returns:
        list containing all the elements present inside a resource
        Throws:
        javax.jcr.RepositoryException
      • createProperty

        public static void createProperty​(Resource elementResource,
                                          java.lang.String propName,
                                          java.lang.String propValue,
                                          java.lang.Boolean override)
        If override is set, it always set the property
        Parameters:
        elementResource -
        propName -
        propValue -
        override -