public class GuideUtils extends Object
| Constructor and Description |
|---|
GuideUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
checkIfForms(org.apache.sling.api.resource.Resource resource)
This API check if the given resource is a form
by looking for resource type property of jcr:content/guideContainer
|
static boolean |
checkIfFormsTemplate(org.apache.sling.api.resource.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
|
static String |
convertFMAssetPathToFormPagePath(String FMAssetPath) |
static String |
convertGuideContainerPathToFMAssetMetadataPath(String guideContainerPath)
Get Form Asset Meatadata path in form manager for given form container path
|
static String |
convertGuideContainerPathToFMAssetPath(String guideContainerPath)
Get Form Asset path from the given form container path
|
static String |
encodeForHtml(String str,
com.adobe.granite.xss.XSSAPI xssapi)
Encodes the given string as HTML content
|
static String |
encodeForHtmlAttr(String str,
com.adobe.granite.xss.XSSAPI xssapi)
Encodes the given string as HTML attribute
|
static String |
encodeForJSString(String str,
com.adobe.granite.xss.XSSAPI xssapi)
Encodes the given string as java script content
|
static String |
filterHtml(String str,
com.adobe.granite.xss.XSSAPI xssapi) |
static String |
generateSOM(org.apache.sling.api.resource.Resource element)
Recursively generates the SOM Expression of an element in guide container.
|
static String |
getDataMimeType(org.apache.sling.api.resource.Resource formResource)
Gives the mime type of data which as per the data model
configured with the form
|
static String |
getDefaultLocale(org.apache.sling.api.resource.Resource resource) |
static String |
getDoRTemplateRef(String guideContainerPath,
String runtimeLocale,
org.apache.sling.api.resource.ResourceResolver resourceResolver)
Returns path of XDP used for DoR Template (auto generated or associated)
dorType = none, dorTemplateRef =
|
static List<org.apache.sling.api.resource.Resource> |
getGuideContainerFromFormPage(org.apache.sling.api.resource.Resource formPageResource) |
static String |
getGuideContainerPath(org.apache.sling.api.SlingHttpServletRequest request,
org.apache.sling.api.resource.Resource resource)
This is a public api used to extract the guideContainer asset from the content.
|
static String |
getGuideRuntimeLocale(org.apache.sling.api.SlingHttpServletRequest slingRequest,
org.apache.sling.api.resource.Resource resource)
Returns the runtime locale in format like en-us
|
static com.day.cq.i18n.I18n |
getI18n(org.apache.sling.i18n.ResourceBundleProvider resourceBundleProvider,
org.apache.sling.api.resource.Resource containerResource,
Locale locale) |
static com.day.cq.i18n.I18n |
getI18n(org.apache.sling.api.SlingHttpServletRequest request,
org.apache.sling.api.resource.Resource guideContainerResource) |
static String |
getLocale(org.apache.sling.api.SlingHttpServletRequest request,
org.apache.sling.api.resource.Resource guideContainerResource) |
static String |
getMetaTemplateRef(org.apache.sling.api.resource.Resource guideContainerResource)
Get meta-template path associated with guide container.
|
static String |
getScriptAsStringFromClientLib(com.adobe.granite.ui.clientlibs.HtmlLibraryManager htmlLibraryManager,
String clientLibPath)
Gets the JavaScript as String from the client lib path specified.
|
static ArrayList<String> |
getScriptFromClientLibList(com.adobe.granite.ui.clientlibs.HtmlLibraryManager htmlLibraryManager,
String[] clientLibCategories)
Gets the JavaScript as a string array from clientlib categories.
|
static String |
getThemeClientLibName(org.apache.sling.api.resource.Resource resource) |
static String |
getThemeContentRef(org.apache.sling.api.resource.Resource guideContainerResource)
Returns the theme content path from Guide container resource
|
static org.apache.sling.api.resource.Resource |
getThemeResource(org.apache.sling.api.resource.Resource formResource)
Gets the theme resource for a given Adaptive Form
|
static String |
getXFALocale(String locale)
Returns the xfa compliant locale.
|
static String |
guideRefToGuidePath(String guideRefPath)
Utility to convert an AF(Adaptive Form) meta data path to the actual adaptive forms path
|
static boolean |
isDORConfigured(org.apache.sling.api.resource.Resource formResource)
This method will process the given resource and return a boolean value signifying whether DOR
is present for the AF or not.
|
static boolean |
isMetaTemplateValid(org.apache.sling.api.resource.ResourceResolver resourceResolver,
String metaTemplateRef)
Checks if path pointed by metaTemplateRef is valid resource.
|
static boolean |
isTargetEnabled(org.apache.sling.api.resource.Resource guideContainerResource)
API to identify if targeting is enabled for the Adaptive form requested by
the specified guide container
|
static boolean |
isXDPValid(org.apache.sling.api.resource.Resource guideContainer)
Checks if the give adaptive forms(using guidecontainer resource) has a valid XDP Reference to it
|
static org.apache.sling.api.SlingHttpServletResponse |
processInternalPostOnRestEndPoint(org.apache.sling.api.SlingHttpServletRequest request,
org.apache.sling.api.SlingHttpServletResponse response,
String postUrl)
Forwards the given request using HTTP Post to the given post url
|
static boolean |
setToolbarLabel(String name,
String title,
com.day.cq.wcm.api.components.EditContext editContext,
org.apache.sling.api.SlingHttpServletRequest request) |
public static String getGuideContainerPath(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.resource.Resource resource)
request - sling http servlet requestresource - sling resourcepublic static boolean setToolbarLabel(String name, String title, com.day.cq.wcm.api.components.EditContext editContext, org.apache.sling.api.SlingHttpServletRequest request)
public static String encodeForHtml(String str, com.adobe.granite.xss.XSSAPI xssapi)
str - string to encode as HTML contentxssapi - XSSAPI instancepublic static String encodeForHtmlAttr(String str, com.adobe.granite.xss.XSSAPI xssapi)
str - string to encode as HTML attributexssapi - XSSAPI instancepublic static String encodeForJSString(String str, com.adobe.granite.xss.XSSAPI xssapi)
str - string to encode as java script contentxssapi - XSSAPI instancepublic static String getDefaultLocale(org.apache.sling.api.resource.Resource resource) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic static String getThemeClientLibName(org.apache.sling.api.resource.Resource resource)
public static String getLocale(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.resource.Resource guideContainerResource)
request - guideContainerResource - public static com.day.cq.i18n.I18n getI18n(org.apache.sling.api.SlingHttpServletRequest request,
org.apache.sling.api.resource.Resource guideContainerResource)
request - guideContainerResource - public static com.day.cq.i18n.I18n getI18n(org.apache.sling.i18n.ResourceBundleProvider resourceBundleProvider,
org.apache.sling.api.resource.Resource containerResource,
Locale locale)
resourceBundleProvider - containerResource - locale - public static String getDataMimeType(org.apache.sling.api.resource.Resource formResource)
formResource - resource of adaptive form containerpublic static String guideRefToGuidePath(String guideRefPath)
guideRefPath - path of the adaptive forms metadata nodepublic static String convertGuideContainerPathToFMAssetPath(String guideContainerPath)
guideContainerPath - path to the form containerpublic static String convertGuideContainerPathToFMAssetMetadataPath(String guideContainerPath)
guideContainerPath - path to the adaptive form containerpublic static String getDoRTemplateRef(String guideContainerPath, String runtimeLocale, org.apache.sling.api.resource.ResourceResolver resourceResolver)
guideContainerPath - runtimeLocale - localeresourceResolver - public static boolean isXDPValid(org.apache.sling.api.resource.Resource guideContainer)
guideContainer - resource of the adaptive form containerpublic static boolean isMetaTemplateValid(org.apache.sling.api.resource.ResourceResolver resourceResolver,
String metaTemplateRef)
resourceResolver - ResourceResolver to resolve pathpublic static String getMetaTemplateRef(org.apache.sling.api.resource.Resource guideContainerResource)
guideContainerResource - guide container resource objectpublic static boolean isTargetEnabled(org.apache.sling.api.resource.Resource guideContainerResource)
guideContainerResource - resource to the adaptive form containerpublic static String getXFALocale(String locale)
locale - AEM supported localepublic static String getGuideRuntimeLocale(org.apache.sling.api.SlingHttpServletRequest slingRequest, org.apache.sling.api.resource.Resource resource)
resource - resource to the adaptive form containerslingRequest - client request objectpublic static org.apache.sling.api.SlingHttpServletResponse processInternalPostOnRestEndPoint(org.apache.sling.api.SlingHttpServletRequest request,
org.apache.sling.api.SlingHttpServletResponse response,
String postUrl)
request - sling requestresponse - sling responsepostUrl - URL to forward the current requestpublic static String getScriptAsStringFromClientLib(com.adobe.granite.ui.clientlibs.HtmlLibraryManager htmlLibraryManager, String clientLibPath)
htmlLibraryManager - HtmlLibraryManager service.clientLibPath - String specifying the path of client lib.public static ArrayList<String> getScriptFromClientLibList(com.adobe.granite.ui.clientlibs.HtmlLibraryManager htmlLibraryManager, String[] clientLibCategories)
htmlLibraryManager - HtmlLibraryManager service.clientLibCategories - Array of all clientlib categories fow which script is required.public static boolean checkIfForms(org.apache.sling.api.resource.Resource resource)
resource - resource pointing to the pagepublic static boolean checkIfFormsTemplate(org.apache.sling.api.resource.Resource resource)
resource - public static String getThemeContentRef(org.apache.sling.api.resource.Resource guideContainerResource)
guideContainerResource - resource to the form containerpublic static org.apache.sling.api.resource.Resource getThemeResource(org.apache.sling.api.resource.Resource formResource)
formResource - Form resource.public static boolean isDORConfigured(org.apache.sling.api.resource.Resource formResource)
formResource - The guideContainer Resource or Form Asset Resource or CQ Page resource.public static String generateSOM(org.apache.sling.api.resource.Resource element)
element - - Resource, whose SOM Expression needs to be calculated.public static List<org.apache.sling.api.resource.Resource> getGuideContainerFromFormPage(org.apache.sling.api.resource.Resource formPageResource)
Copyright © 1982–2022 Adobe Systems Inc.. All rights reserved.