Package lumis.portal.activitystream
Class ActivityStreamManager
- java.lang.Object
-
- lumis.portal.activitystream.ActivityStreamManager
-
- All Implemented Interfaces:
IActivityStreamManager
,IActivityStreamManagerSPI
public class ActivityStreamManager extends Object implements IActivityStreamManagerSPI
Manager for the activity stream framework.- Since:
- 8.2.0
- Version:
- $Revision: 22901 $ $Date: 2019-07-02 11:51:03 -0300 (Tue, 02 Jul 2019) $
-
-
Field Summary
Fields Modifier and Type Field Description static String
TRANSACTION_ATTRIBUTE_DISABLE
ITransaction
attribute that when present disables activity stream observers for that transaction.-
Fields inherited from interface lumis.portal.activitystream.IActivityStreamManager
ACTION_ID_ADD, ACTION_ID_CREATE, ACTION_ID_DELETE, ACTION_ID_REMOVE, ACTION_ID_SHARE, ACTION_ID_UPDATE
-
Fields inherited from interface lumis.portal.activitystream.IActivityStreamManagerSPI
PROPERTY_ACTIVITY_PROCESSOR_DEFAULT_VALUE, PROPERTY_NAME_ACTIVITY_PROCESSOR_CONFIG_ID
-
-
Constructor Summary
Constructors Constructor Description ActivityStreamManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAction(ActivityAction action)
Adds a new action that may be used byactivities
.void
addActivity(Activity activity)
Adds an activity.void
addObjectType(ActivityObjectType objectType)
Adds an object type to the global registry.ISearchQueryFilter
createActivityStructureSearchQueryFilter(String rootChannelId, Collection<String> areaTags)
Creates aISearchQueryFilter
that filters the activities that belongs to a part of the structure of the portal.ISearchQueryFilter
createPriorityAndUserSearchQueryFilter(double minimumPriority, String userId)
Returns a big data search query filter that filters the activities according to the ones the specified user is allowed to access and has a priority of at least the value specified.void
deleteAction(ActivityAction action)
Deletes an action.void
deleteActivity(String activityId)
Deletes an activity given its identifier.void
deleteObjectType(ActivityObjectType objectType)
Deletes an object type from the global registry.void
deleteOldActivities()
Removes allactivities
that have reached their age deadline.void
disableActivityProcessor(ChannelConfig channel)
Set the activity processor of the given channel to disabledvoid
disableActivityProcessor(ServiceInstanceConfig serviceInstance)
Set the activity processor of the given service instance to disabledList<ActivityObjectType>
findObjectTypes(String query, int maxResults)
Find activity stream object types by id, given a search query.ActivityAction
getAction(String actionId)
Returns the action of given identifier.Integer
getActivitiesMaxAgeInDays()
Get the number of days anActivity
can exist before being removed.IActivityProcessorConfig
getActivityProcessorConfig(String activityProcessorConfigId)
Returns the activity processor configuration with the given identifier.String
getActivityProcessorId(ChannelConfig channel)
Get the activity processor identifier of the given channel.String
getActivityProcessorId(ServiceInstanceConfig serviceInstance)
Get the activity processor identifier of the given service instance.String
getLocalActivityProcessorId(ChannelConfig channel)
Get the local activity processor identifier of the given channel.String
getLocalActivityProcessorId(ServiceInstanceConfig serviceInstance)
Get the local activity processor identifier of the given service instance.ActivityObjectType
getObjectType(String objectTypeId)
Returns the object type of given identifier.List<ActivityObjectType>
getObjectTypes()
Returns list of persisted activity object types.Collection<String>
getReadActivityIds(long minimumTimeMillis)
Returns the identifiers of activities read by the current user since the specified time millis.boolean
isActivityRead(String activityId)
Verifies if an activity was already read by the current user.void
markActivityAsRead(String activityId)
Marks an activity as read by the current user.void
markActivityAsUnread(String activityId)
Marks an activity as unread by the current user.void
registerActivityProcessor(String activityProcessorConfigPath)
Registers an activity processor configuration.void
registerDefaultActions()
Registers built-in default activity stream actions.void
registerDefaultActivityProcessors()
Registers built-in default activity processors.void
setActivitiesMaxAgeInDays(Integer days)
Set the number of days anActivity
can exist before being removed.void
setActivityProcessorConfig(String activityProcessorId, ChannelConfig channel)
Set the Activity Processor for the given channel.void
setActivityProcessorConfig(String activityProcessorId, ServiceInstanceConfig serviceInstance)
Set the Activity Processor for the given service instance.void
setActivityProcessorInherited(ChannelConfig channel)
Set the activity processor of the given channel to be inherited from the parent channelvoid
setActivityProcessorInherited(ServiceInstanceConfig serviceInstance)
Set the activity processor of the given service instance to be inherited from the parent channelvoid
unregisterActivityProcessor(String activityProcessorConfigId)
Unregisters an activity processor configuration.void
updateActivityObject(ActivityObject activityObject, String scope)
Updates the given activity object for the activity in the specified scopes.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface lumis.portal.activitystream.IActivityStreamManagerSPI
findObjectTypes
-
-
-
-
Field Detail
-
TRANSACTION_ATTRIBUTE_DISABLE
public static final String TRANSACTION_ATTRIBUTE_DISABLE
ITransaction
attribute that when present disables activity stream observers for that transaction.- Since:
- 8.2.0
-
-
Method Detail
-
addActivity
public void addActivity(Activity activity) throws PortalException
Description copied from interface:IActivityStreamManager
Adds an activity.- Specified by:
addActivity
in interfaceIActivityStreamManager
- Parameters:
activity
- the activity to add.- Throws:
PortalException
-
getActivityProcessorId
public String getActivityProcessorId(ChannelConfig channel) throws PortalException
Description copied from interface:IActivityStreamManagerSPI
Get the activity processor identifier of the given channel.- Specified by:
getActivityProcessorId
in interfaceIActivityStreamManagerSPI
- Parameters:
channel
- the channel config- Throws:
PortalException
-
getActivityProcessorId
public String getActivityProcessorId(ServiceInstanceConfig serviceInstance) throws PortalException
Description copied from interface:IActivityStreamManagerSPI
Get the activity processor identifier of the given service instance.- Specified by:
getActivityProcessorId
in interfaceIActivityStreamManagerSPI
- Parameters:
serviceInstance
- the service instance- Throws:
PortalException
-
getLocalActivityProcessorId
public String getLocalActivityProcessorId(ChannelConfig channel) throws PortalException
Description copied from interface:IActivityStreamManagerSPI
Get the local activity processor identifier of the given channel.- Specified by:
getLocalActivityProcessorId
in interfaceIActivityStreamManagerSPI
- Parameters:
channel
- the channel config- Throws:
PortalException
-
getLocalActivityProcessorId
public String getLocalActivityProcessorId(ServiceInstanceConfig serviceInstance) throws PortalException
Description copied from interface:IActivityStreamManagerSPI
Get the local activity processor identifier of the given service instance.- Specified by:
getLocalActivityProcessorId
in interfaceIActivityStreamManagerSPI
- Parameters:
serviceInstance
- the service instance- Throws:
PortalException
-
createActivityStructureSearchQueryFilter
public ISearchQueryFilter createActivityStructureSearchQueryFilter(String rootChannelId, Collection<String> areaTags) throws PortalException
Description copied from interface:IActivityStreamManager
Creates aISearchQueryFilter
that filters the activities that belongs to a part of the structure of the portal.The filter created automatically discards the structure elements the current user does not have view permission on.
- Specified by:
createActivityStructureSearchQueryFilter
in interfaceIActivityStreamManager
- Parameters:
rootChannelId
- the identifier of the root channel of the portal area to be considered. Ifnull
, the portal root channel is used.areaTags
- the area tags to use to filter which part of structure is to be considered. Ifnull
, area tags will not be used to filter.- Returns:
- the corresponding search query filter.
- Throws:
PortalException
- See Also:
SearchQuery.setControlFilter(ISearchQueryFilter)
,IBigDataSearcher.search(SearchQuery)
,IBigDataManager.getDefaultRepository()
,ManagerFactory.getBigDataManager()
,ActivityDocument
-
createPriorityAndUserSearchQueryFilter
public ISearchQueryFilter createPriorityAndUserSearchQueryFilter(double minimumPriority, String userId) throws PortalException
Description copied from interface:IActivityStreamManager
Returns a big data search query filter that filters the activities according to the ones the specified user is allowed to access and has a priority of at least the value specified.- Specified by:
createPriorityAndUserSearchQueryFilter
in interfaceIActivityStreamManager
- Parameters:
minimumPriority
- the minimum priority value.userId
- the user identifier,- Returns:
- the query filter.
- Throws:
PortalException
-
isActivityRead
public boolean isActivityRead(String activityId) throws PortalException
Description copied from interface:IActivityStreamManager
Verifies if an activity was already read by the current user.- Specified by:
isActivityRead
in interfaceIActivityStreamManager
- Parameters:
activityId
- the identifier of the activity to be verified.- Returns:
- true if the current user read the activity.
- Throws:
PortalException
-
markActivityAsRead
public void markActivityAsRead(String activityId) throws PortalException
Description copied from interface:IActivityStreamManager
Marks an activity as read by the current user. If the activity is already marked as read by the current user, this method has no effect.- Specified by:
markActivityAsRead
in interfaceIActivityStreamManager
- Parameters:
activityId
- the activity identifier.- Throws:
PortalException
- if the operation could not be completed.
-
markActivityAsUnread
public void markActivityAsUnread(String activityId) throws PortalException
Description copied from interface:IActivityStreamManager
Marks an activity as unread by the current user. If the activity is already marked as unread by the current user, this method has no effect.- Specified by:
markActivityAsUnread
in interfaceIActivityStreamManager
- Parameters:
activityId
- the activity identifier.- Throws:
PortalException
- if the operation could not be completed.
-
deleteActivity
public void deleteActivity(String activityId) throws PortalException
Description copied from interface:IActivityStreamManager
Deletes an activity given its identifier.- Specified by:
deleteActivity
in interfaceIActivityStreamManager
- Parameters:
activityId
- the activity identifier.- Throws:
PortalException
-
getObjectType
public ActivityObjectType getObjectType(String objectTypeId) throws PortalException
Description copied from interface:IActivityStreamManager
Returns the object type of given identifier.- Specified by:
getObjectType
in interfaceIActivityStreamManager
- Parameters:
objectTypeId
- the object type identifier.- Returns:
- the persisted object type object.
- Throws:
PortalObjectNotFoundException
- if no object type with the given identifier was found.PortalException
-
getObjectTypes
public List<ActivityObjectType> getObjectTypes() throws PortalException
Description copied from interface:IActivityStreamManagerSPI
Returns list of persisted activity object types.- Specified by:
getObjectTypes
in interfaceIActivityStreamManagerSPI
- Returns:
- list of persisted activity object types.
- Throws:
PortalException
-
findObjectTypes
public List<ActivityObjectType> findObjectTypes(String query, int maxResults) throws PortalException
Description copied from interface:IActivityStreamManagerSPI
Find activity stream object types by id, given a search query.- Specified by:
findObjectTypes
in interfaceIActivityStreamManagerSPI
- Parameters:
query
- query used to search object typesmaxResults
- amount of object types to return- Returns:
- List of object types which matches the search query, ordered by id.
- Throws:
PortalException
-
addObjectType
public void addObjectType(ActivityObjectType objectType)
Description copied from interface:IActivityStreamManager
Adds an object type to the global registry.- Specified by:
addObjectType
in interfaceIActivityStreamManager
- Parameters:
objectType
- the object type.
-
deleteObjectType
public void deleteObjectType(ActivityObjectType objectType) throws PortalException
Description copied from interface:IActivityStreamManager
Deletes an object type from the global registry. All activities that refers the specified object type are also deleted.- Specified by:
deleteObjectType
in interfaceIActivityStreamManager
- Parameters:
objectType
- the object type.- Throws:
PortalException
-
addAction
public void addAction(ActivityAction action) throws PortalException
Description copied from interface:IActivityStreamManager
Adds a new action that may be used byactivities
.- Specified by:
addAction
in interfaceIActivityStreamManager
- Parameters:
action
- the action to add.- Throws:
PortalException
- if the action could be be added.
-
getAction
public ActivityAction getAction(String actionId) throws PortalException
Description copied from interface:IActivityStreamManager
Returns the action of given identifier.- Specified by:
getAction
in interfaceIActivityStreamManager
- Parameters:
actionId
- the action identifier.- Returns:
- the persisted action object.
- Throws:
PortalObjectNotFoundException
- if no action with the given identifier was found.PortalException
-
deleteAction
public void deleteAction(ActivityAction action) throws PortalException
Description copied from interface:IActivityStreamManager
Deletes an action. All activities that refers the specified action are also deleted.- Specified by:
deleteAction
in interfaceIActivityStreamManager
- Parameters:
action
- the action to be deleted.- Throws:
PortalException
- if the action could not be deleted.
-
registerDefaultActions
public void registerDefaultActions() throws PortalException
Description copied from interface:IActivityStreamManagerSPI
Registers built-in default activity stream actions.- Specified by:
registerDefaultActions
in interfaceIActivityStreamManagerSPI
- Throws:
PortalException
-
deleteOldActivities
public void deleteOldActivities() throws PortalException
Description copied from interface:IActivityStreamManagerSPI
Removes allactivities
that have reached their age deadline. The deadline is configured in the activity stream global administration interface.- Specified by:
deleteOldActivities
in interfaceIActivityStreamManagerSPI
- Throws:
PortalException
-
getActivitiesMaxAgeInDays
public Integer getActivitiesMaxAgeInDays() throws PortalException
Description copied from interface:IActivityStreamManagerSPI
Get the number of days anActivity
can exist before being removed.- Specified by:
getActivitiesMaxAgeInDays
in interfaceIActivityStreamManagerSPI
- Returns:
- the number of days.
- Throws:
PortalException
-
registerDefaultActivityProcessors
public void registerDefaultActivityProcessors() throws PortalException
Description copied from interface:IActivityStreamManagerSPI
Registers built-in default activity processors.- Specified by:
registerDefaultActivityProcessors
in interfaceIActivityStreamManagerSPI
- Throws:
PortalException
-
registerActivityProcessor
public void registerActivityProcessor(String activityProcessorConfigPath) throws PortalException
Description copied from interface:IActivityStreamManagerSPI
Registers an activity processor configuration.- Specified by:
registerActivityProcessor
in interfaceIActivityStreamManagerSPI
- Parameters:
activityProcessorConfigPath
- the path to the activity processor configuration, relative to the classpath.- Throws:
PortalException
- if the configuration could not be registered.
-
unregisterActivityProcessor
public void unregisterActivityProcessor(String activityProcessorConfigId) throws PortalException
Description copied from interface:IActivityStreamManagerSPI
Unregisters an activity processor configuration.- Specified by:
unregisterActivityProcessor
in interfaceIActivityStreamManagerSPI
- Parameters:
activityProcessorConfigId
- the identifier of the activity processor configuration.- Throws:
PortalException
- if the configuration could not be unregistered.
-
getActivityProcessorConfig
public IActivityProcessorConfig getActivityProcessorConfig(String activityProcessorConfigId) throws PortalException
Returns the activity processor configuration with the given identifier.- Specified by:
getActivityProcessorConfig
in interfaceIActivityStreamManagerSPI
- Parameters:
activityProcessorConfigId
- the identifier.- Returns:
- the activity processor configuration.
- Throws:
PortalException
- Since:
- 8.2.0
-
setActivitiesMaxAgeInDays
public void setActivitiesMaxAgeInDays(Integer days) throws PortalException
Description copied from interface:IActivityStreamManagerSPI
Set the number of days anActivity
can exist before being removed.- Specified by:
setActivitiesMaxAgeInDays
in interfaceIActivityStreamManagerSPI
- Parameters:
days
- the number of days to set.- Throws:
PortalException
-
setActivityProcessorConfig
public void setActivityProcessorConfig(String activityProcessorId, ServiceInstanceConfig serviceInstance) throws PortalException
Description copied from interface:IActivityStreamManagerSPI
Set the Activity Processor for the given service instance.- Specified by:
setActivityProcessorConfig
in interfaceIActivityStreamManagerSPI
- Parameters:
activityProcessorId
- the activity processor IdserviceInstance
- the service instance to get the property bag- Throws:
PortalException
-
setActivityProcessorConfig
public void setActivityProcessorConfig(String activityProcessorId, ChannelConfig channel) throws PortalException
Description copied from interface:IActivityStreamManagerSPI
Set the Activity Processor for the given channel.- Specified by:
setActivityProcessorConfig
in interfaceIActivityStreamManagerSPI
- Parameters:
activityProcessorId
- the activity processor Idchannel
- the channel to get the property bag- Throws:
PortalException
-
setActivityProcessorInherited
public void setActivityProcessorInherited(ServiceInstanceConfig serviceInstance) throws PortalException
Description copied from interface:IActivityStreamManagerSPI
Set the activity processor of the given service instance to be inherited from the parent channel- Specified by:
setActivityProcessorInherited
in interfaceIActivityStreamManagerSPI
- Parameters:
serviceInstance
- the service instance- Throws:
PortalException
-
setActivityProcessorInherited
public void setActivityProcessorInherited(ChannelConfig channel) throws PortalException
Description copied from interface:IActivityStreamManagerSPI
Set the activity processor of the given channel to be inherited from the parent channel- Specified by:
setActivityProcessorInherited
in interfaceIActivityStreamManagerSPI
- Parameters:
channel
- the channel config- Throws:
PortalException
-
disableActivityProcessor
public void disableActivityProcessor(ServiceInstanceConfig serviceInstance) throws PortalException
Description copied from interface:IActivityStreamManagerSPI
Set the activity processor of the given service instance to disabled- Specified by:
disableActivityProcessor
in interfaceIActivityStreamManagerSPI
- Parameters:
serviceInstance
- the service instance- Throws:
PortalException
-
disableActivityProcessor
public void disableActivityProcessor(ChannelConfig channel) throws PortalException
Description copied from interface:IActivityStreamManagerSPI
Set the activity processor of the given channel to disabled- Specified by:
disableActivityProcessor
in interfaceIActivityStreamManagerSPI
- Parameters:
channel
- the channel config- Throws:
PortalException
-
getReadActivityIds
public Collection<String> getReadActivityIds(long minimumTimeMillis)
Description copied from interface:IActivityStreamManager
Returns the identifiers of activities read by the current user since the specified time millis.- Specified by:
getReadActivityIds
in interfaceIActivityStreamManager
- Parameters:
minimumTimeMillis
- the time millis specifying the minimum time value of activity read.- Returns:
- the activity identifiers.
-
updateActivityObject
public void updateActivityObject(ActivityObject activityObject, String scope) throws PortalException
Description copied from interface:IActivityStreamManagerSPI
Updates the given activity object for the activity in the specified scopes.For each activity in the specified scope, the activity's
objects
andtargets
with sameidentifier
andtype
as the givenactivityObject
are updated with its properties.To prevent excessive resource usage, this method may update only some of the activity objects, leaving the other unmodified.
This method was initially intended for public API, but it has some strange limitations and may be replaced/modified, so keeping in SPI for now.
- Specified by:
updateActivityObject
in interfaceIActivityStreamManagerSPI
- Parameters:
activityObject
- the activity object with updated information.scope
- the scope of activities to be processed.- Throws:
PortalException
- if the operation could not be completed.
-
-