public class ActivityStreamImpl extends Object implements ActivityStream, org.xwiki.observation.EventListener
ActivityStream
.Modifier and Type | Field and Description |
---|---|
static List<org.xwiki.observation.event.Event> |
LISTENER_EVENTS
The events to match.
|
Constructor and Description |
---|
ActivityStreamImpl() |
Modifier and Type | Method and Description |
---|---|
void |
addActivityEvent(ActivityEvent event,
XWikiContext context)
Adding an activity event.
|
void |
addActivityEvent(ActivityEvent event,
XWikiDocument doc,
XWikiContext context) |
void |
addActivityEvent(String streamName,
String type,
String title,
List<String> params,
XWikiContext context)
Adding an activity event.
|
void |
addActivityEvent(String streamName,
String type,
String title,
XWikiContext context)
Adding an activity event.
|
void |
addDocumentActivityEvent(String streamName,
XWikiDocument doc,
String type,
int priority,
String title,
List<String> params,
XWikiContext context)
Adding an activity event.
|
void |
addDocumentActivityEvent(String streamName,
XWikiDocument doc,
String type,
int priority,
String title,
XWikiContext context)
Adding an activity event.
|
void |
addDocumentActivityEvent(String streamName,
XWikiDocument doc,
String type,
String title,
List<String> params,
XWikiContext context)
Adding an activity event.
|
void |
addDocumentActivityEvent(String streamName,
XWikiDocument doc,
String type,
String title,
XWikiContext context)
Adding an activity event.
|
void |
deleteActivityEvent(ActivityEvent event,
XWikiContext context)
Delete the given event from the database.
|
protected String |
generateEventId(ActivityEvent event,
XWikiContext context)
Generate event ID for the given ID.
|
List<org.xwiki.observation.event.Event> |
getEvents() |
List<ActivityEvent> |
getEvents(boolean filter,
int nb,
int start,
XWikiContext context)
Get events from the activity stream.
|
List<ActivityEvent> |
getEvents(String stream,
boolean filter,
int nb,
int start,
XWikiContext context)
Get events from a particular activity stream.
|
List<ActivityEvent> |
getEventsForSpace(String space,
boolean filter,
int nb,
int start,
XWikiContext context)
Get events from the activity stream of a space.
|
List<ActivityEvent> |
getEventsForSpace(String stream,
String space,
boolean filter,
int nb,
int start,
XWikiContext context)
Get events from the given activity stream which happened in a particular space.
|
List<ActivityEvent> |
getEventsForUser(String user,
boolean filter,
int nb,
int start,
XWikiContext context)
Get events from the activity stream of a user.
|
List<ActivityEvent> |
getEventsForUser(String stream,
String user,
boolean filter,
int nb,
int start,
XWikiContext context)
Get events from the given activity stream which have been fired by a particular user.
|
com.sun.syndication.feed.synd.SyndFeed |
getFeed(List<ActivityEvent> events,
String author,
String title,
String description,
String copyright,
String encoding,
String url,
String suffix,
XWikiContext context)
Get a feed from the given events.
|
com.sun.syndication.feed.synd.SyndFeed |
getFeed(List<ActivityEvent> events,
String author,
String title,
String description,
String copyright,
String encoding,
String url,
XWikiContext context)
Get a feed from the given events.
|
com.sun.syndication.feed.synd.SyndFeed |
getFeed(List<ActivityEvent> events,
String suffix,
XWikiContext context)
Get a feed from the given events.
|
com.sun.syndication.feed.synd.SyndFeed |
getFeed(List<ActivityEvent> events,
XWikiContext context)
Get a feed from the given events.
|
com.sun.syndication.feed.synd.SyndEntry |
getFeedEntry(ActivityEvent event,
String suffix,
XWikiContext context)
Get the feed entry for the given event.
|
com.sun.syndication.feed.synd.SyndEntry |
getFeedEntry(ActivityEvent event,
XWikiContext context)
Get the feed entry for the given event.
|
String |
getFeedOutput(List<ActivityEvent> events,
String author,
String title,
String description,
String copyright,
String encoding,
String url,
String type,
String suffix,
XWikiContext context)
Get the string representation of a feed from the given events.
|
String |
getFeedOutput(List<ActivityEvent> events,
String author,
String title,
String description,
String copyright,
String encoding,
String url,
String type,
XWikiContext context)
Get the string representation of a feed from the given events.
|
String |
getFeedOutput(com.sun.syndication.feed.synd.SyndFeed feed,
String type) |
String |
getName() |
List<ActivityEvent> |
getRelatedEvents(ActivityEvent event,
XWikiContext context)
Get events that have the same requestId as the event passed as parameter.
|
String |
getStreamName(String space,
XWikiContext context)
Transforms space reference into stream name.
|
void |
init(XWikiContext context)
Init method, must be called on plugin init.
|
protected ActivityEvent |
newActivityEvent() |
void |
onEvent(org.xwiki.observation.event.Event event,
Object source,
Object data) |
protected void |
prepareEvent(ActivityEvent event,
XWikiDocument doc,
XWikiContext context)
Set fields in the given event object.
|
List<Object[]> |
searchDailyPages(String optionalWhereClause,
int maxItems,
int startAt,
XWikiContext context)
Get unique pages with events sorted by date, grouped by days.
|
List<Object[]> |
searchDailyPages(String optionalWhereClause,
List<Object> parametersValues,
int maxItems,
int startAt,
XWikiContext context)
Get unique pages with events sorted by date, grouped by days.
|
List<ActivityEvent> |
searchEvents(String hql,
boolean filter,
boolean globalSearch,
int nb,
int start,
List<Object> parameterValues,
XWikiContext context)
Search events.
|
List<ActivityEvent> |
searchEvents(String hql,
boolean filter,
boolean globalSearch,
int nb,
int start,
XWikiContext context)
Search events.
|
List<ActivityEvent> |
searchEvents(String hql,
boolean filter,
int nb,
int start,
XWikiContext context)
Search events.
|
List<ActivityEvent> |
searchEvents(String fromHql,
String hql,
boolean filter,
boolean globalSearch,
int nb,
int start,
List<Object> parameterValues,
XWikiContext context)
Search events.
|
List<ActivityEvent> |
searchEvents(String fromHql,
String hql,
boolean filter,
boolean globalSearch,
int nb,
int start,
XWikiContext context)
Search events.
|
List<ActivityEvent> |
searchEvents(String fromHql,
String hql,
boolean filter,
int nb,
int start,
List<Object> parameterValues,
XWikiContext context)
Search events.
|
List<ActivityEvent> |
searchEvents(String fromHql,
String hql,
boolean filter,
int nb,
int start,
XWikiContext context)
Search events.
|
List<Object[]> |
searchUniquePages(String optionalWhereClause,
int maxItems,
int startAt,
XWikiContext context)
Get unique pages with events sorted by date.
|
List<Object[]> |
searchUniquePages(String optionalWhereClause,
List<Object> parametersValues,
int maxItems,
int startAt,
XWikiContext context)
Get unique pages with events sorted by date.
|
public static final List<org.xwiki.observation.event.Event> LISTENER_EVENTS
protected void prepareEvent(ActivityEvent event, XWikiDocument doc, XWikiContext context)
event
- the event to preparedoc
- document which fired the eventcontext
- the XWiki contextprotected String generateEventId(ActivityEvent event, XWikiContext context)
event
- event to generate the ID forcontext
- the XWiki contextprotected ActivityEvent newActivityEvent()
ActivityEventImpl
.public void init(XWikiContext context) throws XWikiException
ActivityStream
init
in interface ActivityStream
context
- the XWiki contextXWikiException
- if the init of the activity stream failedpublic String getStreamName(String space, XWikiContext context)
ActivityStream
getStreamName
in interface ActivityStream
space
- the space local serialized reference to transformcontext
- the XWiki contextpublic void addActivityEvent(ActivityEvent event, XWikiContext context) throws ActivityStreamException
ActivityStream
addActivityEvent
in interface ActivityStream
event
- event to add to the streamcontext
- the XWiki contextActivityStreamException
- if the addition to the stream failspublic void addActivityEvent(ActivityEvent event, XWikiDocument doc, XWikiContext context) throws ActivityStreamException
event
- event to add to the streamdoc
- which fired the eventcontext
- the XWiki contextActivityStreamException
- if the addition to the stream failspublic void addActivityEvent(String streamName, String type, String title, XWikiContext context) throws ActivityStreamException
ActivityStream
addActivityEvent
in interface ActivityStream
streamName
- name of the stream to use for the additiontype
- type of the eventtitle
- title of the eventcontext
- the XWiki contextActivityStreamException
- if the addition to the stream failspublic void addActivityEvent(String streamName, String type, String title, List<String> params, XWikiContext context) throws ActivityStreamException
ActivityStream
addActivityEvent
in interface ActivityStream
streamName
- name of the stream to use for the additiontype
- type of the eventtitle
- title of the eventparams
- parameters of the eventcontext
- the XWiki contextActivityStreamException
- if the addition to the stream failspublic void addDocumentActivityEvent(String streamName, XWikiDocument doc, String type, String title, XWikiContext context) throws ActivityStreamException
ActivityStream
addDocumentActivityEvent
in interface ActivityStream
streamName
- name of the stream to use for the additiondoc
- which fired the eventtype
- type of the eventtitle
- title of the eventcontext
- the XWiki contextActivityStreamException
- if the addition to the stream failspublic void addDocumentActivityEvent(String streamName, XWikiDocument doc, String type, int priority, String title, XWikiContext context) throws ActivityStreamException
ActivityStream
addDocumentActivityEvent
in interface ActivityStream
streamName
- name of the stream to use for the additiondoc
- which fired the eventtype
- type of the eventpriority
- priority of the eventtitle
- title of the eventcontext
- the XWiki contextActivityStreamException
- if the addition to the stream failspublic void addDocumentActivityEvent(String streamName, XWikiDocument doc, String type, String title, List<String> params, XWikiContext context) throws ActivityStreamException
ActivityStream
addDocumentActivityEvent
in interface ActivityStream
streamName
- name of the stream to use for the additiondoc
- which fired the eventtype
- type of the eventtitle
- title of the eventparams
- parameters of the eventcontext
- the XWiki contextActivityStreamException
- if the addition to the stream failspublic void addDocumentActivityEvent(String streamName, XWikiDocument doc, String type, int priority, String title, List<String> params, XWikiContext context) throws ActivityStreamException
ActivityStream
addDocumentActivityEvent
in interface ActivityStream
streamName
- name of the stream to use for the additiondoc
- which fired the eventtype
- type of the eventpriority
- priority of the eventtitle
- title of the eventparams
- parameters of the eventcontext
- the XWiki contextActivityStreamException
- if the addition to the stream failspublic void deleteActivityEvent(ActivityEvent event, XWikiContext context) throws ActivityStreamException
ActivityStream
deleteActivityEvent
in interface ActivityStream
event
- the event to deletecontext
- the XWiki contextActivityStreamException
- if the delete of the event failspublic List<ActivityEvent> searchEvents(String hql, boolean filter, int nb, int start, XWikiContext context) throws ActivityStreamException
ActivityStream
searchEvents
in interface ActivityStream
hql
- HQL where query statementfilter
- true if the events should be filtered by prioritynb
- number of events to retrievestart
- query offsetcontext
- the XWiki contextActivityStreamException
- if the search query failspublic List<ActivityEvent> searchEvents(String hql, boolean filter, boolean globalSearch, int nb, int start, XWikiContext context) throws ActivityStreamException
ActivityStream
searchEvents
in interface ActivityStream
hql
- HQL where query statementfilter
- true if the events should be filtered by priorityglobalSearch
- true if the request must be performed on the main databasenb
- number of events to retrievestart
- query offsetcontext
- the XWiki contextActivityStreamException
- if the search query failspublic List<ActivityEvent> searchEvents(String hql, boolean filter, boolean globalSearch, int nb, int start, List<Object> parameterValues, XWikiContext context) throws ActivityStreamException
ActivityStream
searchEvents
in interface ActivityStream
hql
- HQL where query statementfilter
- true if the events should be filtered by priorityglobalSearch
- true if the request must be performed on the main databasenb
- number of events to retrievestart
- query offsetparameterValues
- values of the parametrized querycontext
- the XWiki contextActivityStreamException
- if the search query failspublic List<ActivityEvent> searchEvents(String fromHql, String hql, boolean filter, int nb, int start, XWikiContext context) throws ActivityStreamException
ActivityStream
searchEvents
in interface ActivityStream
fromHql
- HQL from query statementhql
- HQL where query statementfilter
- true if the events should be filtered by prioritynb
- number of events to retrievestart
- query offsetcontext
- the XWiki contextActivityStreamException
- if the search query failspublic List<ActivityEvent> searchEvents(String fromHql, String hql, boolean filter, boolean globalSearch, int nb, int start, XWikiContext context) throws ActivityStreamException
ActivityStream
searchEvents
in interface ActivityStream
fromHql
- HQL from query statementhql
- HQL where query statementfilter
- true if the events should be filtered by priorityglobalSearch
- true if the request must be performed on the main databasenb
- number of events to retrievestart
- query offsetcontext
- the XWiki contextActivityStreamException
- if the search query failspublic List<ActivityEvent> searchEvents(String fromHql, String hql, boolean filter, int nb, int start, List<Object> parameterValues, XWikiContext context) throws ActivityStreamException
ActivityStream
searchEvents
in interface ActivityStream
fromHql
- HQL from query statementhql
- HQL where query statementfilter
- true if the events should be filtered by prioritynb
- number of events to retrievestart
- query offsetparameterValues
- values of the parametrized querycontext
- the XWiki contextActivityStreamException
- if the search query failspublic List<ActivityEvent> searchEvents(String fromHql, String hql, boolean filter, boolean globalSearch, int nb, int start, List<Object> parameterValues, XWikiContext context) throws ActivityStreamException
ActivityStream
searchEvents
in interface ActivityStream
fromHql
- HQL from query statementhql
- HQL where query statementfilter
- true if the events should be filtered by priorityglobalSearch
- true if the request must be performed on the main databasenb
- number of events to retrievestart
- query offsetparameterValues
- values of the parametrized querycontext
- the XWiki contextActivityStreamException
- if the search query failspublic List<ActivityEvent> getEvents(boolean filter, int nb, int start, XWikiContext context) throws ActivityStreamException
ActivityStream
getEvents
in interface ActivityStream
filter
- true if the events should be filtered by prioritynb
- number of events to retrievestart
- query offsetcontext
- the XWiki contextActivityStreamException
- if the retrieval failspublic List<ActivityEvent> getEventsForSpace(String space, boolean filter, int nb, int start, XWikiContext context) throws ActivityStreamException
ActivityStream
getEventsForSpace
in interface ActivityStream
space
- local serialized reference of the space to retrieve the events fromfilter
- true if the events should be filtered by prioritynb
- number of events to retrievestart
- query offsetcontext
- the XWiki contextActivityStreamException
- if the retrieval failspublic List<ActivityEvent> getEventsForUser(String user, boolean filter, int nb, int start, XWikiContext context) throws ActivityStreamException
ActivityStream
getEventsForUser
in interface ActivityStream
user
- user to retrieve the events fromfilter
- true if the events should be filtered by prioritynb
- number of events to retrievestart
- query offsetcontext
- the XWiki contextActivityStreamException
- if the retrieval failspublic List<ActivityEvent> getEvents(String stream, boolean filter, int nb, int start, XWikiContext context) throws ActivityStreamException
ActivityStream
getEvents
in interface ActivityStream
stream
- name of the activity stream to retrieve the events fromfilter
- true if the events should be filtered by prioritynb
- number of events to retrievestart
- query offsetcontext
- the XWiki contextActivityStreamException
- if the retrieval failspublic List<ActivityEvent> getEventsForSpace(String stream, String space, boolean filter, int nb, int start, XWikiContext context) throws ActivityStreamException
ActivityStream
getEventsForSpace
in interface ActivityStream
stream
- name of the activity stream to retrieve the events fromspace
- local serialized reference of the space to retrieve the events fromfilter
- true if the events should be filtered by prioritynb
- number of events to retrievestart
- query offsetcontext
- the XWiki contextActivityStreamException
- if the retrieval failspublic List<ActivityEvent> getEventsForUser(String stream, String user, boolean filter, int nb, int start, XWikiContext context) throws ActivityStreamException
ActivityStream
getEventsForUser
in interface ActivityStream
stream
- name of the activity stream to retrieve the events fromuser
- user to retrieve the events fromfilter
- true if the events should be filtered by prioritynb
- number of events to retrievestart
- query offsetcontext
- the XWiki contextActivityStreamException
- if the retrieval failspublic com.sun.syndication.feed.synd.SyndEntry getFeedEntry(ActivityEvent event, XWikiContext context)
ActivityStream
getFeedEntry
in interface ActivityStream
event
- event to get the entry forcontext
- the XWiki contextpublic com.sun.syndication.feed.synd.SyndEntry getFeedEntry(ActivityEvent event, String suffix, XWikiContext context)
ActivityStream
getFeedEntry
in interface ActivityStream
event
- event to get the entry forsuffix
- suffix to add to entry title and body stringscontext
- the XWiki contextpublic com.sun.syndication.feed.synd.SyndFeed getFeed(List<ActivityEvent> events, XWikiContext context)
ActivityStream
getFeed
in interface ActivityStream
events
- events to create the feed fromcontext
- the XWiki contextpublic com.sun.syndication.feed.synd.SyndFeed getFeed(List<ActivityEvent> events, String suffix, XWikiContext context)
ActivityStream
getFeed
in interface ActivityStream
events
- events to create the feed fromsuffix
- suffix to add to entries title and body stringscontext
- the XWiki contextpublic com.sun.syndication.feed.synd.SyndFeed getFeed(List<ActivityEvent> events, String author, String title, String description, String copyright, String encoding, String url, XWikiContext context)
ActivityStream
getFeed
in interface ActivityStream
events
- events to create the feed fromauthor
- author to set in the feed metadatatitle
- title to set in the feed metadatadescription
- description to set in the feed metadatacopyright
- copyright to set in the feed metadataencoding
- encoding to set in the feed metadataurl
- URL to set in the feed metadatacontext
- the XWiki contextpublic com.sun.syndication.feed.synd.SyndFeed getFeed(List<ActivityEvent> events, String author, String title, String description, String copyright, String encoding, String url, String suffix, XWikiContext context)
ActivityStream
getFeed
in interface ActivityStream
events
- events to create the feed fromauthor
- author to set in the feed metadatatitle
- title to set in the feed metadatadescription
- description to set in the feed metadatacopyright
- copyright to set in the feed metadataencoding
- encoding to set in the feed metadataurl
- URL to set in the feed metadatasuffix
- suffix to add to entries title and body stringscontext
- the XWiki contextpublic String getFeedOutput(List<ActivityEvent> events, String author, String title, String description, String copyright, String encoding, String url, String type, XWikiContext context)
ActivityStream
getFeedOutput
in interface ActivityStream
events
- events to create the feed fromauthor
- author to set in the feed metadatatitle
- title to set in the feed metadatadescription
- description to set in the feed metadatacopyright
- copyright to set in the feed metadataencoding
- encoding to set in the feed metadataurl
- URL to set in the feed metadatatype
- the feed type (syntax) to use, null if none. It can be any version of RSS or Atom. Some
possible values are "rss_1.0", "rss_2.0" and "atom_1.0"context
- the XWiki contextpublic String getFeedOutput(List<ActivityEvent> events, String author, String title, String description, String copyright, String encoding, String url, String type, String suffix, XWikiContext context)
ActivityStream
getFeedOutput
in interface ActivityStream
events
- events to create the feed fromauthor
- author to set in the feed metadatatitle
- title to set in the feed metadatadescription
- description to set in the feed metadatacopyright
- copyright to set in the feed metadataencoding
- encoding to set in the feed metadataurl
- URL to set in the feed metadatatype
- the feed type (syntax) to use, null if none. It can be any version of RSS or Atom. Some
possible values are "rss_1.0", "rss_2.0" and "atom_1.0"suffix
- suffix to add to entries title and body stringscontext
- the XWiki contextpublic String getFeedOutput(com.sun.syndication.feed.synd.SyndFeed feed, String type)
getFeedOutput
in interface ActivityStream
feed
- the feed to get the string representation fortype
- the feed type (syntax) to use, null if none. It can be any version of RSS or Atom. Some
possible values are "rss_1.0", "rss_2.0" and "atom_1.0"public List<org.xwiki.observation.event.Event> getEvents()
getEvents
in interface org.xwiki.observation.EventListener
public String getName()
getName
in interface org.xwiki.observation.EventListener
public void onEvent(org.xwiki.observation.event.Event event, Object source, Object data)
onEvent
in interface org.xwiki.observation.EventListener
public List<ActivityEvent> getRelatedEvents(ActivityEvent event, XWikiContext context) throws ActivityStreamException
ActivityStream
getRelatedEvents
in interface ActivityStream
event
- the event for which to look for related eventscontext
- the XWiki contextActivityStreamException
- if the retrieval failspublic List<Object[]> searchUniquePages(String optionalWhereClause, int maxItems, int startAt, XWikiContext context) throws ActivityStreamException
ActivityStream
searchUniquePages
in interface ActivityStream
optionalWhereClause
- optional HQL where query statementmaxItems
- maximum number of documents to retrievestartAt
- query offsetcontext
- the XWiki contextActivityStreamException
- if the search failspublic List<Object[]> searchUniquePages(String optionalWhereClause, List<Object> parametersValues, int maxItems, int startAt, XWikiContext context) throws ActivityStreamException
ActivityStream
searchUniquePages
in interface ActivityStream
optionalWhereClause
- optional HQL where query statementparametersValues
- values for the query parametersmaxItems
- maximum number of documents to retrievestartAt
- query offsetcontext
- the XWiki contextActivityStreamException
- if the search failspublic List<Object[]> searchDailyPages(String optionalWhereClause, int maxItems, int startAt, XWikiContext context) throws ActivityStreamException
ActivityStream
searchDailyPages
in interface ActivityStream
optionalWhereClause
- optional HQL where query statementmaxItems
- maximum number of documents to retrievestartAt
- query offsetcontext
- the XWiki contextActivityStreamException
- if the search failspublic List<Object[]> searchDailyPages(String optionalWhereClause, List<Object> parametersValues, int maxItems, int startAt, XWikiContext context) throws ActivityStreamException
ActivityStream
searchDailyPages
in interface ActivityStream
optionalWhereClause
- optional HQL where query statementparametersValues
- values for the query parametersmaxItems
- maximum number of documents to retrievestartAt
- query offsetcontext
- the XWiki contextActivityStreamException
- if the search failsCopyright © 2004–2019 XWiki. All rights reserved.