Class DefaultStatisticService
- java.lang.Object
-
- org.silverpeas.core.silverstatistics.access.service.DefaultStatisticService
-
- All Implemented Interfaces:
ComponentInstanceDeletion
,StatisticService
@Service @Singleton public class DefaultStatisticService extends Object implements StatisticService, ComponentInstanceDeletion
Default implementation of Statistic service layer which manage statistics
-
-
Field Summary
Fields Modifier and Type Field Description static int
ACTION_ACCESS
-
Constructor Summary
Constructors Modifier Constructor Description protected
DefaultStatisticService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addStat(String userId, SilverpeasContent content)
void
addStat(String userId, ResourceReference resourceReference, int actionType, String objectType)
void
delete(String componentInstanceId)
Deletes the resources belonging to the specified component instance.void
deleteStats(SilverpeasContent content)
void
deleteStats(ResourceReference resourceReference, String objectType)
<T extends Contribution>
Stream<T>filterRead(Collection<T> contributions, String userId)
Filters the given contributions in order to keep only those read by the user represented by the given identifier.int
getCount(List<ResourceReference> resourceReferences, int action, String objectType)
int
getCount(SilverpeasContent content)
int
getCount(SilverpeasContent content, int action)
int
getCount(ResourceReference resourceReference, int action, String objectType)
int
getCount(ResourceReference resourceReference, String objectType)
int
getCountByPeriod(List<ResourceReference> refs, int action, String objectType, Date startDate, Date endDate)
int
getCountByPeriodAndUser(List<ResourceReference> refs, String objectType, Date startDate, Date endDate, List<String> userIds)
int
getDistinctCountByPeriod(List<ResourceReference> refs, int action, String objectType, Date startDate, Date endDate)
int
getDistinctCountByPeriodUser(List<ResourceReference> refs, int action, String objectType, Date startDate, Date endDate, List<String> userIds)
SilverpeasList<HistoryObjectDetail>
getHistoryByAction(ResourceReference resourceReference, int action, String objectType, Collection<String> excludedUserIds, PaginationPage pagination)
List<HistoryByUser>
getHistoryByObject(ResourceReference resourceReference, int action, String objectType)
List<HistoryByUser>
getHistoryByObject(ResourceReference resourceReference, int action, String objectType, List<String> userIds)
SilverpeasList<HistoryObjectDetail>
getHistoryByObjectAndUser(ResourceReference resourceReference, int action, String objectType, String userId, PaginationPage paginationPage, HistoryCriteria.QUERY_ORDER_BY orderBy)
List<HistoryByUser>
getHistoryByUser(ResourceReference resourceReference, int action, String objectType)
Collection<HistoryObjectDetail>
getLastHistoryOfObjectsForUser(String userId, int actionType, String objectType, int nbObjects)
Gets the last history detail of each object associated to a user.void
moveStat(ResourceReference toResourceReference, int actionType, String objectType)
-
-
-
Field Detail
-
ACTION_ACCESS
public static final int ACTION_ACCESS
- See Also:
- Constant Field Values
-
-
Method Detail
-
addStat
public void addStat(String userId, ResourceReference resourceReference, int actionType, String objectType)
- Specified by:
addStat
in interfaceStatisticService
-
addStat
public void addStat(String userId, SilverpeasContent content)
- Specified by:
addStat
in interfaceStatisticService
-
getCount
public int getCount(List<ResourceReference> resourceReferences, int action, String objectType)
- Specified by:
getCount
in interfaceStatisticService
-
getCount
public int getCount(ResourceReference resourceReference, int action, String objectType)
- Specified by:
getCount
in interfaceStatisticService
-
getCount
public int getCount(SilverpeasContent content, int action)
- Specified by:
getCount
in interfaceStatisticService
-
getCount
public int getCount(ResourceReference resourceReference, String objectType)
- Specified by:
getCount
in interfaceStatisticService
-
getCount
public int getCount(SilverpeasContent content)
- Specified by:
getCount
in interfaceStatisticService
-
getHistoryByUser
public List<HistoryByUser> getHistoryByUser(ResourceReference resourceReference, int action, String objectType)
- Specified by:
getHistoryByUser
in interfaceStatisticService
-
getHistoryByAction
public SilverpeasList<HistoryObjectDetail> getHistoryByAction(ResourceReference resourceReference, int action, String objectType, Collection<String> excludedUserIds, PaginationPage pagination)
- Specified by:
getHistoryByAction
in interfaceStatisticService
-
getHistoryByObjectAndUser
public SilverpeasList<HistoryObjectDetail> getHistoryByObjectAndUser(ResourceReference resourceReference, int action, String objectType, String userId, PaginationPage paginationPage, HistoryCriteria.QUERY_ORDER_BY orderBy)
- Specified by:
getHistoryByObjectAndUser
in interfaceStatisticService
-
getHistoryByObject
public List<HistoryByUser> getHistoryByObject(ResourceReference resourceReference, int action, String objectType)
- Specified by:
getHistoryByObject
in interfaceStatisticService
-
getHistoryByObject
public List<HistoryByUser> getHistoryByObject(ResourceReference resourceReference, int action, String objectType, List<String> userIds)
- Specified by:
getHistoryByObject
in interfaceStatisticService
-
deleteStats
public void deleteStats(ResourceReference resourceReference, String objectType)
- Specified by:
deleteStats
in interfaceStatisticService
-
deleteStats
public void deleteStats(SilverpeasContent content)
- Specified by:
deleteStats
in interfaceStatisticService
-
moveStat
public void moveStat(ResourceReference toResourceReference, int actionType, String objectType)
- Specified by:
moveStat
in interfaceStatisticService
-
getCountByPeriod
public int getCountByPeriod(List<ResourceReference> refs, int action, String objectType, Date startDate, Date endDate)
- Specified by:
getCountByPeriod
in interfaceStatisticService
objectType
- String representation of an object typestartDate
- the start dateendDate
- the end date- Returns:
- the number of access over a list of publications between startDate and endDate
-
getCountByPeriodAndUser
public int getCountByPeriodAndUser(List<ResourceReference> refs, String objectType, Date startDate, Date endDate, List<String> userIds)
- Specified by:
getCountByPeriodAndUser
in interfaceStatisticService
objectType
- String representation of an object typestartDate
- the start dateendDate
- the end dateuserIds
- the user identifiers- Returns:
- the number of access over a list of publications between startDate and endDate for specific user
-
getDistinctCountByPeriod
public int getDistinctCountByPeriod(List<ResourceReference> refs, int action, String objectType, Date startDate, Date endDate)
- Specified by:
getDistinctCountByPeriod
in interfaceStatisticService
objectType
- String representation of an object typestartDate
- the start dateendDate
- the end date- Returns:
- the number of access over a list of publications between startDate and endDate
-
getDistinctCountByPeriodUser
public int getDistinctCountByPeriodUser(List<ResourceReference> refs, int action, String objectType, Date startDate, Date endDate, List<String> userIds)
- Specified by:
getDistinctCountByPeriodUser
in interfaceStatisticService
-
getLastHistoryOfObjectsForUser
public Collection<HistoryObjectDetail> getLastHistoryOfObjectsForUser(String userId, int actionType, String objectType, int nbObjects)
Description copied from interface:StatisticService
Gets the last history detail of each object associated to a user. The result is sorted on the datetime from the youngest to the oldest and limited according to the nbObjects parameter.- Specified by:
getLastHistoryOfObjectsForUser
in interfaceStatisticService
- Returns:
- ordered list of unique objects used by the user
-
filterRead
public <T extends Contribution> Stream<T> filterRead(Collection<T> contributions, String userId)
Description copied from interface:StatisticService
Filters the given contributions in order to keep only those read by the user represented by the given identifier.- Specified by:
filterRead
in interfaceStatisticService
- Type Parameters:
T
- the type of contribution.- Parameters:
contributions
- the contributions to filter.userId
- the identifier of the user to verify.- Returns:
- a stream of read
-
delete
public void delete(String componentInstanceId)
Deletes the resources belonging to the specified component instance. This method is invoked by Silverpeas when a component instance is being deleted.- Specified by:
delete
in interfaceComponentInstanceDeletion
- Parameters:
componentInstanceId
- the unique identifier of a component instance.
-
-