Package com.adobe.aemds.guide.utils
Class NodeStructureUtils
- java.lang.Object
-
- com.adobe.aemds.guide.utils.NodeStructureUtils
-
@Service(NodeStructureUtils.class) public class NodeStructureUtils extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_LAYOUT_GUIDECONTAINER
static java.lang.String
DEFAULT_LAYOUT_PANEL
static java.lang.String
DEFAULT_LAYOUT_ROOTPANEL
static java.lang.String
ELEMENT_PROPERTY_NAME
static java.lang.String
FRAG_REF
static java.lang.String
GUIDE_FRAG_ROOT_PANEL
static java.lang.String
GUIDE_ITEMS
static java.lang.String
GUIDECONTAINER_NODENAME
Static name of all guide related nodesstatic java.lang.String
LAYOUT_NODENAME
static java.lang.String
LAYOUT_PATH_PROPERTY
static java.lang.String
PANEL_NODENAME
static java.lang.String
ROOTPANEL_NODECLASS
static java.lang.String
ROOTPANEL_NODENAME
static java.lang.String
RT_GUIDES_LAYOUT_GUIDECONTAINER
The default layout for a guide containerstatic java.lang.String
RT_GUIDES_LAYOUT_PANEL
The default layout for a panelstatic java.lang.String
RT_GUIDES_LAYOUT_PREFIX
The prefix for all guide related layouts.static java.lang.String
RT_GUIDES_LAYOUT_ROOTPANEL
The default layout for a root panelstatic java.lang.String
RT_GUIDES_PREFIX
The prefix for all guide related resource types.static java.lang.String
RT_GUIDES_ROOTPANEL
The resource type for a root panelstatic java.lang.String
RT_PARSYS
Deprecated.
-
Constructor Summary
Constructors Constructor Description NodeStructureUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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 propertystatic java.lang.String
getFragPrefixString(Resource fragRefNode, java.lang.String previousPrefixId)
This API generates ID prefix for fragments.static java.lang.String
getGuideNavigatorTabProperty(Resource rsrc)
Returns guideNavigatorTab property of the layout resourcestatic java.lang.String
getGuideNodeHtmlId(Resource elementResource)
NOTE: If the ID generation logic is changed here, it has to be changed in AuthorUtils as wellstatic java.lang.String
getGuideNodeHtmlId(Resource elementResource, java.lang.String fragPrefixId)
static NodeStructureUtils
getInstance()
Singleton instance of NodeStructureUtils.static java.util.List
getItems(SlingHttpServletRequest request, Resource elementResource)
Check if the item node exists.static java.lang.String
getLayoutDescription(Resource rsrc)
Returns the description of the layout resourcestatic java.util.Map<java.lang.String,java.lang.Object>
getLayoutProperties(Resource elementResource)
static java.util.Map<java.lang.String,java.lang.Object>
getLayoutProperties(Resource elementResource, SlingHttpServletRequest request)
This function assumes that the elementResource contains layout node under it.static java.util.Map<java.lang.String,java.lang.Object>
getLayoutProperties(SlingHttpServletRequest request, Resource elementResource, java.lang.String cmpName)
Check if the layout node exists.static java.lang.String
getLayoutQtip(Resource rsrc)
Returns qtip of the layout resourcestatic java.util.Map<java.lang.String,java.lang.Object>
getRootPanel(SlingHttpServletRequest request, Resource elementResource)
Check if the root panel node exists.
-
-
-
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
-
LAYOUT_NODENAME
public static final java.lang.String LAYOUT_NODENAME
- 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
-
PANEL_NODENAME
public static final java.lang.String PANEL_NODENAME
- See Also:
- Constant Field Values
-
GUIDE_ITEMS
public static final java.lang.String GUIDE_ITEMS
- 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
-
FRAG_REF
public static final java.lang.String FRAG_REF
- See Also:
- Constant Field Values
-
RT_PARSYS
@Deprecated public static final java.lang.String RT_PARSYS
Deprecated.- See Also:
- Constant Field Values
-
-
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
-
getLayoutProperties
public static java.util.Map<java.lang.String,java.lang.Object> getLayoutProperties(Resource elementResource) throws PersistenceException
- 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
-
-
-