Class GuideThemeUtils


  • public class GuideThemeUtils
    extends java.lang.Object
    • Constructor Detail

      • GuideThemeUtils

        public GuideThemeUtils()
    • 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 instance
        themeContentPath - 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 instance
        themeContentPath - 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 instance
        themeContentPath - 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 instance
        themeContentPath - Path of the theme
        Returns:
        base client lib category for the theme
      • 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 string
        themeConfigurationService - ThemeConfigurationService object
        Returns:
        The CSS string with filtered URLs
      • 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 resource
        themeOverride - Path of Theme to be overridden
        pageFallbackClientlib - 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