Class UserSegmentationManager
- java.lang.Object
-
- lumis.service.analytics.usersegmentation.manager.UserSegmentationManager
-
- All Implemented Interfaces:
IUserSegmentationManager
,IUserSegmentationManagerSPI
public class UserSegmentationManager extends java.lang.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 java.lang.String
USER_JOINED_SEGMENTATION_EVENT_ID
static java.lang.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(java.util.Collection<java.lang.String> ids, java.lang.String serviceInstanceId)
Delete the given segmentations.void
deleteSegmentationsByServiceInstanceId(java.lang.String serviceInstanceId)
Deletes all segmentations of the given service instance.java.util.List<IUserSegmentation>
findByServiceInstanceAndLikeName(java.lang.String name, java.lang.String serviceInstanceId)
Returns the segmentations of the given service instance that matches the givenname
parameter.UserSegmentation
getById(java.lang.String id)
Returns the segmentation with the given identifier ornull
if no segmentation exists with the given identifier.IUserSegmentation
getByJourneyStage(java.lang.String journeyStageId)
Returns the segmentation of a journey stage ornull
if there's none.UserSegmentation
getByNameAndServiceInstance(java.lang.String name, java.lang.String serviceInstanceId)
Returns the segmentation of the given name and service instance.java.util.List<IUserSegmentation>
getByServiceInstance(java.lang.String serviceInstanceId)
Returns the segmentations of the given service instance.java.util.Collection<java.lang.String>
getMemberSegmentations(java.lang.String monitorUserId)
Returns a collection of segmentations of the given user.java.util.Collection<java.lang.String>
getMemberSegmentations(java.lang.String monitorUserId, boolean useSessionCache)
Returns a collection of segmentations of the given user.java.util.Collection<java.lang.String>
getPortalMembers(java.lang.String segmentationId)
Returns the segmentation members.java.util.Collection<java.lang.String>
getPortalMemberSegmentations(java.lang.String portalUserId, boolean useSessionCache)
Returns a collection of segmentations of the given (portal) user.java.util.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(java.util.Collection<java.lang.String> segmentationIds, java.lang.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.java.lang.String
saveSegmentation(java.lang.String name, java.lang.String serviceInstanceId, org.json.JSONObject segmentationFilter)
Save the given segmentation and returns the identifier of the segmentation added or updated.IUserSegmentation
updateSegmentation(java.lang.String id, java.lang.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, java.lang.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 java.lang.String USER_JOINED_SEGMENTATION_EVENT_ID
- See Also:
- Constant Field Values
-
USER_LEFT_SEGMENTATION_EVENT_ID
public static final java.lang.String USER_LEFT_SEGMENTATION_EVENT_ID
- See Also:
- Constant Field Values
-
-
Method Detail
-
saveSegmentation
public java.lang.String saveSegmentation(java.lang.String name, java.lang.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(java.lang.String id, java.lang.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(java.util.Collection<java.lang.String> ids, java.lang.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(java.lang.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(java.lang.String name, java.lang.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 java.util.List<IUserSegmentation> findByServiceInstanceAndLikeName(java.lang.String name, java.lang.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(java.lang.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 java.util.List<IUserSegmentation> getByServiceInstance(java.lang.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(java.lang.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(java.util.Collection<java.lang.String> segmentationIds, java.lang.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 java.util.Collection<java.lang.String> getPortalMembers(java.lang.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 java.util.Collection<java.lang.String> getMemberSegmentations(java.lang.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 java.util.Collection<java.lang.String> getMemberSegmentations(java.lang.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 java.util.Collection<java.lang.String> getPortalMemberSegmentations(java.lang.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 java.util.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, java.lang.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.
-
-