Class UserSegmentationManager
- java.lang.Object
-
- lumis.service.analytics.usersegmentation.manager.UserSegmentationManager
-
- All Implemented Interfaces:
IUserSegmentationManager
,IUserSegmentationManagerSPI
public class UserSegmentationManager extends Object implements IUserSegmentationManagerSPI
Manager for user segmentations.- Since:
- 11.1.0
- Version:
- $Revision: 24441 $ $Date: 2021-03-31 19:57:51 -0300 (Wed, 31 Mar 2021) $
-
-
Field Summary
Fields Modifier and Type Field Description static String
USER_JOINED_SEGMENTATION_EVENT_ID
static String
USER_LEFT_SEGMENTATION_EVENT_ID
-
Constructor Summary
Constructors Constructor Description UserSegmentationManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IUserSegmentation
createSegmentationForJourneyStage(JourneyStage stage)
Creates a segmentation for the given journey stage.void
deleteSegmentations(Collection<String> ids, String serviceInstanceId)
Delete the given segmentations.void
deleteSegmentationsByServiceInstanceId(String serviceInstanceId)
Deletes all segmentations of the given service instance.List<IUserSegmentation>
findByServiceInstanceAndLikeName(String name, String serviceInstanceId)
Returns the segmentations of the given service instance that matches the givenname
parameter.UserSegmentation
getById(String id)
Returns the segmentation with the given identifier ornull
if no segmentation exists with the given identifier.IUserSegmentation
getByJourneyStage(String journeyStageId)
Returns the segmentation of a journey stage ornull
if there's none.UserSegmentation
getByNameAndServiceInstance(String name, String serviceInstanceId)
Returns the segmentation of the given name and service instance.List<IUserSegmentation>
getByServiceInstance(String serviceInstanceId)
Returns the segmentations of the given service instance.Collection<String>
getMemberSegmentations(String monitorUserId)
Returns a collection of segmentations of the given user.Collection<String>
getMemberSegmentations(String monitorUserId, boolean useSessionCache)
Returns a collection of segmentations of the given user.Collection<String>
getPortalMembers(String segmentationId)
Returns the segmentation members.Collection<String>
getPortalMemberSegmentations(String portalUserId, boolean useSessionCache)
Returns a collection of segmentations of the given (portal) user.Collection<IUserSegmentation>
getSegmentationsThatNeedToHaveMembershipUpdated()
Returns a collection of user segmentations that must have the memberships updated.IMonitorValuesProvider
getUserSegmentationMonitorValuesProvider(IUserSegmentation segmentation)
Returns aIMonitorValuesProvider
that fills user segmentation information.boolean
isMember(Collection<String> segmentationIds, String monitorUserId)
Verifies if a user is a member of one of the specified segmentations.
The given user identifier refers to monitor user, not to the portal user.String
saveSegmentation(String name, String serviceInstanceId, org.json.JSONObject segmentationFilter)
Save the given segmentation and returns the identifier of the segmentation added or updated.IUserSegmentation
updateSegmentation(String id, String serviceInstanceId, org.json.JSONObject filter)
Updates the given segmentation with the given filters.void
updateSegmentationMembership(IUserSegmentation segmentation)
Updates the given segmentation memberships cache.void
updateSegmentationMembership(IUserSegmentation segmentation, String monitorUserId)
Updates the given segmentation membership cache for the given user.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface lumis.portal.analytics.usersegmentation.IUserSegmentationManagerSPI
getPortalMemberSegmentations
-
-
-
-
Field Detail
-
USER_JOINED_SEGMENTATION_EVENT_ID
public static final String USER_JOINED_SEGMENTATION_EVENT_ID
- See Also:
- Constant Field Values
-
USER_LEFT_SEGMENTATION_EVENT_ID
public static final String USER_LEFT_SEGMENTATION_EVENT_ID
- See Also:
- Constant Field Values
-
-
Method Detail
-
saveSegmentation
public String saveSegmentation(String name, String serviceInstanceId, org.json.JSONObject segmentationFilter) throws PortalException
Description copied from interface:IUserSegmentationManagerSPI
Save the given segmentation and returns the identifier of the segmentation added or updated. The affected segmentation will not have an attached group.- Specified by:
saveSegmentation
in interfaceIUserSegmentationManagerSPI
- Parameters:
name
- the segmentation name.serviceInstanceId
- the service instance identifier.segmentationFilter
- the segmentation filter.- Returns:
- the identifier of the segmentation added or updated.
- Throws:
PortalException
-
createSegmentationForJourneyStage
public IUserSegmentation createSegmentationForJourneyStage(JourneyStage stage) throws PortalException
Creates a segmentation for the given journey stage.- Parameters:
stage
- the journey stage.- Returns:
- the created segmentation.
- Throws:
PortalException
- Since:
- 12.2.0
-
updateSegmentation
public IUserSegmentation updateSegmentation(String id, String serviceInstanceId, org.json.JSONObject filter) throws PortalException
Description copied from interface:IUserSegmentationManagerSPI
Updates the given segmentation with the given filters. Does not change anything about an attached group.- Specified by:
updateSegmentation
in interfaceIUserSegmentationManagerSPI
- Parameters:
id
- the segmentation identifier.serviceInstanceId
- the service instance identifier.filter
- the segmentation filter.- Returns:
- updated entity.
- Throws:
PortalException
-
deleteSegmentations
public void deleteSegmentations(Collection<String> ids, String serviceInstanceId) throws PortalException
Description copied from interface:IUserSegmentationManagerSPI
Delete the given segmentations.- Specified by:
deleteSegmentations
in interfaceIUserSegmentationManagerSPI
- Parameters:
ids
- the segmentation identifiers.serviceInstanceId
- the service instance identifier.- Throws:
PortalException
-
deleteSegmentationsByServiceInstanceId
public void deleteSegmentationsByServiceInstanceId(String serviceInstanceId) throws PortalException
Description copied from interface:IUserSegmentationManagerSPI
Deletes all segmentations of the given service instance.- Specified by:
deleteSegmentationsByServiceInstanceId
in interfaceIUserSegmentationManagerSPI
- Parameters:
serviceInstanceId
- the service instance identifier.- Throws:
PortalException
-
getByNameAndServiceInstance
public UserSegmentation getByNameAndServiceInstance(String name, String serviceInstanceId) throws PortalException
Description copied from interface:IUserSegmentationManager
Returns the segmentation of the given name and service instance.- Specified by:
getByNameAndServiceInstance
in interfaceIUserSegmentationManager
- Parameters:
name
- the segmentation name.serviceInstanceId
- the service instance identifier.- Returns:
- the segmentation of the given name and service instance.
- Throws:
PortalObjectNotFoundException
- if no such segmentation could be found.PortalException
-
findByServiceInstanceAndLikeName
public List<IUserSegmentation> findByServiceInstanceAndLikeName(String name, String serviceInstanceId) throws PortalException
Description copied from interface:IUserSegmentationManagerSPI
Returns the segmentations of the given service instance that matches the givenname
parameter.- Specified by:
findByServiceInstanceAndLikeName
in interfaceIUserSegmentationManagerSPI
- Parameters:
name
- the segmentation name.serviceInstanceId
- the service instance identifier.- Returns:
- the segmentations of the given service instance that matches the given
name
parameter. - Throws:
PortalException
-
getById
public UserSegmentation getById(String id) throws PortalException
Description copied from interface:IUserSegmentationManagerSPI
Returns the segmentation with the given identifier ornull
if no segmentation exists with the given identifier.- Specified by:
getById
in interfaceIUserSegmentationManagerSPI
- Parameters:
id
- the segmentation identifier.- Returns:
- the segmentation with the given identifier or
null
if no segmentation exists with the given identifier. - Throws:
PortalException
-
getByServiceInstance
public List<IUserSegmentation> getByServiceInstance(String serviceInstanceId) throws PortalException
Description copied from interface:IUserSegmentationManagerSPI
Returns the segmentations of the given service instance.- Specified by:
getByServiceInstance
in interfaceIUserSegmentationManagerSPI
- Parameters:
serviceInstanceId
- the service instance identifier.- Returns:
- the segmentations of the given service instance.
- Throws:
PortalException
-
getByJourneyStage
public IUserSegmentation getByJourneyStage(String journeyStageId) throws PortalException
Returns the segmentation of a journey stage ornull
if there's none.- Parameters:
journeyStageId
- the journey stage identifier.- Returns:
- the segmentation of a journey stage or
null
if there's none. - Throws:
PortalException
- Since:
- 12.2.0
-
isMember
public boolean isMember(Collection<String> segmentationIds, String monitorUserId) throws PortalException
Description copied from interface:IUserSegmentationManagerSPI
Verifies if a user is a member of one of the specified segmentations.
The given user identifier refers to monitor user, not to the portal user.- Specified by:
isMember
in interfaceIUserSegmentationManagerSPI
- Parameters:
segmentationIds
- the segmentation identifiers.monitorUserId
- the monitor user identifier.- Returns:
- true if the user is member of any of the segmentations, false otherwise.
- Throws:
PortalException
-
getPortalMembers
public Collection<String> getPortalMembers(String segmentationId) throws PortalException
Description copied from interface:IUserSegmentationManagerSPI
Returns the segmentation members. The members are monitor users.- Specified by:
getPortalMembers
in interfaceIUserSegmentationManagerSPI
- Parameters:
segmentationId
- the segmentation identifier.- Returns:
- a collection of segmentation member identifiers.
- Throws:
PortalException
-
getMemberSegmentations
public Collection<String> getMemberSegmentations(String monitorUserId) throws PortalException
Description copied from interface:IUserSegmentationManagerSPI
Returns a collection of segmentations of the given user.- Specified by:
getMemberSegmentations
in interfaceIUserSegmentationManagerSPI
- Parameters:
monitorUserId
- the monitor user identifier.- Returns:
- a collection of segmentations of the given user.
- Throws:
PortalException
-
getMemberSegmentations
public Collection<String> getMemberSegmentations(String monitorUserId, boolean useSessionCache) throws PortalException
Description copied from interface:IUserSegmentationManagerSPI
Returns a collection of segmentations of the given user.- Specified by:
getMemberSegmentations
in interfaceIUserSegmentationManagerSPI
- Parameters:
monitorUserId
- the monitor user identifier.useSessionCache
- indicates whether session cache should be used.- Returns:
- a collection of segmentations of the given user.
- Throws:
PortalException
-
getPortalMemberSegmentations
public Collection<String> getPortalMemberSegmentations(String portalUserId, boolean useSessionCache) throws PortalException
Description copied from interface:IUserSegmentationManagerSPI
Returns a collection of segmentations of the given (portal) user.- Specified by:
getPortalMemberSegmentations
in interfaceIUserSegmentationManagerSPI
- Returns:
- a collection of segmentations of the given (portal) user.
- Throws:
PortalException
-
getSegmentationsThatNeedToHaveMembershipUpdated
public Collection<IUserSegmentation> getSegmentationsThatNeedToHaveMembershipUpdated() throws PortalException
Description copied from interface:IUserSegmentationManagerSPI
Returns a collection of user segmentations that must have the memberships updated.- Specified by:
getSegmentationsThatNeedToHaveMembershipUpdated
in interfaceIUserSegmentationManagerSPI
- Returns:
- a collection of user segmentations that must have the memberships updated.
- Throws:
PortalException
-
updateSegmentationMembership
public void updateSegmentationMembership(IUserSegmentation segmentation) throws PortalException
Description copied from interface:IUserSegmentationManager
Updates the given segmentation memberships cache. This method uses its own transaction for updating the segmentation membership.- Specified by:
updateSegmentationMembership
in interfaceIUserSegmentationManager
- Parameters:
segmentation
- the segmentation.- Throws:
PortalException
-
updateSegmentationMembership
public void updateSegmentationMembership(IUserSegmentation segmentation, String monitorUserId) throws PortalException
Description copied from interface:IUserSegmentationManager
Updates the given segmentation membership cache for the given user. This method uses its own transaction for updating the segmentation membership.- Specified by:
updateSegmentationMembership
in interfaceIUserSegmentationManager
- Parameters:
segmentation
- the segmentation.monitorUserId
- the monitor user identifier.- Throws:
PortalException
-
getUserSegmentationMonitorValuesProvider
public IMonitorValuesProvider getUserSegmentationMonitorValuesProvider(IUserSegmentation segmentation)
Description copied from interface:IUserSegmentationManagerSPI
Returns aIMonitorValuesProvider
that fills user segmentation information.- Specified by:
getUserSegmentationMonitorValuesProvider
in interfaceIUserSegmentationManagerSPI
- Parameters:
segmentation
- the user segmentation.- Returns:
- a
IMonitorValuesProvider
that fills user segmentation information.
-
-