Class FriendlyURLManager

  • All Implemented Interfaces:
    java.io.Serializable

    public class FriendlyURLManager
    extends java.lang.Object
    implements java.io.Serializable
    See Also:
    Serialized Form
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean addFriendlyURL​(Data data, java.lang.String friendlyURL)
      Add the given friendlyURLSet to the friendly urls of the servlet.
      java.lang.String buildCleanURL​(java.lang.String str)
      Method to clean the given string to have a proper URL.
      Convert to CamelCase (keeping '/' separator)
      java.lang.String generateFriendlyURL​(Category cat, java.lang.String lang)
      Build and return a friendly url that can be added later to the friendly urls Servlet Filter.
      java.lang.String generateFriendlyURL​(Publication pub, java.lang.String lang)
      Build and return a friendly url that can be added later to the friendly urls Servlet Filter.
      Data getDataFromFriendlyURL​(java.lang.String friendlyURL)
      Return the data associated with the given friendly URL.
      java.util.Map<java.lang.String,​java.util.Set<java.lang.String>> getDataToFriendlyURLSetMap()  
      java.util.Set<java.lang.String> getFriendlyURLSet​(Data data)
      Return a set of friendly urls associated with the given data
      java.util.Map<java.lang.String,​java.lang.String> getFriendlyURLToDataMap()  
      static FriendlyURLManager getInstance()  
      protected void initAfterStoreLoad()  
      boolean isFriendlyURLAvailable​(Data data, java.lang.String friendlyURL)
      Check if the given friendly URL is available, that is either : the Friendly URL is not in the Friendly URLs of the servlet or else the Friendly URL is already there with the same data
      boolean isFriendlyURLAvailable​(java.lang.String id, java.lang.String friendlyURL)
      Check if the given friendly URL is available, that is either : the Friendly URL is not in the Friendly URLs of the servlet or else the Friendly URL is already there with the same data
      Instance method, to be used by rpc call in doEditCommonPubAttribute.
      static boolean isFriendlyURLAvailableWrapper​(java.lang.String id, java.lang.String friendlyURL)  
      boolean isFriendlyURLValid​(java.lang.String friendlyURL)
      Check if the given friendly url is valid.
      static boolean isFriendlyURLValidWrapper​(java.lang.String friendlyURL)  
      boolean removeDataFriendlyURL​(Data data)
      Remove the given data and all its associated friendly url.
      boolean removeDataFriendlyURL​(java.lang.String dataId)
      Remove the given data and all its associated friendly url.
      boolean removeFriendlyURL​(java.lang.String friendlyURL)
      Remove the given friendly url.
      void updateFriendlyURLs​(Category cat)
      Add the friendly URL of the given category.
      void updateFriendlyURLs​(Publication pub)
      Add the friendly URL of the given publication.
      • Methods inherited from class java.lang.Object

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

      • initAfterStoreLoad

        protected void initAfterStoreLoad()
      • generateFriendlyURL

        public java.lang.String generateFriendlyURL​(Category cat,
                                                    java.lang.String lang)
        Build and return a friendly url that can be added later to the friendly urls Servlet Filter.
        This method does not check for availabilty of the built friendlyURL.
        Parameters:
        cat - the Category to build a url for
        lang - the lang in which to build a url
        Returns:
        a friendlyURL
      • generateFriendlyURL

        public java.lang.String generateFriendlyURL​(Publication pub,
                                                    java.lang.String lang)
        Build and return a friendly url that can be added later to the friendly urls Servlet Filter.
        This method do not check for availabilty of the built friendly url.
        Parameters:
        pub - the Publication to build a url for
        lang - the lang in which to build a url
        Returns:
        a friendly url or null if the url could not be build in the given language
      • buildCleanURL

        public java.lang.String buildCleanURL​(java.lang.String str)
        Method to clean the given string to have a proper URL.
        Convert to CamelCase (keeping '/' separator)
        Parameters:
        str - the string to clean
        Returns:
        the cleaned string
      • isFriendlyURLAvailable

        public boolean isFriendlyURLAvailable​(java.lang.String id,
                                              java.lang.String friendlyURL)
        Check if the given friendly URL is available, that is either :
        • the Friendly URL is not in the Friendly URLs of the servlet
        • or else the Friendly URL is already there with the same data

        Instance method, to be used by rpc call in doEditCommonPubAttribute.
        Parameters:
        id - the id of the data associated with the friendly url
        friendlyURL - the friendlyURL for which to check availability
        Returns:
        true if available, false otherwise
      • isFriendlyURLAvailableWrapper

        public static boolean isFriendlyURLAvailableWrapper​(java.lang.String id,
                                                            java.lang.String friendlyURL)
      • isFriendlyURLValid

        public boolean isFriendlyURLValid​(java.lang.String friendlyURL)
        Check if the given friendly url is valid.
        Instance method, to be used by rpc call in doEditCommonPubAttribute.
        Parameters:
        friendlyURL - the friendly url to check
        Returns:
        true if friendly URL is a valid one, false otherwise
      • isFriendlyURLValidWrapper

        public static boolean isFriendlyURLValidWrapper​(java.lang.String friendlyURL)
      • isFriendlyURLAvailable

        public boolean isFriendlyURLAvailable​(Data data,
                                              java.lang.String friendlyURL)
        Check if the given friendly URL is available, that is either :
        • the Friendly URL is not in the Friendly URLs of the servlet
        • or else the Friendly URL is already there with the same data
        Parameters:
        data - the data associated with the friendly url
        friendlyURL - the friendlyURL for which to check availability
        Returns:
        true if available, false otherwise
      • getFriendlyURLSet

        public java.util.Set<java.lang.String> getFriendlyURLSet​(Data data)
        Return a set of friendly urls associated with the given data
        Parameters:
        data - the data of which to retrieve friendly urls
        Returns:
        a Set of String
      • getDataFromFriendlyURL

        public Data getDataFromFriendlyURL​(java.lang.String friendlyURL)
        Return the data associated with the given friendly URL.
        Parameters:
        friendlyURL - the friendly URL to test
        Returns:
        the associated Data or null.
      • updateFriendlyURLs

        public void updateFriendlyURLs​(Publication pub)
        Add the friendly URL of the given publication.
        Parameters:
        pub - the publication
        Since:
        jcms-10.0.0
      • updateFriendlyURLs

        public void updateFriendlyURLs​(Category cat)
        Add the friendly URL of the given category.
        Parameters:
        cat - the category
        Since:
        jcms-10.0.0
      • addFriendlyURL

        public boolean addFriendlyURL​(Data data,
                                      java.lang.String friendlyURL)
        Add the given friendlyURLSet to the friendly urls of the servlet.
        Check the friendly url is available.
        Parameters:
        data - the data associated with the friendly url
        friendlyURL - the friendly url
        Returns:
        true if the friendlyURL was added or was already there, false otherwise.
      • removeDataFriendlyURL

        public boolean removeDataFriendlyURL​(Data data)
        Remove the given data and all its associated friendly url.
        Parameters:
        data - the data to remove from the servlet.
        Returns:
        true if the data was removed, false if it was not there.
      • removeDataFriendlyURL

        public boolean removeDataFriendlyURL​(java.lang.String dataId)
        Remove the given data and all its associated friendly url.
        Parameters:
        dataId - the data id to remove from the servlet.
        Returns:
        true if the data was removed, false if it was not there.
      • removeFriendlyURL

        public boolean removeFriendlyURL​(java.lang.String friendlyURL)
        Remove the given friendly url.
        Parameters:
        friendlyURL - the friendly url to remove
        Returns:
        true if the friendly url was removed, false if it was not there.
      • getFriendlyURLToDataMap

        public java.util.Map<java.lang.String,​java.lang.String> getFriendlyURLToDataMap()
        Returns:
        a copy of the HashMap associating FriendlyURL with a Data
      • getDataToFriendlyURLSetMap

        public java.util.Map<java.lang.String,​java.util.Set<java.lang.String>> getDataToFriendlyURLSetMap()
        Returns:
        a copy of the HashMap associating Data with a FriendlyURL Set