Package com.adobe.aemds.guide.utils
Class GuideThemeUtils
- java.lang.Object
-
- com.adobe.aemds.guide.utils.GuideThemeUtils
-
public class GuideThemeUtils extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description GuideThemeUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static void
addTypekitConfigurations(JSONArray response, Resource theme, TypekitConfigurationService typekitConfigurationService)
static void
addTypekitConfigurations(JSONArray response, ResourceResolver resourceResolver)
Deprecated.static void
addTypekitConfigurations(JSONArray response, Resource theme, ResourceResolver resourceResolver, TypekitConfigurationService typekitConfigurationService)
static void
copyAssets(Resource fromResource, Resource toResource, ResourceResolver resourceResolver)
The API copies the asset Resource in inline style from fromResource to toResource.static void
copyStyles(Resource fromResource, Resource toResource, ResourceResolver resourceResolver, java.lang.String cssClass)
The API copies the style Resource in inline style from fromResource to toResource.static java.lang.String
filterURLInAdvancedCSS(java.lang.String value, ThemeConfigurationService themeConfigurationService)
This function extracts a list of urls present in the CSS string.static java.lang.String
generateSelectorString(java.lang.String className, java.lang.String cssSelector, java.lang.Boolean makeDescendantSelector)
Check whether the resource type is themestatic java.lang.String
getBaseClientlibCategory(ResourceResolver resourceResolver, java.lang.String themeContentPath)
Get the base client lib category for the themestatic java.lang.String
getClientLibCategory(Resource themeResource)
get clientLib category of the given resource.static ThemeClientLibData
getClientLibNames(Resource formResource, java.lang.String themeOverride, java.lang.String pageFallbackClientlib)
Gets the clientLib details to be included for an Adaptive Formstatic java.lang.String
getClientLibPath(Resource themeResource)
get clientLib path of the given resource.static java.lang.String
getCommonClientLibName(Resource themeContentResource)
Gets the common clientLib to be included with Theme.static java.lang.String
getComponentCssString(Component component, ResourceResolver resolver, java.util.List<BreakpointInfo> sortedBreakpoints, java.util.List<BreakpointInfo> additionalBreakpointList, java.util.Map<java.lang.String,java.lang.String> selectorMap, ThemeMetadata themeMetadata, ThemeConfigurationService themeConfigurationService)
static java.lang.String
getConfiguredFormPagePath(ResourceResolver resourceResolver, java.lang.String themeContentPath)
The API provides the form page path configured in the Themestatic java.lang.String
getConfiguredFormPath(ResourceResolver resourceResolver, java.lang.String themeContentPath)
The API provides the form path configured in the Themestatic java.lang.String
getThemeClientlibCategory(ResourceResolver resourceResolver, java.lang.String themeContentPath)
Get the theme client library for a given theme pathstatic java.lang.String
getThemeCSS(Theme theme, ResourceResolver resolver, ResourceMergerService resourceMergerService, ThemeConfigurationService themeConfigurationService)
static java.lang.String
getWebFontConfig(ResourceResolver resourceResolver, java.lang.String themeContentPath)
Gets the path of web font config associated with a theme.static boolean
isResourceTheme(Resource themeContentResource)
Check whether the resource type is themestatic java.lang.String
makeCssComment(java.lang.String cssString)
Check if Property present in masked List or not.static void
saveInlineCSS(Resource resource, java.lang.String formPath, ResourceMergerService resourceMergerService, ThemeConfigurationService themeConfigurationService)
static void
saveThemeCSS(Theme theme, ResourceResolver resolver, ResourceMergerService resourceMergerService, ThemeConfigurationService themeConfigurationService)
static java.util.List<BreakpointInfo>
sortBreakpoints(java.util.List<BreakpointInfo> breakpoints)
-
-
-
Method Detail
-
getConfiguredFormPagePath
public static java.lang.String getConfiguredFormPagePath(ResourceResolver resourceResolver, java.lang.String themeContentPath)
The API provides the form page path configured in the Theme- Parameters:
resourceResolver
- ResourceResolver instancethemeContentPath
- Path of the theme- Returns:
- Form path using in theme editor
-
getConfiguredFormPath
public static java.lang.String getConfiguredFormPath(ResourceResolver resourceResolver, java.lang.String themeContentPath)
The API provides the form path configured in the Theme- Parameters:
resourceResolver
- ResourceResolver instancethemeContentPath
- Path of the theme- Returns:
- Form path using in theme editor
-
getThemeClientlibCategory
public static java.lang.String getThemeClientlibCategory(ResourceResolver resourceResolver, java.lang.String themeContentPath)
Get the theme client library for a given theme path- Parameters:
resourceResolver
- ResourceResolver instancethemeContentPath
- Path of the theme- Returns:
- theme client library for a given theme path
-
getBaseClientlibCategory
public static java.lang.String getBaseClientlibCategory(ResourceResolver resourceResolver, java.lang.String themeContentPath)
Get the base client lib category for the theme- Parameters:
resourceResolver
- ResourceResolver instancethemeContentPath
- Path of the theme- Returns:
- base client lib category for the theme
-
saveThemeCSS
public static void saveThemeCSS(Theme theme, ResourceResolver resolver, ResourceMergerService resourceMergerService, ThemeConfigurationService themeConfigurationService) throws GuideException
- Throws:
GuideException
-
getThemeCSS
public static java.lang.String getThemeCSS(Theme theme, ResourceResolver resolver, ResourceMergerService resourceMergerService, ThemeConfigurationService themeConfigurationService)
-
getComponentCssString
public static java.lang.String getComponentCssString(Component component, ResourceResolver resolver, java.util.List<BreakpointInfo> sortedBreakpoints, java.util.List<BreakpointInfo> additionalBreakpointList, java.util.Map<java.lang.String,java.lang.String> selectorMap, ThemeMetadata themeMetadata, ThemeConfigurationService themeConfigurationService)
-
filterURLInAdvancedCSS
public static java.lang.String filterURLInAdvancedCSS(java.lang.String value, ThemeConfigurationService themeConfigurationService)
This function extracts a list of urls present in the CSS string. Iteratively each url is matched with the allow list. If it does not match it is replaced with a blank string.- Parameters:
value
- The CSS stringthemeConfigurationService
-ThemeConfigurationService
object- Returns:
- The CSS string with filtered URLs
-
saveInlineCSS
public static void saveInlineCSS(Resource resource, java.lang.String formPath, ResourceMergerService resourceMergerService, ThemeConfigurationService themeConfigurationService)
-
sortBreakpoints
public static java.util.List<BreakpointInfo> sortBreakpoints(java.util.List<BreakpointInfo> breakpoints)
-
makeCssComment
public static java.lang.String makeCssComment(java.lang.String cssString)
Check if Property present in masked List or not.- Parameters:
cssString
- CssString to be commented.- Returns:
- value final resolved value
-
copyAssets
public static void copyAssets(Resource fromResource, Resource toResource, ResourceResolver resourceResolver)
The API copies the asset Resource in inline style from fromResource to toResource.- Parameters:
fromResource
- the Resource whose style resource is being copied.toResource
- the Resource where style resource is copied.resourceResolver
- resourceResolver instance.
-
copyStyles
public static void copyStyles(Resource fromResource, Resource toResource, ResourceResolver resourceResolver, java.lang.String cssClass)
The API copies the style Resource in inline style from fromResource to toResource.- Parameters:
fromResource
- the Resource whose style resource is being copied.toResource
- the Resource where style resource is copied.resourceResolver
- resourceResolver instance.cssClass
- cssClass of the copied Resource.
-
getClientLibCategory
public static java.lang.String getClientLibCategory(Resource themeResource)
get clientLib category of the given resource.- Parameters:
themeResource
- Theme jcr content resource- Returns:
- clientLibCategory clientLib category of the given theme resource.
-
getClientLibPath
public static java.lang.String getClientLibPath(Resource themeResource)
get clientLib path of the given resource.- Parameters:
themeResource
- Theme jcr content resource- Returns:
- clientLibPath clientLib path of the given theme resource.
-
getWebFontConfig
public static java.lang.String getWebFontConfig(ResourceResolver resourceResolver, java.lang.String themeContentPath)
Gets the path of web font config associated with a theme.- Parameters:
resourceResolver
-themeContentPath
- Path of jcr:content node of theme resource.- Returns:
- The path of web font config
-
getCommonClientLibName
public static java.lang.String getCommonClientLibName(Resource themeContentResource)
Gets the common clientLib to be included with Theme.- Parameters:
themeContentResource
- Theme jcr:content resource.- Returns:
- Name of the common clientLib to be included
-
getClientLibNames
public static ThemeClientLibData getClientLibNames(Resource formResource, java.lang.String themeOverride, java.lang.String pageFallbackClientlib)
Gets the clientLib details to be included for an Adaptive Form- Parameters:
formResource
- Form resourcethemeOverride
- Path of Theme to be overriddenpageFallbackClientlib
- fallback clientLib- Returns:
- ThemeClientLibData object containing the client category names
-
isResourceTheme
public static boolean isResourceTheme(Resource themeContentResource)
Check whether the resource type is theme- Parameters:
themeContentResource
- Theme jcr:content resource.- Returns:
- whether resource type is theme or not
-
generateSelectorString
public static java.lang.String generateSelectorString(java.lang.String className, java.lang.String cssSelector, java.lang.Boolean makeDescendantSelector)
Check whether the resource type is theme- Parameters:
className
- Inline Style component prefiex Class.cssSelector
- css selector for the particular selector.makeDescendantSelector
- If we want prefix class to be along side the css selector or above it.- Returns:
- whether resource type is theme or not
-
addTypekitConfigurations
public static void addTypekitConfigurations(JSONArray response, Resource theme, TypekitConfigurationService typekitConfigurationService) throws JSONException
- Throws:
JSONException
-
addTypekitConfigurations
public static void addTypekitConfigurations(JSONArray response, Resource theme, ResourceResolver resourceResolver, TypekitConfigurationService typekitConfigurationService) throws JSONException
- Throws:
JSONException
-
addTypekitConfigurations
@Deprecated public static void addTypekitConfigurations(JSONArray response, ResourceResolver resourceResolver) throws JSONException
Deprecated.- Throws:
JSONException
-
-