Interface ISkinConfig

  • All Known Implementing Classes:
    SkinConfigTool

    public interface ISkinConfig
    Interface of skin config.
    Since:
    2.1
    Author:
    devacfr
    • Method Detail

      • renderSnippets

        @Nonnull
        String renderSnippets​(String bodyContent)
                       throws Exception
        Renders the snippets found in the body content.
        Parameters:
        bodyContent - the body content.
        Returns:
        Returns the String representing the transformed body content.
        Throws:
        Exception - if any.
      • not

        boolean not​(String property)
        A convenience method to check if the value of the property is "false". Useful for properties that are enabled by default - checks if the property is set to "false" explicitly.
        Parameters:
        property - the property of interest
        Returns:
        true if the configuration value is set either in page or globally, and is equal to "false". Note that this will return false if property is not set at all.
        Since:
        1.0
        See Also:
        get(String)
      • getContextValue

        <T> T getContextValue​(@Nonnull
                              String key,
                              @Nonnull
                              Class<T> type)
        Gets the associated value to key stored in Velocity context.
        Type Parameters:
        T - the type of expected value.
        Parameters:
        key - the key name of associated value in Velocity context.
        type - the the type of expected value.
        Returns:
        Returns the associated value to key stored in Velocity context.
        Since:
        2.1
      • setContextValue

        void setContextValue​(@Nonnull
                             String key,
                             Object value)
        Sets the value in Velocity context associated to key.
        Parameters:
        key - the key name of associated value in Velocity context.
        value - the new value
        Since:
        2.1
      • getVelocityContext

        org.apache.velocity.context.Context getVelocityContext()
        Returns:
        the velocity Context
      • getToolbox

        @Nullable
        <T> T getToolbox​(@Nonnull
                         String toolName,
                         @Nonnull
                         Class<T> toolType)
        Gets the associated tool to name stored in toolbox of Velocity context.
        Type Parameters:
        T - the type of expected tool.
        Parameters:
        toolName - the name of tool associated in Velocity context.
        toolType - the expected class of tool.
        Returns:
        Returns the associated tool to name stored in toolbox of Velocity context.
        Since:
        2.1
      • getShortTitle

        @Nonnull
        String getShortTitle()
        Gets the short title of the site.
        Returns:
        Returns the short title of the site.
        Since:
        2.4
      • getTitle

        @Nonnull
        String getTitle()
        Gets the title of the site.
        Returns:
        Returns the title of the site.
        Since:
        2.4
      • getVersion

        @Nonnull
        String getVersion()
        Gets the version of the site.
        Returns:
        Returns the version of the site.
        Since:
        2.4
      • getVersionPosition

        @Nonnull
        String getVersionPosition()
        Gets the position of the version in the site.
        Returns:
        Returns the position of the version in the site.
        Since:
        2.4
      • getVersionMessage

        @Nonnull
        String getVersionMessage()
        Gets the version message of the site.
        Returns:
        Returns the version message of the site.
        Since:
        2.4
      • getPublishDate

        @Nullable
        String getPublishDate()
        Gets the publish date of the site.
        Returns:
        Returns the publish date of the site.
        Since:
        2.4
      • getPublishDateMessage

        @Nonnull
        String getPublishDateMessage()
        Gets the publish date message of the site.
        Returns:
        Returns the publish date message of the site.
        Since:
        2.4
      • getDatePosition

        @Nonnull
        String getDatePosition()
        Gets the date position of the site.
        Returns:
        Returns the date position of the site.
        Since:
        2.4
      • getBodyContent

        @Nonnull
        String getBodyContent()
        Returns:
        Returns the body content.
        Since:
        2.0
      • getGlobalProperties

        @Nonnull
        org.codehaus.plexus.util.xml.Xpp3Dom getGlobalProperties()
        Returns:
        Returns the root level Xpp3Dom.
      • getPageProperties

        @Nonnull
        org.codehaus.plexus.util.xml.Xpp3Dom getPageProperties()
        Returns:
        Returns the page level Xpp3Dom.
      • getNamespace

        @Nonnull
        String getNamespace()
        Returns:
        Returns a String representing the namespace.
      • getProject

        @Nullable
        org.apache.maven.project.MavenProject getProject()
        Returns:
        the project
      • getSiteModel

        @Nullable
        org.apache.maven.doxia.site.SiteModel getSiteModel()
        Returns:
        the SiteModel
      • get

        @Nullable
        org.codehaus.plexus.util.xml.Xpp3Dom get​(@Nonnull
                                                 String property)
        Default accessor for config properties. Instead of using $config.get("myproperty"), one can utilise Velocity fallback onto the default getter and use $config.myproperty.
        Parameters:
        property - the property of interest
        Returns:
        configuration node if found in the following sequence:
        1. In page configuration
        2. In global configuration
        3. null otherwise
        Since:
        1.0
      • getPropertyValue

        @Nullable
        <T> T getPropertyValue​(@Nonnull
                               String property,
                               @Nonnull
                               Class<T> targetType,
                               @Nullable
                               T defaultValue)
        Gets the text value of the given property.
        Type Parameters:
        T - the type of returned object.
        Parameters:
        property - the property to use
        targetType - the returned target type use to convert value.
        defaultValue - the default value used if property doesn't exist.
        Returns:
        Returns a converted value of the given property.
        Since:
        2.0
      • getPropertyValue

        @Nonnull
        <T> Optional<T> getPropertyValue​(@Nonnull
                                         String property,
                                         @Nonnull
                                         Class<T> targetType)
        Gets the text value of the given property.
        Type Parameters:
        T - the type of returned object.
        Parameters:
        property - the property to use
        targetType - the returned target type use to convert value.
        Returns:
        Returns a converted value of the given property.
        Since:
        2.0
      • getAttributeValue

        @Nullable
        <T> T getAttributeValue​(@Nonnull
                                String property,
                                @Nonnull
                                String attribute,
                                @Nonnull
                                Class<T> targetType,
                                @Nullable
                                T defaultValue)
        Gets the attribute value of the given attribute of property.
        Type Parameters:
        T - the type of returned object.
        Parameters:
        property - the property to use
        attribute - the attribute to use.
        targetType - the returned target type use to convert value.
        defaultValue - the default value used if property doesn't exist.
        Returns:
        Returns a converted value of the given property.
        Since:
        2.0
      • getAttributeValue

        @Nonnull
        <T> Optional<T> getAttributeValue​(@Nonnull
                                          String property,
                                          @Nonnull
                                          String attribute,
                                          @Nonnull
                                          Class<T> targetType)
        Gets the attribute value of the given attribute of property.
        Type Parameters:
        T - the type of returned object.
        Parameters:
        property - the property to use
        attribute - the attribute to use.
        targetType - the returned target type use to convert value.
        Returns:
        Returns a converted value of the given property.
        Since:
        2.0
      • getAttributeValue

        @Nullable
        <T> T getAttributeValue​(@Nonnull
                                org.codehaus.plexus.util.xml.Xpp3Dom element,
                                @Nonnull
                                String attribute,
                                @Nonnull
                                Class<T> targetType,
                                T defaultValue)
        Get the value contained in specific attribute of element parameter.
        Type Parameters:
        T - the type of returned value.
        Parameters:
        element - the xml element.
        attribute - the attribute name.
        targetType - the class of converted returned value.
        defaultValue - the value to return if attribute is empty or null.
        Returns:
        Returns the converted value of specific attribute of element parameter if exists, otherwise returns the default value.
      • getAttributeValue

        @Nonnull
        <T> Optional<T> getAttributeValue​(@Nonnull
                                          org.codehaus.plexus.util.xml.Xpp3Dom element,
                                          @Nonnull
                                          String attribute,
                                          @Nonnull
                                          Class<T> targetType)
        Get the value contained in specific attribute of element parameter.
        Type Parameters:
        T - the type of returned value.
        Parameters:
        element - the xml element.
        attribute - the attribute name.
        targetType - the class of converted returned value.
        Returns:
        Returns the converted value of specific attribute of element parameter if exists, otherwise returns an empty Optional.
      • relativeLink

        @Nullable
        String relativeLink​(String href)
        Parameters:
        href - link to relative.
        Returns:
        Returns Relativizes the link.
      • isActiveLink

        boolean isActiveLink​(@Nullable
                             String href)
        Gets the indicating if the link is active.
        Parameters:
        href - the link to check.
        Returns:
        Returns true the link is active, otherwise false.
      • isExternalLink

        boolean isExternalLink​(String url)
        Parameters:
        url - a url.
        Returns:
        Returns true whether the link is a external link to the site.
      • eval

        @Nullable
        <T> T eval​(@Nullable
                   String vtl,
                   @Nonnull
                   Class<T> requiredClass)
        Evaluate a velocity expression in the current context.
        Type Parameters:
        T - Tthe type of expected returned value.
        Parameters:
        vtl - The velocity expression to evaluate
        requiredClass - the class of returned value.
        Returns:
        Returns the value returned by the evaluated velocity expression.
      • getResourcePath

        @Nonnull
        String getResourcePath()
        Returns:
        Returns a String representing the relative path to root site.