Class UniqueWriterController


  • public class UniqueWriterController
    extends java.lang.Object
    Class responsible for controlling unique writes based on keys.
    Guarantees uniqueness during a request.
    Since:
    7.0.0
    Version:
    $Revision: 20129 $ $Date: 2017-04-18 13:06:53 -0300 (Tue, 18 Apr 2017) $
    • Method Detail

      • getInstance

        public static UniqueWriterController getInstance​(HttpServletRequest request)
        Gets the instance that is controlling the writes in the given request. If there's no controller yet, creates a new one and returns it.
        Parameters:
        request - the request being controlled.
        Returns:
        the controller for the request.
        Since:
        7.0.0
      • getStringToLocallyWrite

        public java.lang.String getStringToLocallyWrite​(java.lang.String key,
                                                        java.lang.String text)
        Returns the string to be written locally (inline).
        Parameters:
        key - the unique key.
        text - the text fragment.
        Returns:
        the string to be written locally (inline).
        Since:
        7.0.0
      • processHtml

        public java.lang.String processHtml​(java.lang.String html,
                                            boolean isServerSide,
                                            IPageWebResourceRenderRequest renderRequest)
                                     throws PortalException
        Process the HTML replacing the found markers for their text fragment accordingly.
        Parameters:
        html - the HTML to be processed.
        renderRequest -
        Returns:
        the processed HTML.
        Throws:
        PortalException
        Since:
        8.2.0
      • processHtml

        public java.lang.String processHtml​(java.lang.String html,
                                            java.util.Set<java.lang.String> usedKeys,
                                            boolean isServerSide,
                                            IPageWebResourceRenderRequest renderRequest)
                                     throws PortalException
        Process the HTML replacing the found markers for their text fragment accordingly.
        Parameters:
        html - the HTML to be processed.
        usedKeys - the used keys that will not be processed.
        Returns:
        the processed HTML.
        Throws:
        PortalException
        Since:
        8.2.0
      • getHeadStartMarkers

        public java.lang.String getHeadStartMarkers()
        Returns the head start markers (or null if there's no marker to be inserted).
        Returns:
        the head start markers (or null if there's no marker to be inserted).
        Since:
        7.0.0
      • getHeadEndMarkers

        public java.lang.String getHeadEndMarkers()
        Returns the head end markers (or null if there's no marker to be inserted).
        Returns:
        the head end markers (or null if there's no marker to be inserted).
        Since:
        7.0.0
      • getUniqueKeys

        public java.util.Set<java.lang.String> getUniqueKeys()
        Returns the unique keys used.
        Returns:
        the unique keys used.
        Since:
        7.0.0
      • removeListener

        public void removeListener()
        Removes this unique writer controller listener.
        Since:
        7.1.0
      • getUntracedKeys

        public java.util.List<java.lang.String> getUntracedKeys()
        A list containing all items from getUniqueKeys() without the items present in tracedItems.
        Returns:
        Since:
        8.1.0