Class ThemesService


  • public final class ThemesService
    extends java.lang.Object
    ThemesService
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String GLOBAL_THEME  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Theme create​(Theme theme)
      Create a new theme
      static java.lang.String getGlobalTheme()
      Returns the global theme
      static Theme getGlobalTheme​(java.lang.String strTheme)
      Returns the global theme
      static Theme getGlobalThemeObject()
      Returns the global theme Object
      static ReferenceList getPageThemes​(java.util.Locale locale)
      Returns a reference list which contains all the themes
      static Theme getTheme​(PageData data, javax.servlet.http.HttpServletRequest request)
      Get the theme code depending of the different priorities.
      static ReferenceList getThemes()
      Get the list of themes as a ReferenceList
      static java.util.Collection<Theme> getThemesList()
      Get a collection of themes
      static java.lang.String getUserTheme​(javax.servlet.http.HttpServletRequest request)
      Gets the theme selected by the user
      static boolean isAvailable()
      Check if the theme service is available.
      static boolean isValidTheme​(java.lang.String strCodeTheme)
      Check if the theme is valid
      static void remove​(java.lang.String strCodeTheme)
      Remove a theme
      static void setGlobalTheme​(java.lang.String strGlobalTheme)
      Sets the global theme
      static void setUserTheme​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String strTheme)
      Sets the users theme using a cookie
      static Theme update​(Theme theme)
      Update a theme
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getTheme

        public static Theme getTheme​(PageData data,
                                     javax.servlet.http.HttpServletRequest request)
        Get the theme code depending of the different priorities. The priorities are :
        1. the theme of test (in case you want to test a page with a specific theme)
        2. the theme choosen by the user
        3. the global theme : the one choosen in the back office for the whole site
        4. the page theme : a theme specified for a page
        Parameters:
        data - The PageData object
        request - The HttpServletRequest
        Returns:
        the theme
      • getUserTheme

        public static java.lang.String getUserTheme​(javax.servlet.http.HttpServletRequest request)
        Gets the theme selected by the user
        Parameters:
        request - The HTTP request
        Returns:
        The theme if available otherwise null
      • setUserTheme

        public static void setUserTheme​(javax.servlet.http.HttpServletRequest request,
                                        javax.servlet.http.HttpServletResponse response,
                                        java.lang.String strTheme)
        Sets the users theme using a cookie
        Parameters:
        request - The HTTP request
        response - The HTTP response
        strTheme - The Theme code
      • getGlobalTheme

        public static java.lang.String getGlobalTheme()
        Returns the global theme
        Returns:
        the global theme
      • getGlobalThemeObject

        public static Theme getGlobalThemeObject()
        Returns the global theme Object
        Returns:
        the global theme Object
      • getGlobalTheme

        public static Theme getGlobalTheme​(java.lang.String strTheme)
        Returns the global theme
        Parameters:
        strTheme - The theme
        Returns:
        the global theme
      • setGlobalTheme

        public static void setGlobalTheme​(java.lang.String strGlobalTheme)
        Sets the global theme
        Parameters:
        strGlobalTheme - The global theme
      • getPageThemes

        public static ReferenceList getPageThemes​(java.util.Locale locale)
        Returns a reference list which contains all the themes
        Parameters:
        locale - The Locale
        Returns:
        a reference list
      • isAvailable

        public static boolean isAvailable()
        Check if the theme service is available. It must have the following requirement to be available :
        • The plugin-theme is activated
        • The pool of the plugin-theme is defined
        Returns:
        true if it is available, false otherwise
      • create

        public static Theme create​(Theme theme)
        Create a new theme
        Parameters:
        theme - the theme
        Returns:
        The theme
      • update

        public static Theme update​(Theme theme)
        Update a theme
        Parameters:
        theme - the theme to update
        Returns:
        The updated theme
      • remove

        public static void remove​(java.lang.String strCodeTheme)
        Remove a theme
        Parameters:
        strCodeTheme - the code theme
      • getThemesList

        public static java.util.Collection<Theme> getThemesList()
        Get a collection of themes
        Returns:
        a collection of themes
      • isValidTheme

        public static boolean isValidTheme​(java.lang.String strCodeTheme)
        Check if the theme is valid
        Parameters:
        strCodeTheme - the code theme
        Returns:
        true if it is valid, false otherwise