Class JourneyManager


  • public class JourneyManager
    extends java.lang.Object
    User journey manager.
    Since:
    12.2.0
    Version:
    $Revision: 24442 $ $Date: 2021-04-01 14:29:31 -0300 (Thu, 01 Apr 2021) $
    • Constructor Summary

      Constructors 
      Constructor Description
      JourneyManager()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Journey addJourney​(java.lang.String name, java.lang.String serviceInstanceId, java.util.concurrent.TimeUnit timeoutUnit, int timeoutAmount)
      Adds a new journey.
      static JourneyInstance addUserToJourney​(java.lang.String userId, java.lang.String stageId)
      Adds the user with the given identifier to the journey through the stage with the given identifier.
      Returns null if the user is already in the journey or the created JourneyInstance otherwise.
      This method uses its own transaction.
      static void clearAbandonedInstances()
      Removes the abandoned instances.
      static void deleteJourneys​(java.lang.String... journeyIds)
      Removes the journey with the given identifier.
      static void deleteJourneys​(java.util.Collection<java.lang.String> journeyIds)
      Removes the given journey.
      static void deleteJourneysByServiceInstance​(java.lang.String serviceInstanceId)
      Removes all journeys of the service with the given identifier.
      static void deleteStages​(java.lang.String... stageIds)
      Deletes the given stages.
      static void deleteStages​(java.util.Collection<java.lang.String> stageIds)
      Deletes the given stages.
      static JourneyInstance getInstance​(java.lang.String instanceId)
      Returns the instance with the given identifier.
      static JourneyInstance getInstanceByUserAndJourney​(java.lang.String userId, java.lang.String journeyId)
      Returns the journey instance for the user in the journey.
      static JourneyInstance getInstanceByUserAndStage​(java.lang.String userId, java.lang.String stageId)
      Returns the journey instance for the user in the stage.
      static java.util.Collection<JourneyInstance> getInstancesByUser​(java.lang.String userId)
      Finds the instances of the given user.
      static Journey getJourney​(java.lang.String journeyId)
      Returns the journey with the given identifier.
      static java.util.Collection<java.lang.String> getJourneyIdsByServiceInstance​(java.lang.String serviceInstanceId)
      Returns all journeys of the service instance with the given identifier.
      static JourneyStage getStage​(java.lang.String stageId)
      Returns the journey stage with the given identifier.
      static boolean isUserInJourney​(java.lang.String userId, java.lang.String journeyId)
      Returns whether the user with the given identifier is in journey with the given identifier.
      static boolean isUserInJourneyStage​(java.lang.String userId, java.lang.String stageId)
      Returns whether the user with the given identifier is in the stage with the given identifier.
      static java.lang.String localize​(java.lang.String idString)
      Returns the localized string with journey resources.
      static boolean moveUserToStage​(java.lang.String userId, java.lang.String stageId)
      Moves the user with the given identifier to the stage with the given identifier.
      Returns false if the user is already in the given stage or true otherwise.
      The user must already be in the journey that contains the given stage.
      This method uses its own transaction.
      static void removeAllUsersFromJourney​(java.lang.String journeyId)
      Removes all users from the journey with the given identifier.
      static void removeUserFromAllJourneys​(MonitorUser monitorUser)
      Remove the monitor user from all journeys.
      static void removeUsersFromJourney​(java.util.Collection<java.lang.String> userIds, java.lang.String journeyId)
      Removes the users with the given identifiers from the journey with the given identifier.
      static void updateJourney​(Journey journey)
      Updates the given journey.
      static void updateStage​(JourneyStage stage, boolean createUserSegmentation)
      Updates the given stage.
      The createUserSegmentation parameter value will make either:
      A new segmentation to be created if the parameter is true and the stage still doesn't have a segmentation created. The existent segmentation to be deleted if the parameter is false and there's already a created segmentation. Nothing otherwise.
      • Methods inherited from class java.lang.Object

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

      • JourneyManager

        public JourneyManager()
    • Method Detail

      • addUserToJourney

        public static JourneyInstance addUserToJourney​(java.lang.String userId,
                                                       java.lang.String stageId)
                                                throws PortalException
        Adds the user with the given identifier to the journey through the stage with the given identifier.
        Returns null if the user is already in the journey or the created JourneyInstance otherwise.
        This method uses its own transaction.
        Parameters:
        userId - the user identifier.
        stageId - the journey stage identifier.
        Returns:
        null if the user is already in the journey or the created JourneyInstance otherwise.
        Throws:
        PortalObjectNotFoundException - if there's no user with the given identifier.
        PortalObjectNotFoundException - if there's no journey stage with the given identifier.
        java.lang.NullPointerException - if some required field is null.
        AccessDeniedException - if the current session's user does not have permission to perform the transition.
        PortalException - if other error occur
        Since:
        12.2.0
      • moveUserToStage

        public static boolean moveUserToStage​(java.lang.String userId,
                                              java.lang.String stageId)
                                       throws PortalException
        Moves the user with the given identifier to the stage with the given identifier.
        Returns false if the user is already in the given stage or true otherwise.
        The user must already be in the journey that contains the given stage.
        This method uses its own transaction.
        Parameters:
        userId - the user identifier.
        stageId - the journey stage identifier.
        Throws:
        PortalObjectNotFoundException - if there's no user with the given identifier.
        PortalObjectNotFoundException - if there's no journey stage with the given identifier.
        java.lang.NullPointerException - if some required field is null.
        AccessDeniedException - if the current session's user does not have permission to perform the transition.
        java.lang.IllegalStateException - if the user is not yet in the journey.
        PortalException - if other error occur
        Since:
        12.2.0
      • addJourney

        public static Journey addJourney​(java.lang.String name,
                                         java.lang.String serviceInstanceId,
                                         java.util.concurrent.TimeUnit timeoutUnit,
                                         int timeoutAmount)
                                  throws PortalException
        Adds a new journey.
        Parameters:
        name - the journey name
        serviceInstanceId - the journey service instance identifier
        timeoutUnit - the timeout unit
        timeoutAmount - the timeout amount
        Returns:
        the created journey
        Throws:
        PortalException
        Since:
        12.2.0
      • updateJourney

        public static void updateJourney​(Journey journey)
                                  throws PortalException
        Updates the given journey.
        Parameters:
        journey - the journey.
        Throws:
        PortalException
        Since:
        12.2.0
      • deleteJourneys

        public static void deleteJourneys​(java.lang.String... journeyIds)
                                   throws PortalException
        Removes the journey with the given identifier.
        Parameters:
        journeyId - the journey identifier
        Throws:
        PortalException
        Since:
        12.2.0
      • deleteJourneys

        public static void deleteJourneys​(java.util.Collection<java.lang.String> journeyIds)
                                   throws PortalException
        Removes the given journey.
        Parameters:
        journey - the journey
        Throws:
        PortalException
        Since:
        12.2.0
      • updateStage

        public static void updateStage​(JourneyStage stage,
                                       boolean createUserSegmentation)
                                throws PortalException
        Updates the given stage.
        The createUserSegmentation parameter value will make either:
        • A new segmentation to be created if the parameter is true and the stage still doesn't have a segmentation created.
        • The existent segmentation to be deleted if the parameter is false and there's already a created segmentation.
        • Nothing otherwise.
        Parameters:
        stage - the stage.
        createUserSegmentation - indicates whether a user segmentation should be created for this stage (if it doesn't exist yet)
        Throws:
        PortalException
        Since:
        12.2.0
      • deleteStages

        public static void deleteStages​(java.lang.String... stageIds)
                                 throws PortalException
        Deletes the given stages.
        Parameters:
        stageIds - the stages identifiers
        Throws:
        PortalException
        Since:
        12.2.0
      • deleteStages

        public static void deleteStages​(java.util.Collection<java.lang.String> stageIds)
                                 throws PortalException
        Deletes the given stages.
        Parameters:
        stageIds - the stages identifiers
        Throws:
        PortalException
        Since:
        12.2.0
      • getJourney

        public static Journey getJourney​(java.lang.String journeyId)
                                  throws PortalException
        Returns the journey with the given identifier.
        Parameters:
        journeyId - the journey identifier.
        Returns:
        the journey with the given identifier.
        Throws:
        PortalException
        Since:
        12.2.0
      • getStage

        public static JourneyStage getStage​(java.lang.String stageId)
                                     throws PortalException
        Returns the journey stage with the given identifier.
        Parameters:
        stageId - the stage identifier
        Returns:
        the journey stage with the given identifier.
        Throws:
        PortalException
        Since:
        12.2.0
      • getInstance

        public static JourneyInstance getInstance​(java.lang.String instanceId)
                                           throws PortalException
        Returns the instance with the given identifier.
        Parameters:
        instanceId - the instance identifier
        Returns:
        the instance with the given identifier.
        Throws:
        PortalException
        Since:
        12.2.0
      • deleteJourneysByServiceInstance

        public static void deleteJourneysByServiceInstance​(java.lang.String serviceInstanceId)
                                                    throws PortalException
        Removes all journeys of the service with the given identifier.
        Parameters:
        serviceInstanceId - the service identifier
        Throws:
        PortalException
        Since:
        12.2.0
      • getJourneyIdsByServiceInstance

        public static java.util.Collection<java.lang.String> getJourneyIdsByServiceInstance​(java.lang.String serviceInstanceId)
                                                                                     throws PortalException
        Returns all journeys of the service instance with the given identifier.
        Parameters:
        serviceInstanceId - the service instance identifier.
        Returns:
        the identifiers of all journeys of the service instance with the given identifier.
        Throws:
        PortalException
        Since:
        12.2.0
      • removeUsersFromJourney

        public static void removeUsersFromJourney​(java.util.Collection<java.lang.String> userIds,
                                                  java.lang.String journeyId)
                                           throws PortalException
        Removes the users with the given identifiers from the journey with the given identifier.
        Parameters:
        userIds - the user identifiers
        journeyId - the journey identifier
        Throws:
        PortalException
        Since:
        12.2.0
      • removeAllUsersFromJourney

        public static void removeAllUsersFromJourney​(java.lang.String journeyId)
                                              throws PortalException
        Removes all users from the journey with the given identifier.
        Parameters:
        journeyId - the journey identifier
        Throws:
        PortalException
        Since:
        12.2.0
      • isUserInJourney

        public static boolean isUserInJourney​(java.lang.String userId,
                                              java.lang.String journeyId)
                                       throws PortalException
        Returns whether the user with the given identifier is in journey with the given identifier.
        Parameters:
        userId - the user identifier
        journeyId - the journey identifier
        Returns:
        whether the user with the given identifier is in journey with the given identifier.
        Throws:
        PortalException
        Since:
        12.2.0
      • isUserInJourneyStage

        public static boolean isUserInJourneyStage​(java.lang.String userId,
                                                   java.lang.String stageId)
                                            throws PortalException
        Returns whether the user with the given identifier is in the stage with the given identifier.
        Parameters:
        userId - the user identifier
        stageId - the stage identifier
        Returns:
        whether the user with the given identifier is in the stage with the given identifier.
        Throws:
        PortalException
        Since:
        12.2.0
      • getInstanceByUserAndJourney

        public static JourneyInstance getInstanceByUserAndJourney​(java.lang.String userId,
                                                                  java.lang.String journeyId)
                                                           throws PortalException
        Returns the journey instance for the user in the journey.
        Parameters:
        userId - the user identifier
        journeyId - the journey identifier
        Returns:
        the journey instance for the user in the journey.
        Throws:
        PortalException
        Since:
        12.2.0
      • getInstanceByUserAndStage

        public static JourneyInstance getInstanceByUserAndStage​(java.lang.String userId,
                                                                java.lang.String stageId)
                                                         throws PortalException
        Returns the journey instance for the user in the stage.
        Parameters:
        userId - the user identifier
        stageId - the stage identifier
        Returns:
        the journey instance for the user in the stage.
        Throws:
        PortalException
        Since:
        12.2.0
      • getInstancesByUser

        public static java.util.Collection<JourneyInstance> getInstancesByUser​(java.lang.String userId)
                                                                        throws PortalException
        Finds the instances of the given user.
        Parameters:
        userId - the user identifier.
        Returns:
        the instances of the given user.
        Throws:
        PortalException
        Since:
        12.2.0
      • removeUserFromAllJourneys

        public static void removeUserFromAllJourneys​(MonitorUser monitorUser)
                                              throws PortalException
        Remove the monitor user from all journeys.
        Parameters:
        monitorUser - the user
        Throws:
        PortalException
        Since:
        12.3.0
      • localize

        public static java.lang.String localize​(java.lang.String idString)
                                         throws PortalException
        Returns the localized string with journey resources.
        Parameters:
        idString - string identifier.
        Returns:
        the localized string with journey resources.
        Throws:
        PortalException
        Since:
        12.2.0
      • clearAbandonedInstances

        public static void clearAbandonedInstances()
                                            throws PortalException
        Removes the abandoned instances.
        Throws:
        PortalException
        Since:
        12.2.0