Package com.adobe.aemds.guide.utils
Class GuideUtils
- java.lang.Object
-
- com.adobe.aemds.guide.utils.GuideUtils
-
public class GuideUtils extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description GuideUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static boolean
checkIfForms(Resource resource)
This API check if the given resource is a form by looking for resource type property of jcr:content/guideContainerstatic boolean
checkIfFormsTemplate(Resource resource)
This API check if the given resource(template) is a forms template by looking for guideComponentType property in jcr:content node of templatestatic java.lang.String
convertADAssetPathToWebChannelPagePath(java.lang.String FMDocAssetPath)
static java.lang.String
convertFMAssetPathToContainerPath(java.lang.String fragRef)
This API converts DAM asset path to adaptive forms page's container path e.g.static java.lang.String
convertFMAssetPathToFormPagePath(java.lang.String FMAssetPath)
static java.lang.String
convertGuideContainerPathToFMAssetMetadataPath(java.lang.String guideContainerPath)
Get Form Asset Meatadata path in form manager for given form container pathstatic java.lang.String
convertGuideContainerPathToFMAssetPath(java.lang.String guideContainerPath)
Get Form Asset path from the given form container pathstatic java.lang.String
encodeForHtml(java.lang.String str, com.adobe.granite.xss.XSSAPI xssapi)
Encodes the given string as HTML contentstatic java.lang.String
encodeForHtml(java.lang.String str, XSSAPI xssapi)
Encodes the given string as HTML content using apache librarystatic java.lang.String
encodeForHtmlAttr(java.lang.String str, com.adobe.granite.xss.XSSAPI xssapi)
Deprecated.static java.lang.String
encodeForJSString(java.lang.String str, com.adobe.granite.xss.XSSAPI xssapi)
Encodes the given string as java script contentstatic java.lang.String
filterHtml(java.lang.String str, com.adobe.granite.xss.XSSAPI xssapi)
static java.lang.String
getAcceptLang(SlingHttpServletRequest request)
static java.lang.String
getDataMimeType(Resource formResource)
Gives the mime type of data which as per the data model configured with the formstatic java.lang.String
getDefaultLocale(Resource resource)
static java.lang.String
getDoRTemplateRef(java.lang.String guideContainerPath, java.lang.String runtimeLocale, ResourceResolver resourceResolver)
Returns path of XDP used for DoR Template (auto generated or associated) dorType = none, dorTemplateRef =dorType = generate, dorTemplateRef = /renditions/dorTemplate/runtimeLocale dorType = select, dorTemplateRef static java.util.List<org.apache.sling.commons.json.JSONObject>
getFileAttachmentList(java.lang.String guideJsonString)
static java.util.List
getFileAttachmentList(SlingHttpServletRequest request, java.lang.String guideContainerPath)
static java.lang.String
getFormDataId(java.lang.String formContainerPath, java.lang.String submissionId)
static FormDataWrapper
getFormDataObject(SlingHttpServletRequest request)
This API returns form data wrapper that contains submitted form data including attachmentsstatic java.lang.String
getFormRelativePath(java.lang.String formContainerPath)
static java.lang.String
getFragPrefixString(Resource fragRefNode, java.lang.String previousPrefixId)
This API generates ID prefix for fragments.static java.lang.String
getGuideContainerPath(SlingHttpServletRequest request, Resource resource)
This is a public api used to extract the guideContainer asset from the content.static java.lang.String
getGuideContainerPathFromResource(SlingHttpServletRequest request, Resource resource)
This function returns the Guide Container path from any resource in the adaptive form.static java.lang.String
getGuideName(Resource rsrc)
Return the parameter name for the fieldstatic 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 com.day.cq.i18n.I18n
getI18n(SlingHttpServletRequest request, Resource guideFieldResource)
static com.day.cq.i18n.I18n
getI18n(ResourceBundleProvider resourceBundleProvider, Resource containerResource, java.util.Locale locale)
static 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
getLocale(SlingHttpServletRequest request, Resource guideContainerResource)
static java.lang.String
getLocaleParamFromRequest(SlingHttpServletRequest request)
Generic Utility for getting the language parameter from request objectstatic java.lang.String
getMetaTemplateRef(Resource guideContainerResource)
Get meta-template path associated with guide container.static java.lang.String
getNamespacedKeys(java.lang.String key)
static java.lang.String
getNormalizedNodeType(java.lang.String resourceType, java.lang.String resourceSuperType)
static java.util.ArrayList<java.lang.String>
getOptions(java.lang.String keyValueString, com.day.cq.i18n.I18n i18n, boolean removeEscaping)
static Resource
getPageResource(Resource resource)
Returns the cq:Page resource by walking up in the resource hierarchystatic java.lang.String
getRedirectUrl(java.lang.String redirectUrl, java.lang.String formPath)
Gives the redirect URL based on the given form pathstatic Resource
getRootPanel(Resource resource)
static GuidePanel
getRootPanel(Resource resource, SlingHttpServletRequest slingRequest)
static java.lang.String
getThemeClientLibName(Resource resource)
static java.lang.String
getThemeContentRef(Resource guideContainerResource)
Returns the theme content path from Guide container resourcestatic java.lang.String
getUniqueId()
Generate 16 bit secure random numberstatic java.lang.String
guideRefToDocPath(java.lang.String guideRefPath)
Utility to convert an MC DOCUMENT meta data path to the actual mc document pathstatic java.lang.String
guideRefToGuidePath(java.lang.String guideRefPath)
Utility to convert an AF(Adaptive Form) meta data path to the actual adaptive forms pathstatic java.lang.String
guideSomToComponentName(java.lang.String som)
This API returns the name of the component from the given som expression.static boolean
isAdobeTargetConfigured(Resource resource)
API to identify if adobe target is configured for the Adaptive form.static java.lang.Boolean
isEditableTemplateResource(Resource resource)
Checks if given resource lies within any editable template or not This API is using the logic of TemplateUtils.isAuthoredTemplate() in CQ/wcm to check for editable template node.static boolean
isGuideContainerResource(Resource resource)
This is a public api used to identify if a resource is a Guide Container or Wrapper resource Returns true if resource is a GuideContainer or Wrapper else returns falsestatic boolean
isMetaTemplateValid(ResourceResolver resourceResolver, java.lang.String metaTemplateRef)
Checks if path pointed by metaTemplateRef is valid resource.static java.lang.Boolean
isOldResponsiveLayout(Resource panelResource)
static boolean
isTargetEnabled(Resource guideContainerResource)
API to identify if targeting is enabled for the Adaptive form requested by the specified guide containerstatic boolean
isValidFormResource(ResourceResolver resourceResolver, java.lang.String formPath, java.lang.String formType)
Check if formPath points to valid resource of type formTypestatic boolean
isWebChannel(Resource resource)
Checks whether resource is a web channel resource.static boolean
isXDPValid(Resource guideContainer)
Checks if the give adaptive forms(using guidecontainer resource) has a valid XDP Reference to itstatic java.lang.String
nodeToString(org.w3c.dom.Node node, java.lang.Boolean omitXmlDeclaration)
convert node object to string.static SlingHttpServletResponse
processInternalPostOnRestEndPoint(SlingHttpServletRequest request, SlingHttpServletResponse response, java.lang.String postUrl)
Forwards the given request using HTTP Post to the given post urlstatic void
putQueryParamsToRedirectRequest(java.lang.String responseString, java.util.Map<java.lang.String,java.lang.String> redirectParameters)
static java.lang.String
removeChannelNameFromEndIfExist(java.lang.String pagePath)
static java.lang.String[]
sanitizeLocaleList(java.lang.String[] locales)
This is to sanitize the localisation service locales They are in pt-br format, we will try to sanitize them to ptBR formatstatic boolean
setButtonForPanel(java.lang.String title, com.day.cq.wcm.api.components.EditContext editContext, SlingHttpServletRequest request, java.lang.String currentPanelPath, java.lang.String bindRef, java.lang.String handler)
Sets the button in the edit bar for the panel based on the title and handler.static boolean
setButtonForPanel(java.lang.String title, com.day.cq.wcm.api.components.EditContext editContext, SlingHttpServletRequest request, java.lang.String currentPanelPath, java.lang.String bindRef, java.lang.String handler, java.lang.Integer index)
Sets the button in the edit bar for the panel based on the title, handler and index.static boolean
setEmbedFragButton(java.lang.String title, com.day.cq.wcm.api.components.EditContext editContext, SlingHttpServletRequest request, java.lang.String fragRef, java.lang.String currentPanelPath, java.lang.String bindRef)
Sets the embed fragment button in the edit bar for the panel based on the title, handler and index.static void
setMasterAuthoringConfig(java.util.Map<java.lang.String,java.lang.Object> authoringConfig, ValueMap resourceProps)
static boolean
setToolbarLabel(java.lang.String name, java.lang.String title, com.day.cq.wcm.api.components.EditContext editContext, SlingHttpServletRequest request)
static java.lang.String
translateOrReturnOriginal(java.lang.String original, com.day.cq.i18n.I18n i18n)
-
-
-
Method Detail
-
getGuideContainerPath
public static java.lang.String getGuideContainerPath(SlingHttpServletRequest request, Resource resource)
This is a public api used to extract the guideContainer asset from the content. Returns inline guide container if there is no guideRef property present in the guideContainer else returns the guideContainer present inline- Parameters:
request
- sling http servlet requestresource
- sling resource- Returns:
- path to the form container
-
guideSomToComponentName
public static java.lang.String guideSomToComponentName(@Nonnull java.lang.String som)
This API returns the name of the component from the given som expression. Eg - If som = guide[0].guide1[0].guideRootPanel[0].numericbox[0], then this API will return numericbox.- Parameters:
som
- script object model of form component
-
getFileAttachmentList
public static java.util.List getFileAttachmentList(SlingHttpServletRequest request, java.lang.String guideContainerPath)
- Parameters:
request
-guideContainerPath
-- Returns:
-
getOptions
public static java.util.ArrayList<java.lang.String> getOptions(java.lang.String keyValueString, com.day.cq.i18n.I18n i18n, boolean removeEscaping)
- Parameters:
keyValueString
-i18n
-- Returns:
-
getFileAttachmentList
public static java.util.List<org.apache.sling.commons.json.JSONObject> getFileAttachmentList(@Nonnull java.lang.String guideJsonString)
- Returns:
-
getFormDataObject
public static FormDataWrapper getFormDataObject(SlingHttpServletRequest request)
This API returns form data wrapper that contains submitted form data including attachments- Parameters:
request
- sling request- Throws:
org.apache.sling.commons.json.JSONException
-
setToolbarLabel
public static boolean setToolbarLabel(java.lang.String name, java.lang.String title, com.day.cq.wcm.api.components.EditContext editContext, SlingHttpServletRequest request)
-
encodeForHtml
public static java.lang.String encodeForHtml(java.lang.String str, com.adobe.granite.xss.XSSAPI xssapi)
Encodes the given string as HTML content- Parameters:
str
- string to encode as HTML contentxssapi
-XSSAPI
instance- Returns:
- encoded HTML content
-
encodeForHtml
public static java.lang.String encodeForHtml(java.lang.String str, XSSAPI xssapi)
Encodes the given string as HTML content using apache library- Parameters:
str
- string to encode as HTML contentxssapi
-XSSAPI
instance- Returns:
- encoded HTML content
-
encodeForHtmlAttr
@Deprecated public static java.lang.String encodeForHtmlAttr(java.lang.String str, com.adobe.granite.xss.XSSAPI xssapi)
Deprecated.Encodes the given string as HTML attribute- Parameters:
str
- string to encode as HTML attributexssapi
-XSSAPI
instance- Returns:
- encoded HTML attribute
-
encodeForJSString
public static java.lang.String encodeForJSString(java.lang.String str, com.adobe.granite.xss.XSSAPI xssapi)
Encodes the given string as java script content- Parameters:
str
- string to encode as java script contentxssapi
-XSSAPI
instance- Returns:
- encoded JS string
-
filterHtml
public static java.lang.String filterHtml(java.lang.String str, com.adobe.granite.xss.XSSAPI xssapi)
-
getDefaultLocale
public static java.lang.String getDefaultLocale(Resource resource)
-
getThemeClientLibName
public static java.lang.String getThemeClientLibName(Resource resource)
-
getLocale
public static java.lang.String getLocale(SlingHttpServletRequest request, Resource guideContainerResource)
- Parameters:
request
-guideContainerResource
-- Returns:
- the first locale in the accept Lang header, which has a correspoiding guide-i18n clientlib
-
getI18n
public static com.day.cq.i18n.I18n getI18n(SlingHttpServletRequest request, Resource guideFieldResource)
- Parameters:
request
-guideFieldResource
-- Returns:
- the i18n object for the guide level dictionary
-
getI18n
public static com.day.cq.i18n.I18n getI18n(ResourceBundleProvider resourceBundleProvider, Resource containerResource, java.util.Locale locale)
- Parameters:
resourceBundleProvider
-containerResource
-locale
-- Returns:
- the i18n object for the guide level dictionary
-
getDataMimeType
public static java.lang.String getDataMimeType(Resource formResource)
Gives the mime type of data which as per the data model configured with the form- Parameters:
formResource
- resource of adaptive form container- Returns:
- string representing the mime type
-
guideRefToGuidePath
public static java.lang.String guideRefToGuidePath(java.lang.String guideRefPath)
Utility to convert an AF(Adaptive Form) meta data path to the actual adaptive forms path- Parameters:
guideRefPath
- path of the adaptive forms metadata node- Returns:
- the path of the adaptive form
-
guideRefToDocPath
public static java.lang.String guideRefToDocPath(java.lang.String guideRefPath)
Utility to convert an MC DOCUMENT meta data path to the actual mc document path- Parameters:
guideRefPath
- path of the mc document metadata node- Returns:
- the path of the mc document path
-
convertFMAssetPathToFormPagePath
public static java.lang.String convertFMAssetPathToFormPagePath(java.lang.String FMAssetPath)
-
convertGuideContainerPathToFMAssetPath
public static java.lang.String convertGuideContainerPathToFMAssetPath(java.lang.String guideContainerPath)
Get Form Asset path from the given form container path- Parameters:
guideContainerPath
- path to the form container- Returns:
- corresponding path of Form Manager Form Asset
-
removeChannelNameFromEndIfExist
public static java.lang.String removeChannelNameFromEndIfExist(java.lang.String pagePath)
-
convertGuideContainerPathToFMAssetMetadataPath
public static java.lang.String convertGuideContainerPathToFMAssetMetadataPath(java.lang.String guideContainerPath)
Get Form Asset Meatadata path in form manager for given form container path- Parameters:
guideContainerPath
- path to the adaptive form container- Returns:
- corresponding path of Form Manager Form Asset Metadata node
-
getDoRTemplateRef
public static java.lang.String getDoRTemplateRef(java.lang.String guideContainerPath, java.lang.String runtimeLocale, ResourceResolver resourceResolver)
Returns path of XDP used for DoR Template (auto generated or associated) dorType = none, dorTemplateRef =dorType = generate, dorTemplateRef = /renditions/dorTemplate/runtimeLocale dorType = select, dorTemplateRef - Parameters:
guideContainerPath
-runtimeLocale
- localeresourceResolver
-- Returns:
- path of XDP used for DoR Template
-
isXDPValid
public static boolean isXDPValid(Resource guideContainer)
Checks if the give adaptive forms(using guidecontainer resource) has a valid XDP Reference to it- Parameters:
guideContainer
- resource of the adaptive form container- Returns:
- false if the resource is null or xdpRef property is null/empty string, true otherwise
-
isMetaTemplateValid
public static boolean isMetaTemplateValid(ResourceResolver resourceResolver, java.lang.String metaTemplateRef)
Checks if path pointed by metaTemplateRef is valid resource.- Parameters:
resourceResolver
- ResourceResolver to resolve path- Returns:
- false if the resource is null or metaTemplateRef property is null/empty string, true otherwise
-
getMetaTemplateRef
public static java.lang.String getMetaTemplateRef(Resource guideContainerResource)
Get meta-template path associated with guide container.- Parameters:
guideContainerResource
- guide container resource object- Returns:
- returns path to meta-template if exists otherwise empty string
-
isGuideContainerResource
public static boolean isGuideContainerResource(Resource resource)
This is a public api used to identify if a resource is a Guide Container or Wrapper resource Returns true if resource is a GuideContainer or Wrapper else returns false- Parameters:
resource
-
-
isTargetEnabled
public static boolean isTargetEnabled(Resource guideContainerResource)
API to identify if targeting is enabled for the Adaptive form requested by the specified guide container- Parameters:
guideContainerResource
- resource to the adaptive form container- Returns:
- true if targeting enabled false otherwise
-
isAdobeTargetConfigured
public static boolean isAdobeTargetConfigured(Resource resource)
API to identify if adobe target is configured for the Adaptive form.- Parameters:
resource
- resource to the adaptive form container- Returns:
- true if adobe target is configured otherwise false
-
processInternalPostOnRestEndPoint
public static SlingHttpServletResponse processInternalPostOnRestEndPoint(SlingHttpServletRequest request, SlingHttpServletResponse response, java.lang.String postUrl)
Forwards the given request using HTTP Post to the given post url- Parameters:
request
- sling requestresponse
- sling responsepostUrl
- URL to forward the current request- Returns:
- sling http servlet response
-
checkIfForms
public static boolean checkIfForms(Resource resource)
This API check if the given resource is a form by looking for resource type property of jcr:content/guideContainer- Parameters:
resource
- resource pointing to the page- Returns:
- boolean Indicating if the given page is a form or not
-
checkIfFormsTemplate
public static boolean checkIfFormsTemplate(Resource resource)
This API check if the given resource(template) is a forms template by looking for guideComponentType property in jcr:content node of template- Parameters:
resource
-- Returns:
- true if the resource is an AEM Forms template, false otherwise
-
getThemeContentRef
public static java.lang.String getThemeContentRef(Resource guideContainerResource)
Returns the theme content path from Guide container resource- Parameters:
guideContainerResource
- resource to the form container- Returns:
- Path to theme content resource of theme associated with guide container.
-
isWebChannel
public static boolean isWebChannel(Resource resource)
Checks whether resource is a web channel resource. It checks fd:channelType property on jcr:content node.- Parameters:
resource
-- Returns:
- boolean
-
setMasterAuthoringConfig
public static void setMasterAuthoringConfig(java.util.Map<java.lang.String,java.lang.Object> authoringConfig, ValueMap resourceProps)
-
isValidFormResource
public static boolean isValidFormResource(ResourceResolver resourceResolver, java.lang.String formPath, java.lang.String formType)
Check if formPath points to valid resource of type formType- Parameters:
resourceResolver
-formPath
-formType
- - formType is "guide" for AdaptiveForm and "mcdocument" for IC- Returns:
- boolean value
-
isEditableTemplateResource
public static java.lang.Boolean isEditableTemplateResource(Resource resource)
Checks if given resource lies within any editable template or not This API is using the logic of TemplateUtils.isAuthoredTemplate() in CQ/wcm to check for editable template node.- Parameters:
resource
-- Returns:
-
getNormalizedNodeType
public static java.lang.String getNormalizedNodeType(java.lang.String resourceType, java.lang.String resourceSuperType)
- Parameters:
resourceType
-resourceSuperType
-
-
isOldResponsiveLayout
public static java.lang.Boolean isOldResponsiveLayout(Resource panelResource)
- Parameters:
panelResource
-- Returns:
- Boolean.TRUE on first occurrence of old responsive layout Boolean.FALSE on first occurrence of new responsive layout otherwise null
-
translateOrReturnOriginal
public static java.lang.String translateOrReturnOriginal(java.lang.String original, com.day.cq.i18n.I18n i18n)
- Parameters:
original
-i18n
-
-
getGuideName
public static java.lang.String getGuideName(Resource rsrc) throws GuideException
Return the parameter name for the field- Parameters:
rsrc
- The resource- Returns:
- The parameter name.
- Throws:
GuideException
-
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)
-
getRedirectUrl
public static java.lang.String getRedirectUrl(java.lang.String redirectUrl, java.lang.String formPath)
Gives the redirect URL based on the given form path- Parameters:
redirectUrl
-formPath
-- Returns:
-
convertFMAssetPathToContainerPath
public static java.lang.String convertFMAssetPathToContainerPath(java.lang.String fragRef)
This API converts DAM asset path to adaptive forms page's container path e.g. if the path was /content/dam/formsanddocument/bla/jcr:content the return vaule will be /content/forms/af/bla/jcr:content/guideContainer- Parameters:
fragRef
- DAM asset path of Fragment- Returns:
- adaptive forms container path of fragment
-
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
-
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
-
-
setEmbedFragButton
public static boolean setEmbedFragButton(java.lang.String title, com.day.cq.wcm.api.components.EditContext editContext, SlingHttpServletRequest request, java.lang.String fragRef, java.lang.String currentPanelPath, java.lang.String bindRef)
Sets the embed fragment button in the edit bar for the panel based on the title, handler and index.- Parameters:
title
-editContext
-request
-fragRef
-currentPanelPath
-bindRef
-
-
setButtonForPanel
public static boolean setButtonForPanel(java.lang.String title, com.day.cq.wcm.api.components.EditContext editContext, SlingHttpServletRequest request, java.lang.String currentPanelPath, java.lang.String bindRef, java.lang.String handler)
Sets the button in the edit bar for the panel based on the title and handler.- Parameters:
title
-editContext
-request
-currentPanelPath
-bindRef
-handler
-- Returns:
-
setButtonForPanel
public static boolean setButtonForPanel(java.lang.String title, com.day.cq.wcm.api.components.EditContext editContext, SlingHttpServletRequest request, java.lang.String currentPanelPath, java.lang.String bindRef, java.lang.String handler, java.lang.Integer index)
Sets the button in the edit bar for the panel based on the title, handler and index.- Parameters:
title
-editContext
-request
-currentPanelPath
-bindRef
-handler
-index
-
-
getRootPanel
public static GuidePanel getRootPanel(Resource resource, SlingHttpServletRequest slingRequest)
- Parameters:
resource
-slingRequest
-
-
getAcceptLang
public static java.lang.String getAcceptLang(SlingHttpServletRequest request)
- Parameters:
request
-- Returns:
- string consisting of appropriate locale code This method will iterate through list of language in "accept-language" request header and provide with the appropriate locale code after finding the clientlibs available for localization Guide Container Locale is the fallback.
-
sanitizeLocaleList
public static java.lang.String[] sanitizeLocaleList(java.lang.String[] locales)
This is to sanitize the localisation service locales They are in pt-br format, we will try to sanitize them to ptBR format- Parameters:
locales
-- Returns:
- returns a new list of sanitized locales
-
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
-
putQueryParamsToRedirectRequest
public static void putQueryParamsToRedirectRequest(java.lang.String responseString, java.util.Map<java.lang.String,java.lang.String> redirectParameters)
- Parameters:
responseString
-redirectParameters
-
-
getLocaleParamFromRequest
public static java.lang.String getLocaleParamFromRequest(SlingHttpServletRequest request)
Generic Utility for getting the language parameter from request object- Parameters:
request
-- Returns:
- locale from request object
-
getNamespacedKeys
public static java.lang.String getNamespacedKeys(java.lang.String key)
- Parameters:
key
-
-
getPageResource
public static Resource getPageResource(Resource resource)
Returns the cq:Page resource by walking up in the resource hierarchy
-
getGuideContainerPathFromResource
public static java.lang.String getGuideContainerPathFromResource(SlingHttpServletRequest request, Resource resource)
This function returns the Guide Container path from any resource in the adaptive form. Eg - if the resource is a header/footer that is outside the guideContainer, then it traverses up to the cq:page and then searches down from cq:page for guideContainer
-
convertADAssetPathToWebChannelPagePath
public static java.lang.String convertADAssetPathToWebChannelPagePath(java.lang.String FMDocAssetPath)
-
nodeToString
public static java.lang.String nodeToString(org.w3c.dom.Node node, java.lang.Boolean omitXmlDeclaration)
convert node object to string.- Parameters:
node
- Node to be converted to string.omitXmlDeclaration
- Boolean to check if xml declaration tag should be there in converted string or not.
-
getUniqueId
public static java.lang.String getUniqueId() throws GuideException
Generate 16 bit secure random number- Returns:
- Throws:
GuideException
-
getFormRelativePath
public static java.lang.String getFormRelativePath(java.lang.String formContainerPath)
-
getFormDataId
public static java.lang.String getFormDataId(java.lang.String formContainerPath, java.lang.String submissionId)
-
-