Package lumis.portal.analytics.journey
Class JourneyManager
- java.lang.Object
-
- lumis.portal.analytics.journey.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) $
-
-
Field Summary
Fields Modifier and Type Field Description static String
CHANGEDSTAGE_EVENT_ID
static String
EXITED_EVENT_ID
static String
STARTED_EVENT_ID
-
Constructor Summary
Constructors Constructor Description JourneyManager()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Journey
addJourney(String name, String serviceInstanceId, TimeUnit timeoutUnit, int timeoutAmount)
Adds a new journey.static JourneyInstance
addUserToJourney(String userId, String stageId)
Adds the user with the given identifier to the journey through the stage with the given identifier.
Returnsnull
if the user is already in the journey or the createdJourneyInstance
otherwise.
This method uses its own transaction.static void
clearAbandonedInstances()
Removes the abandoned instances.static void
deleteJourneys(String... journeyIds)
Removes the journey with the given identifier.static void
deleteJourneys(Collection<String> journeyIds)
Removes the given journey.static void
deleteJourneysByServiceInstance(String serviceInstanceId)
Removes all journeys of the service with the given identifier.static void
deleteStages(String... stageIds)
Deletes the given stages.static void
deleteStages(Collection<String> stageIds)
Deletes the given stages.static JourneyInstance
getInstance(String instanceId)
Returns the instance with the given identifier.static JourneyInstance
getInstanceByUserAndJourney(String userId, String journeyId)
Returns the journey instance for the user in the journey.static JourneyInstance
getInstanceByUserAndStage(String userId, String stageId)
Returns the journey instance for the user in the stage.static Collection<JourneyInstance>
getInstancesByUser(String userId)
Finds the instances of the given user.static Journey
getJourney(String journeyId)
Returns the journey with the given identifier.static Collection<String>
getJourneyIdsByServiceInstance(String serviceInstanceId)
Returns all journeys of the service instance with the given identifier.static JourneyStage
getStage(String stageId)
Returns the journey stage with the given identifier.static boolean
isUserInJourney(String userId, String journeyId)
Returns whether the user with the given identifier is in journey with the given identifier.static boolean
isUserInJourneyStage(String userId, String stageId)
Returns whether the user with the given identifier is in the stage with the given identifier.static String
localize(String idString)
Returns the localized string with journey resources.static boolean
moveUserToStage(String userId, String stageId)
Moves the user with the given identifier to the stage with the given identifier.
Returnsfalse
if the user is already in the given stage ortrue
otherwise.
The user must already be in the journey that contains the given stage.
This method uses its own transaction.static void
removeAllUsersFromJourney(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(Collection<String> userIds, 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.
ThecreateUserSegmentation
parameter value will make either:
A new segmentation to be created if the parameter istrue
and the stage still doesn't have a segmentation created. The existent segmentation to be deleted if the parameter isfalse
and there's already a created segmentation. Nothing otherwise.
-
-
-
Field Detail
-
STARTED_EVENT_ID
public static final String STARTED_EVENT_ID
- See Also:
- Constant Field Values
-
EXITED_EVENT_ID
public static final String EXITED_EVENT_ID
- See Also:
- Constant Field Values
-
CHANGEDSTAGE_EVENT_ID
public static final String CHANGEDSTAGE_EVENT_ID
- See Also:
- Constant Field Values
-
-
Method Detail
-
addUserToJourney
public static JourneyInstance addUserToJourney(String userId, String stageId) throws PortalException
Adds the user with the given identifier to the journey through the stage with the given identifier.
Returnsnull
if the user is already in the journey or the createdJourneyInstance
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 createdJourneyInstance
otherwise.- 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 isnull
.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(String userId, String stageId) throws PortalException
Moves the user with the given identifier to the stage with the given identifier.
Returnsfalse
if the user is already in the given stage ortrue
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 isnull
.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 nameserviceInstanceId
- the journey service instance identifiertimeoutUnit
- the timeout unittimeoutAmount
- 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
-
deleteJourneys
public static void deleteJourneys(Collection<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.
ThecreateUserSegmentation
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
- A new segmentation to be created if the parameter is
-
deleteStages
public static void deleteStages(String... stageIds) throws PortalException
Deletes the given stages.- Parameters:
stageIds
- the stages identifiers- Throws:
PortalException
- Since:
- 12.2.0
-
deleteStages
public static void deleteStages(Collection<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 identifiersjourneyId
- 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 identifierjourneyId
- 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 identifierstageId
- 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 identifierjourneyId
- 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 identifierstageId
- the stage identifier- Returns:
- the journey instance for the user in the stage.
- Throws:
PortalException
- Since:
- 12.2.0
-
getInstancesByUser
public static Collection<JourneyInstance> getInstancesByUser(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 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
-
-