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 |
checkIfForms(org.apache.sling.api.resource.Resource resource,
boolean isV2)
This API checks 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 boolean |
checkIfFormsTemplate(org.apache.sling.api.resource.Resource resource,
boolean checkIfV2) |
static String |
convertADAssetPathToWebChannelPagePath(String FMDocAssetPath) |
static String |
convertFMAssetPathToFormPagePath(String FMAssetPath) |
static String |
convertFormPagePathToFMAssetPath(String formPagePath) |
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 Boolean |
embedFragmentResources(org.apache.sling.api.resource.Resource fragmentPanelResource,
String fragmentPath,
Boolean processConversion) |
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 |
getAfDataSom(String schemaType,
String name,
String bindRef)
Gives the afDataSom for an adaptive form field
|
static Locale |
getAFLocale(String locale,
com.adobe.aemds.guide.service.GuideLocalizationService guideLocalizationService) |
static String |
getAFPathFromFormContainerResource(org.apache.sling.api.resource.Resource formContainerResource) |
static org.apache.sling.api.resource.ResourceResolver |
getCloudServiceUserResourceResolver(org.apache.sling.api.resource.ResourceResolverFactory resourceResolverFactory) |
static Map<String,Object> |
getCommonRepeatableBindRefForTableRow(com.adobe.aemds.guide.service.GuideModelImporter guideModelImporter,
org.apache.sling.api.resource.Resource tableRowResource,
org.apache.sling.api.resource.Resource guideContainerResource) |
static Map<String,Object> |
getCommonRepeatableItemForChart(com.adobe.aemds.guide.service.GuideModelImporter guideModelImporter,
org.apache.sling.api.resource.Resource chartResource,
org.apache.sling.api.resource.Resource guideContainerResource) |
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 org.apache.sling.api.resource.Resource |
getFormContainerResourceFromEncodedPath(String encodedFormPath,
org.apache.sling.api.resource.ResourceResolver resourceResolver) |
static String |
getFormDataId(String formContainerPath,
String submissionId,
Date date) |
static org.apache.sling.commons.json.JSONObject |
getFormGuideJsonFromFormSubmitInfo(FormSubmitInfo formSubmitInfo,
GuideModelTransformer guideModelTransformer,
com.adobe.aemds.guide.service.GuideLocalizationService guideLocalizationService) |
static String |
getFormRelativePath(String formContainerPath) |
static org.apache.sling.api.resource.Resource |
getFormResourceFromEncodedPath(String encodedFormPath,
org.apache.sling.api.resource.ResourceResolver resourceResolver) |
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 |
getGuideName(org.apache.sling.api.resource.Resource rsrc)
Return the parameter name for the field
|
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 guideFieldResource) |
static com.adobe.aemds.guide.utils.JSONCreationOptions |
getJsonCreationOptions(String guideContainerPath,
String locale,
com.adobe.aemds.guide.service.GuideLocalizationService guideLocalizationService) |
static String |
getLocale(org.apache.sling.api.SlingHttpServletRequest request,
org.apache.sling.api.resource.Resource guideContainerResource) |
static org.apache.sling.commons.json.JSONArray |
getMergedJSONArray(org.apache.sling.commons.json.JSONArray array1,
org.apache.sling.commons.json.JSONArray array2) |
static String |
getMetaTemplateRef(org.apache.sling.api.resource.Resource guideContainerResource)
Get meta-template path associated with guide container.
|
static org.apache.sling.api.resource.Resource |
getParentResource(org.apache.sling.api.resource.Resource resource,
String parentResourceType) |
static org.apache.sling.api.resource.Resource |
getPrintNodeResource(org.apache.sling.api.resource.Resource guideContainer) |
static ResourceBundle |
getResourceBundle(org.apache.sling.api.SlingHttpServletRequest request,
org.apache.sling.api.resource.Resource guideContainerResource,
Locale desiredLocale)
Utility API to fetch resource bundle for given form and request
|
static String |
getSchemaType(org.apache.sling.commons.json.JSONObject formContainerJson)
Deprecated.
Use
GuideContainer.getSchemaType() instead |
static String |
getScriptAsStringFromClientLib(com.adobe.granite.ui.clientlibs.HtmlLibraryManager htmlLibraryManager,
String clientLibPath,
boolean minify)
Gets the JavaScript as String from the client lib path specified.
|
static ArrayList<String> |
getScriptFromClientLibList(com.adobe.granite.ui.clientlibs.HtmlLibraryManager htmlLibraryManager,
String[] clientLibCategories,
boolean minify)
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 |
guideRefToDocPath(String guideRefPath)
Utility to convert an MC DOCUMENT meta data path to the actual mc document path
|
static String |
guideRefToGuidePath(String guideRefPath)
Utility to convert an AF(Adaptive Form) meta data path to the actual adaptive forms path
|
static boolean |
isAdobeTargetConfigured(org.apache.sling.api.resource.Resource resource)
API to identify if adobe target is configured for the Adaptive form.
|
static boolean |
isCoreComponentBasedForm(org.apache.sling.api.resource.Resource guideContainer) |
static Boolean |
isDesiredLocaleDictPresent(org.apache.sling.api.resource.Resource baseResource,
Locale desiredLocale) |
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 |
isDorTemplateAnAcroForm(String templatePath,
org.apache.sling.api.resource.ResourceResolver resourceResolver) |
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 |
isV2GuideContainerResource(org.apache.sling.api.resource.Resource resource)
This is a public api used to identify if a resource is a v2 Guide Container or Wrapper resource
Returns true if resource is a v2 GuideContainer or Wrapper
else returns false
|
static boolean |
isValidFormResource(org.apache.sling.api.resource.ResourceResolver resourceResolver,
String formPath,
String formType)
Check if formPath points to valid resource of type formType
|
static boolean |
isWebChannel(org.apache.sling.api.resource.Resource resource)
Checks whether resource is a web channel resource.
|
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 Object |
marshallDataWithAFWrapper(Object data)
Marshalls the naked data with AF wrapper tags.
|
static boolean |
processChartAddition(com.adobe.aemds.guide.service.GuideModelImporter guideModelImporter,
org.apache.sling.api.resource.Resource chartResource,
org.apache.sling.api.resource.Resource guideContainerResource) |
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 void |
setMasterAuthoringConfig(Map<String,Object> authoringConfig,
org.apache.sling.api.resource.ValueMap resourceProps) |
static boolean |
setToolbarLabel(String name,
String title,
com.day.cq.wcm.api.components.EditContext editContext,
org.apache.sling.api.SlingHttpServletRequest request) |
static org.apache.sling.commons.json.JSONObject |
somToAdapativeFormItem(org.apache.sling.commons.json.JSONObject formContainerJson,
String somExpression)
Gives JSONObject of Adaptive Form field/panel corresponding to given SOM Expression
|
static String |
syncExcludeFromDorData(String dataJSON,
String ServerSideExcludeFromDorData)
Aligns the excludeFromDor Data present in the data.json with the one computed in server-side-validation (source of truth)
|
static String |
translateOrReturnOriginal(String original,
com.day.cq.i18n.I18n i18n) |
static String |
translateOrReturnOriginal(String original,
String key,
com.day.cq.i18n.I18n i18n,
org.apache.sling.api.resource.Resource formResource) |
static String |
translateOrReturnOriginal(String value,
String key,
com.day.cq.i18n.I18n i18n,
org.apache.sling.api.resource.ValueMap properties) |
public static org.apache.sling.api.resource.ResourceResolver getCloudServiceUserResourceResolver(org.apache.sling.api.resource.ResourceResolverFactory resourceResolverFactory)
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)
public 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 guideFieldResource)
request
- guideFieldResource
- 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 getSchemaType(org.apache.sling.commons.json.JSONObject formContainerJson)
GuideContainer.getSchemaType()
insteadformContainerJson
- json of adaptive form containerpublic static String getAfDataSom(String schemaType, String name, String bindRef)
schemaType
- of adaptive formname
- of adaptive form fieldbindRef
- of adaptive form fieldpublic static org.apache.sling.commons.json.JSONObject somToAdapativeFormItem(org.apache.sling.commons.json.JSONObject formContainerJson, String somExpression)
formContainerJson
- adaptive form container JSONsomExpression
- som expression of adaptive form panel/fieldpublic static String guideRefToGuidePath(String guideRefPath)
guideRefPath
- path of the adaptive forms metadata nodepublic static String guideRefToDocPath(String guideRefPath)
guideRefPath
- path of the mc document metadata nodepublic static String translateOrReturnOriginal(String value, String key, com.day.cq.i18n.I18n i18n, @Nullable org.apache.sling.api.resource.ValueMap properties)
i18n
- * @pad.exclude Exclude from Published API.public static String translateOrReturnOriginal(String original, String key, com.day.cq.i18n.I18n i18n, @Nullable org.apache.sling.api.resource.Resource formResource)
original
- i18n
- public static Locale getAFLocale(String locale, com.adobe.aemds.guide.service.GuideLocalizationService guideLocalizationService)
public static String getAFPathFromFormContainerResource(org.apache.sling.api.resource.Resource formContainerResource)
public static com.adobe.aemds.guide.utils.JSONCreationOptions getJsonCreationOptions(String guideContainerPath, String locale, com.adobe.aemds.guide.service.GuideLocalizationService guideLocalizationService)
public static org.apache.sling.commons.json.JSONObject getFormGuideJsonFromFormSubmitInfo(FormSubmitInfo formSubmitInfo, GuideModelTransformer guideModelTransformer, com.adobe.aemds.guide.service.GuideLocalizationService guideLocalizationService)
public 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 embedFragmentResources(org.apache.sling.api.resource.Resource fragmentPanelResource, String fragmentPath, Boolean processConversion)
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 org.apache.sling.api.resource.Resource getPrintNodeResource(org.apache.sling.api.resource.Resource guideContainer)
public static boolean isCoreComponentBasedForm(org.apache.sling.api.resource.Resource guideContainer)
guideContainer
- public static String translateOrReturnOriginal(String original, com.day.cq.i18n.I18n i18n)
original
- i18n
- public static boolean isV2GuideContainerResource(org.apache.sling.api.resource.Resource resource)
resource
- public static boolean isTargetEnabled(org.apache.sling.api.resource.Resource guideContainerResource)
guideContainerResource
- resource to the adaptive form containerpublic static boolean isAdobeTargetConfigured(org.apache.sling.api.resource.Resource resource)
resource
- 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 ResourceBundle getResourceBundle(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.resource.Resource guideContainerResource, Locale desiredLocale)
request
- reference to SlingHttpServletRequest
guideContainerResource
- resource of form containerdesiredLocale
- reference to desired Locale
ResourceBundle
public static Boolean isDesiredLocaleDictPresent(org.apache.sling.api.resource.Resource baseResource, Locale desiredLocale)
public 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, boolean minify)
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, boolean minify)
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 checkIfForms(org.apache.sling.api.resource.Resource resource, boolean isV2)
resource
- resource pointing to the pageisV2
- assumes value as true for form created using v2 core componentspublic static boolean checkIfFormsTemplate(org.apache.sling.api.resource.Resource resource)
resource
- public static boolean checkIfFormsTemplate(org.apache.sling.api.resource.Resource resource, boolean checkIfV2)
public static String getThemeContentRef(org.apache.sling.api.resource.Resource guideContainerResource)
guideContainerResource
- resource to the form containerpublic static String getGuideName(org.apache.sling.api.resource.Resource rsrc) throws GuideException
rsrc
- The resourceGuideException
public 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 Object marshallDataWithAFWrapper(Object data) throws Exception
data
- form dataException
public static List<org.apache.sling.api.resource.Resource> getGuideContainerFromFormPage(org.apache.sling.api.resource.Resource formPageResource)
public static String convertFMAssetPathToFormPagePath(String FMAssetPath)
public static String convertFormPagePathToFMAssetPath(String formPagePath)
public static String convertADAssetPathToWebChannelPagePath(String FMDocAssetPath)
public static org.apache.sling.commons.json.JSONArray getMergedJSONArray(org.apache.sling.commons.json.JSONArray array1, org.apache.sling.commons.json.JSONArray array2) throws org.apache.sling.commons.json.JSONException
org.apache.sling.commons.json.JSONException
public static boolean isWebChannel(org.apache.sling.api.resource.Resource resource)
resource
- public static org.apache.sling.api.resource.Resource getParentResource(org.apache.sling.api.resource.Resource resource, String parentResourceType)
public static Map<String,Object> getCommonRepeatableBindRefForTableRow(com.adobe.aemds.guide.service.GuideModelImporter guideModelImporter, org.apache.sling.api.resource.Resource tableRowResource, org.apache.sling.api.resource.Resource guideContainerResource)
public static Map<String,Object> getCommonRepeatableItemForChart(com.adobe.aemds.guide.service.GuideModelImporter guideModelImporter, org.apache.sling.api.resource.Resource chartResource, org.apache.sling.api.resource.Resource guideContainerResource)
public static void setMasterAuthoringConfig(Map<String,Object> authoringConfig, org.apache.sling.api.resource.ValueMap resourceProps)
public static boolean isValidFormResource(org.apache.sling.api.resource.ResourceResolver resourceResolver, String formPath, String formType)
resourceResolver
- formPath
- formType
- - formType is "guide" for AdaptiveForm and "mcdocument" for ICpublic static boolean processChartAddition(com.adobe.aemds.guide.service.GuideModelImporter guideModelImporter, org.apache.sling.api.resource.Resource chartResource, org.apache.sling.api.resource.Resource guideContainerResource) throws Exception
Exception
public static boolean isDorTemplateAnAcroForm(String templatePath, org.apache.sling.api.resource.ResourceResolver resourceResolver)
public static String syncExcludeFromDorData(String dataJSON, String ServerSideExcludeFromDorData)
dataJSON
- string representing data.jsonServerSideExcludeFromDorData
- string computed as part of server side validationpublic static org.apache.sling.api.resource.Resource getFormResourceFromEncodedPath(String encodedFormPath, org.apache.sling.api.resource.ResourceResolver resourceResolver)
public static org.apache.sling.api.resource.Resource getFormContainerResourceFromEncodedPath(String encodedFormPath, org.apache.sling.api.resource.ResourceResolver resourceResolver)
Copyright © 1982–2023 Adobe Systems Incorporated. All rights reserved.