Class JourneyManager


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

      • JourneyManager

        public JourneyManager()
    • Method Detail

      • moveUserToStage

        public static boolean moveUserToStage​(String userId,
                                              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.
        NullPointerException - if some required field is null.
        AccessDeniedException - if the current session's user does not have permission to perform the transition.
        IllegalStateException - if the user is not yet in the journey.
        PortalException - if other error occur
        Since:
        12.2.0
      • addJourney

        public static Journey addJourney​(String name,
                                         String serviceInstanceId,
                                         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​(String... journeyIds)
                                   throws PortalException
        Removes the journey with the given identifier.
        Parameters:
        journeyId - the journey identifier
        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​(String... stageIds)
                                 throws PortalException
        Deletes the given stages.
        Parameters:
        stageIds - the stages identifiers
        Throws:
        PortalException
        Since:
        12.2.0
      • getJourney

        public static Journey getJourney​(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​(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​(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​(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 Collection<String> getJourneyIdsByServiceInstance​(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​(Collection<String> userIds,
                                                  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​(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​(String userId,
                                              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​(String userId,
                                                   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​(String userId,
                                                                  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​(String userId,
                                                                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
      • 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 String localize​(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