Class ABTestUtil


  • public final class ABTestUtil
    extends java.lang.Object
    AB Test related utilities.
    Since:
    16.0.0
    Version:
    $Revision: 26432 $ $Date: 2024-06-07 10:31:08 -0300 (Fri, 07 Jun 2024) $
    • Method Detail

      • deleteRelatedExperiments

        public static void deleteRelatedExperiments​(ContentLocale contentLocale)
                                             throws PortalException
        Deletes the experiments related to the given content locale.
        Parameters:
        contentLocale - the content locale
        Throws:
        PortalException
        Since:
        16.0.0
      • isExperimentEnabled

        public static java.lang.Boolean isExperimentEnabled​(java.lang.String experimentId)
                                                     throws PortalException
        Returns whether the experiment with the given id is enabled.
        Parameters:
        experimentId -
        Returns:
        whether the experiment with the given id is enabled.
        Throws:
        PortalException
        Since:
        16.0.0
      • clearExperimentCache

        public static void clearExperimentCache​(java.lang.String experimentId)
                                         throws PortalException
        Clears experiment cache.
        Parameters:
        experimentId - the experiment id
        Throws:
        PortalException
        Since:
        16.0.0
      • onPostAddHtmlField

        public static void onPostAddHtmlField​(java.lang.String html,
                                              ISourceField field,
                                              SourcePostAddDataEvent event)
                                       throws PortalException
        Callback to be called after an HTML field is added.
        Parameters:
        html - the HTML value
        field - the field id
        event - the event
        Throws:
        PortalException
        Since:
        16.0.0
      • getVariantResponseJSON

        public static org.json.JSONObject getVariantResponseJSON​(ABTestExperimentVariant variant,
                                                                 java.lang.String referrer,
                                                                 HttpServletRequest request)
                                                          throws PortalException
        Returns the variant JSON object to be applied by track.js.
        Parameters:
        variant - the variant
        referrer - the referrer page
        request - the request
        Returns:
        the JSON object
        Throws:
        PortalException
        Since:
        16.0.0
      • clearOrphanContentExperiments

        public static void clearOrphanContentExperiments()
                                                  throws PortalException
        Clears orphan content experiments.
        Throws:
        PortalException
        Since:
        16.0.0
      • getApplyVariantCommand

        public static java.lang.String getApplyVariantCommand​(java.lang.String variantId)
                                                       throws PortalException
        Returns the apply variant command to be executed in parent CKEditor.
        Parameters:
        variantId - the variant id
        Returns:
        the apply variant command to be executed in parent CKEditor.
        Throws:
        PortalException
        Since:
        16.0.0