com.xpn.xwiki.plugin.activitystream.impl
Class ActivityStreamImpl

java.lang.Object
  extended by com.xpn.xwiki.plugin.activitystream.impl.ActivityStreamImpl
All Implemented Interfaces:
ActivityStream, org.xwiki.observation.EventListener

public class ActivityStreamImpl
extends Object
implements ActivityStream, org.xwiki.observation.EventListener

Default implementation for ActivityStream.

Version:
$Id: fac4b144159205fdb4d2cf953cc6353b8073a44b $

Constructor Summary
ActivityStreamImpl()
           
 
Method Summary
 void addActivityEvent(ActivityEvent event, com.xpn.xwiki.XWikiContext context)
          Adding an activity event.
 void addActivityEvent(ActivityEvent event, com.xpn.xwiki.doc.XWikiDocument doc, com.xpn.xwiki.XWikiContext context)
           
 void addActivityEvent(String streamName, String type, String title, List<String> params, com.xpn.xwiki.XWikiContext context)
          Adding an activity event.
 void addActivityEvent(String streamName, String type, String title, com.xpn.xwiki.XWikiContext context)
          Adding an activity event.
 void addDocumentActivityEvent(String streamName, com.xpn.xwiki.doc.XWikiDocument doc, String type, int priority, String title, List<String> params, com.xpn.xwiki.XWikiContext context)
          Adding an activity event.
 void addDocumentActivityEvent(String streamName, com.xpn.xwiki.doc.XWikiDocument doc, String type, int priority, String title, com.xpn.xwiki.XWikiContext context)
          Adding an activity event.
 void addDocumentActivityEvent(String streamName, com.xpn.xwiki.doc.XWikiDocument doc, String type, String title, List<String> params, com.xpn.xwiki.XWikiContext context)
          Adding an activity event.
 void addDocumentActivityEvent(String streamName, com.xpn.xwiki.doc.XWikiDocument doc, String type, String title, com.xpn.xwiki.XWikiContext context)
          Adding an activity event.
 void deleteActivityEvent(ActivityEvent event, com.xpn.xwiki.XWikiContext context)
          Delete the given event from the database.
protected  String generateEventId(ActivityEvent event, com.xpn.xwiki.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, com.xpn.xwiki.XWikiContext context)
          Get events from the activity stream.
 List<ActivityEvent> getEvents(String stream, boolean filter, int nb, int start, com.xpn.xwiki.XWikiContext context)
          Get events from a particular activity stream.
 List<ActivityEvent> getEventsForSpace(String space, boolean filter, int nb, int start, com.xpn.xwiki.XWikiContext context)
          Get events from the activity stream of a space.
 List<ActivityEvent> getEventsForSpace(String stream, String space, boolean filter, int nb, int start, com.xpn.xwiki.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, com.xpn.xwiki.XWikiContext context)
          Get events from the activity stream of a user.
 List<ActivityEvent> getEventsForUser(String stream, String user, boolean filter, int nb, int start, com.xpn.xwiki.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, com.xpn.xwiki.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, com.xpn.xwiki.XWikiContext context)
          Get a feed from the given events.
 com.sun.syndication.feed.synd.SyndFeed getFeed(List<ActivityEvent> events, String suffix, com.xpn.xwiki.XWikiContext context)
          Get a feed from the given events.
 com.sun.syndication.feed.synd.SyndFeed getFeed(List<ActivityEvent> events, com.xpn.xwiki.XWikiContext context)
          Get a feed from the given events.
 com.sun.syndication.feed.synd.SyndEntry getFeedEntry(ActivityEvent event, String suffix, com.xpn.xwiki.XWikiContext context)
          Get the feed entry for the given event.
 com.sun.syndication.feed.synd.SyndEntry getFeedEntry(ActivityEvent event, com.xpn.xwiki.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, com.xpn.xwiki.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, com.xpn.xwiki.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, com.xpn.xwiki.XWikiContext context)
          Get events that have the same requestId as the event passed as parameter.
 String getStreamName(String space, com.xpn.xwiki.XWikiContext context)
          Tranforms space name into stream name.
 void init(com.xpn.xwiki.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, com.xpn.xwiki.doc.XWikiDocument doc, com.xpn.xwiki.XWikiContext context)
          Set fields in the given event object.
 List<Object[]> searchDailyPages(String optionalWhereClause, int maxItems, int startAt, com.xpn.xwiki.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, com.xpn.xwiki.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, com.xpn.xwiki.XWikiContext context)
          Search events.
 List<ActivityEvent> searchEvents(String hql, boolean filter, boolean globalSearch, int nb, int start, com.xpn.xwiki.XWikiContext context)
          Search events.
 List<ActivityEvent> searchEvents(String hql, boolean filter, int nb, int start, com.xpn.xwiki.XWikiContext context)
          Search events.
 List<ActivityEvent> searchEvents(String fromHql, String hql, boolean filter, boolean globalSearch, int nb, int start, List<Object> parameterValues, com.xpn.xwiki.XWikiContext context)
          Search events.
 List<ActivityEvent> searchEvents(String fromHql, String hql, boolean filter, boolean globalSearch, int nb, int start, com.xpn.xwiki.XWikiContext context)
          Search events.
 List<ActivityEvent> searchEvents(String fromHql, String hql, boolean filter, int nb, int start, List<Object> parameterValues, com.xpn.xwiki.XWikiContext context)
          Search events.
 List<ActivityEvent> searchEvents(String fromHql, String hql, boolean filter, int nb, int start, com.xpn.xwiki.XWikiContext context)
          Search events.
 List<Object[]> searchUniquePages(String optionalWhereClause, int maxItems, int startAt, com.xpn.xwiki.XWikiContext context)
          Get unique pages with events sorted by date.
 List<Object[]> searchUniquePages(String optionalWhereClause, List<Object> parametersValues, int maxItems, int startAt, com.xpn.xwiki.XWikiContext context)
          Get unique pages with events sorted by date.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActivityStreamImpl

public ActivityStreamImpl()
Method Detail

prepareEvent

protected void prepareEvent(ActivityEvent event,
                            com.xpn.xwiki.doc.XWikiDocument doc,
                            com.xpn.xwiki.XWikiContext context)
Set fields in the given event object.

Parameters:
event - the event to prepare
doc - document which fired the event
context - the XWiki context

generateEventId

protected String generateEventId(ActivityEvent event,
                                 com.xpn.xwiki.XWikiContext context)
Generate event ID for the given ID. Note that this method does not perform the set of the ID in the event object.

Parameters:
event - event to generate the ID for
context - the XWiki context
Returns:
the generated ID

newActivityEvent

protected ActivityEvent newActivityEvent()
Returns:
a new instance of ActivityEventImpl.

init

public void init(com.xpn.xwiki.XWikiContext context)
          throws com.xpn.xwiki.XWikiException
Description copied from interface: ActivityStream
Init method, must be called on plugin init.

Specified by:
init in interface ActivityStream
Parameters:
context - the XWiki context
Throws:
com.xpn.xwiki.XWikiException - if the init of the activity stream failed

getStreamName

public String getStreamName(String space,
                            com.xpn.xwiki.XWikiContext context)
Description copied from interface: ActivityStream
Tranforms space name into stream name.

Specified by:
getStreamName in interface ActivityStream
Parameters:
space - space to transform
context - the XWiki context
Returns:
the name of the stream for the given space

addActivityEvent

public void addActivityEvent(ActivityEvent event,
                             com.xpn.xwiki.XWikiContext context)
                      throws ActivityStreamException
Description copied from interface: ActivityStream
Adding an activity event. The Id does not need to be filled as it will be created. Date and Wiki are optional.

Specified by:
addActivityEvent in interface ActivityStream
Parameters:
event - event to add to the stream
context - the XWiki context
Throws:
ActivityStreamException - if the addition to the stream fails

addActivityEvent

public void addActivityEvent(ActivityEvent event,
                             com.xpn.xwiki.doc.XWikiDocument doc,
                             com.xpn.xwiki.XWikiContext context)
                      throws ActivityStreamException
Parameters:
event - event to add to the stream
doc - which fired the event
context - the XWiki context
Throws:
ActivityStreamException - if the addition to the stream fails

addActivityEvent

public void addActivityEvent(String streamName,
                             String type,
                             String title,
                             com.xpn.xwiki.XWikiContext context)
                      throws ActivityStreamException
Description copied from interface: ActivityStream
Adding an activity event. The Id does not need to be filled as it will be created. Date and Wiki are optional.

Specified by:
addActivityEvent in interface ActivityStream
Parameters:
streamName - name of the stream to use for the addition
type - type of the event
title - title of the event
context - the XWiki context
Throws:
ActivityStreamException - if the addition to the stream fails

addActivityEvent

public void addActivityEvent(String streamName,
                             String type,
                             String title,
                             List<String> params,
                             com.xpn.xwiki.XWikiContext context)
                      throws ActivityStreamException
Description copied from interface: ActivityStream
Adding an activity event. The Id does not need to be filled as it will be created. Date and Wiki are optional.

Specified by:
addActivityEvent in interface ActivityStream
Parameters:
streamName - name of the stream to use for the addition
type - type of the event
title - title of the event
params - parameters of the event
context - the XWiki context
Throws:
ActivityStreamException - if the addition to the stream fails

addDocumentActivityEvent

public void addDocumentActivityEvent(String streamName,
                                     com.xpn.xwiki.doc.XWikiDocument doc,
                                     String type,
                                     String title,
                                     com.xpn.xwiki.XWikiContext context)
                              throws ActivityStreamException
Description copied from interface: ActivityStream
Adding an activity event. The Id does not need to be filled as it will be created. Date and Wiki are optional.

Specified by:
addDocumentActivityEvent in interface ActivityStream
Parameters:
streamName - name of the stream to use for the addition
doc - which fired the event
type - type of the event
title - title of the event
context - the XWiki context
Throws:
ActivityStreamException - if the addition to the stream fails

addDocumentActivityEvent

public void addDocumentActivityEvent(String streamName,
                                     com.xpn.xwiki.doc.XWikiDocument doc,
                                     String type,
                                     int priority,
                                     String title,
                                     com.xpn.xwiki.XWikiContext context)
                              throws ActivityStreamException
Description copied from interface: ActivityStream
Adding an activity event. The Id does not need to be filled as it will be created. Date and Wiki are optional.

Specified by:
addDocumentActivityEvent in interface ActivityStream
Parameters:
streamName - name of the stream to use for the addition
doc - which fired the event
type - type of the event
priority - priority of the event
title - title of the event
context - the XWiki context
Throws:
ActivityStreamException - if the addition to the stream fails

addDocumentActivityEvent

public void addDocumentActivityEvent(String streamName,
                                     com.xpn.xwiki.doc.XWikiDocument doc,
                                     String type,
                                     String title,
                                     List<String> params,
                                     com.xpn.xwiki.XWikiContext context)
                              throws ActivityStreamException
Description copied from interface: ActivityStream
Adding an activity event. The Id does not need to be filled as it will be created. Date and Wiki are optional.

Specified by:
addDocumentActivityEvent in interface ActivityStream
Parameters:
streamName - name of the stream to use for the addition
doc - which fired the event
type - type of the event
title - title of the event
params - parameters of the event
context - the XWiki context
Throws:
ActivityStreamException - if the addition to the stream fails

addDocumentActivityEvent

public void addDocumentActivityEvent(String streamName,
                                     com.xpn.xwiki.doc.XWikiDocument doc,
                                     String type,
                                     int priority,
                                     String title,
                                     List<String> params,
                                     com.xpn.xwiki.XWikiContext context)
                              throws ActivityStreamException
Description copied from interface: ActivityStream
Adding an activity event. The Id does not need to be filled as it will be created. Date and Wiki are optional.

Specified by:
addDocumentActivityEvent in interface ActivityStream
Parameters:
streamName - name of the stream to use for the addition
doc - which fired the event
type - type of the event
priority - priority of the event
title - title of the event
params - parameters of the event
context - the XWiki context
Throws:
ActivityStreamException - if the addition to the stream fails

deleteActivityEvent

public void deleteActivityEvent(ActivityEvent event,
                                com.xpn.xwiki.XWikiContext context)
                         throws ActivityStreamException
Description copied from interface: ActivityStream
Delete the given event from the database.

Specified by:
deleteActivityEvent in interface ActivityStream
Parameters:
event - the event to delete
context - the XWiki context
Throws:
ActivityStreamException - if the delete of the event fails

searchEvents

public List<ActivityEvent> searchEvents(String hql,
                                        boolean filter,
                                        int nb,
                                        int start,
                                        com.xpn.xwiki.XWikiContext context)
                                 throws ActivityStreamException
Description copied from interface: ActivityStream
Search events.

Specified by:
searchEvents in interface ActivityStream
Parameters:
hql - HQL where query statement
filter - true if the events should be filtered by priority
nb - number of events to retrieve
start - query offset
context - the XWiki context
Returns:
matching events
Throws:
ActivityStreamException - if the search query fails

searchEvents

public List<ActivityEvent> searchEvents(String hql,
                                        boolean filter,
                                        boolean globalSearch,
                                        int nb,
                                        int start,
                                        com.xpn.xwiki.XWikiContext context)
                                 throws ActivityStreamException
Description copied from interface: ActivityStream
Search events.

Specified by:
searchEvents in interface ActivityStream
Parameters:
hql - HQL where query statement
filter - true if the events should be filtered by priority
globalSearch - true if the request must be performed on the main database
nb - number of events to retrieve
start - query offset
context - the XWiki context
Returns:
matching events
Throws:
ActivityStreamException - if the search query fails

searchEvents

public List<ActivityEvent> searchEvents(String hql,
                                        boolean filter,
                                        boolean globalSearch,
                                        int nb,
                                        int start,
                                        List<Object> parameterValues,
                                        com.xpn.xwiki.XWikiContext context)
                                 throws ActivityStreamException
Description copied from interface: ActivityStream
Search events.

Specified by:
searchEvents in interface ActivityStream
Parameters:
hql - HQL where query statement
filter - true if the events should be filtered by priority
globalSearch - true if the request must be performed on the main database
nb - number of events to retrieve
start - query offset
parameterValues - values of the parametrized query
context - the XWiki context
Returns:
matching events
Throws:
ActivityStreamException - if the search query fails

searchEvents

public List<ActivityEvent> searchEvents(String fromHql,
                                        String hql,
                                        boolean filter,
                                        int nb,
                                        int start,
                                        com.xpn.xwiki.XWikiContext context)
                                 throws ActivityStreamException
Description copied from interface: ActivityStream
Search events.

Specified by:
searchEvents in interface ActivityStream
Parameters:
fromHql - HQL from query statement
hql - HQL where query statement
filter - true if the events should be filtered by priority
nb - number of events to retrieve
start - query offset
context - the XWiki context
Returns:
matching events
Throws:
ActivityStreamException - if the search query fails

searchEvents

public List<ActivityEvent> searchEvents(String fromHql,
                                        String hql,
                                        boolean filter,
                                        boolean globalSearch,
                                        int nb,
                                        int start,
                                        com.xpn.xwiki.XWikiContext context)
                                 throws ActivityStreamException
Description copied from interface: ActivityStream
Search events.

Specified by:
searchEvents in interface ActivityStream
Parameters:
fromHql - HQL from query statement
hql - HQL where query statement
filter - true if the events should be filtered by priority
globalSearch - true if the request must be performed on the main database
nb - number of events to retrieve
start - query offset
context - the XWiki context
Returns:
matching events
Throws:
ActivityStreamException - if the search query fails

searchEvents

public List<ActivityEvent> searchEvents(String fromHql,
                                        String hql,
                                        boolean filter,
                                        int nb,
                                        int start,
                                        List<Object> parameterValues,
                                        com.xpn.xwiki.XWikiContext context)
                                 throws ActivityStreamException
Description copied from interface: ActivityStream
Search events.

Specified by:
searchEvents in interface ActivityStream
Parameters:
fromHql - HQL from query statement
hql - HQL where query statement
filter - true if the events should be filtered by priority
nb - number of events to retrieve
start - query offset
parameterValues - values of the parametrized query
context - the XWiki context
Returns:
matching events
Throws:
ActivityStreamException - if the search query fails

searchEvents

public List<ActivityEvent> searchEvents(String fromHql,
                                        String hql,
                                        boolean filter,
                                        boolean globalSearch,
                                        int nb,
                                        int start,
                                        List<Object> parameterValues,
                                        com.xpn.xwiki.XWikiContext context)
                                 throws ActivityStreamException
Description copied from interface: ActivityStream
Search events.

Specified by:
searchEvents in interface ActivityStream
Parameters:
fromHql - HQL from query statement
hql - HQL where query statement
filter - true if the events should be filtered by priority
globalSearch - true if the request must be performed on the main database
nb - number of events to retrieve
start - query offset
parameterValues - values of the parametrized query
context - the XWiki context
Returns:
matching events
Throws:
ActivityStreamException - if the search query fails

getEvents

public List<ActivityEvent> getEvents(boolean filter,
                                     int nb,
                                     int start,
                                     com.xpn.xwiki.XWikiContext context)
                              throws ActivityStreamException
Description copied from interface: ActivityStream
Get events from the activity stream.

Specified by:
getEvents in interface ActivityStream
Parameters:
filter - true if the events should be filtered by priority
nb - number of events to retrieve
start - query offset
context - the XWiki context
Returns:
a list of events
Throws:
ActivityStreamException - if the retrieval fails

getEventsForSpace

public List<ActivityEvent> getEventsForSpace(String space,
                                             boolean filter,
                                             int nb,
                                             int start,
                                             com.xpn.xwiki.XWikiContext context)
                                      throws ActivityStreamException
Description copied from interface: ActivityStream
Get events from the activity stream of a space.

Specified by:
getEventsForSpace in interface ActivityStream
Parameters:
space - space to retrieve the events from
filter - true if the events should be filtered by priority
nb - number of events to retrieve
start - query offset
context - the XWiki context
Returns:
a list of events
Throws:
ActivityStreamException - if the retrieval fails

getEventsForUser

public List<ActivityEvent> getEventsForUser(String user,
                                            boolean filter,
                                            int nb,
                                            int start,
                                            com.xpn.xwiki.XWikiContext context)
                                     throws ActivityStreamException
Description copied from interface: ActivityStream
Get events from the activity stream of a user.

Specified by:
getEventsForUser in interface ActivityStream
Parameters:
user - user to retrieve the events from
filter - true if the events should be filtered by priority
nb - number of events to retrieve
start - query offset
context - the XWiki context
Returns:
a list of events
Throws:
ActivityStreamException - if the retrieval fails

getEvents

public List<ActivityEvent> getEvents(String stream,
                                     boolean filter,
                                     int nb,
                                     int start,
                                     com.xpn.xwiki.XWikiContext context)
                              throws ActivityStreamException
Description copied from interface: ActivityStream
Get events from a particular activity stream.

Specified by:
getEvents in interface ActivityStream
Parameters:
stream - name of the activity stream to retrieve the events from
filter - true if the events should be filtered by priority
nb - number of events to retrieve
start - query offset
context - the XWiki context
Returns:
a list of events
Throws:
ActivityStreamException - if the retrieval fails

getEventsForSpace

public List<ActivityEvent> getEventsForSpace(String stream,
                                             String space,
                                             boolean filter,
                                             int nb,
                                             int start,
                                             com.xpn.xwiki.XWikiContext context)
                                      throws ActivityStreamException
Description copied from interface: ActivityStream
Get events from the given activity stream which happened in a particular space.

Specified by:
getEventsForSpace in interface ActivityStream
Parameters:
stream - name of the activity stream to retrieve the events from
space - space to retrieve the events from
filter - true if the events should be filtered by priority
nb - number of events to retrieve
start - query offset
context - the XWiki context
Returns:
a list of events
Throws:
ActivityStreamException - if the retrieval fails

getEventsForUser

public List<ActivityEvent> getEventsForUser(String stream,
                                            String user,
                                            boolean filter,
                                            int nb,
                                            int start,
                                            com.xpn.xwiki.XWikiContext context)
                                     throws ActivityStreamException
Description copied from interface: ActivityStream
Get events from the given activity stream which have been fired by a particular user.

Specified by:
getEventsForUser in interface ActivityStream
Parameters:
stream - name of the activity stream to retrieve the events from
user - user to retrieve the events from
filter - true if the events should be filtered by priority
nb - number of events to retrieve
start - query offset
context - the XWiki context
Returns:
a list of events
Throws:
ActivityStreamException - if the retrieval fails

getFeedEntry

public com.sun.syndication.feed.synd.SyndEntry getFeedEntry(ActivityEvent event,
                                                            com.xpn.xwiki.XWikiContext context)
Description copied from interface: ActivityStream
Get the feed entry for the given event.

Specified by:
getFeedEntry in interface ActivityStream
Parameters:
event - event to get the entry for
context - the XWiki context
Returns:
the feed entry corresponding to the event

getFeedEntry

public com.sun.syndication.feed.synd.SyndEntry getFeedEntry(ActivityEvent event,
                                                            String suffix,
                                                            com.xpn.xwiki.XWikiContext context)
Description copied from interface: ActivityStream
Get the feed entry for the given event.

Specified by:
getFeedEntry in interface ActivityStream
Parameters:
event - event to get the entry for
suffix - suffix to add to entry title and body strings
context - the XWiki context
Returns:
the feed entry corresponding to the event

getFeed

public com.sun.syndication.feed.synd.SyndFeed getFeed(List<ActivityEvent> events,
                                                      com.xpn.xwiki.XWikiContext context)
Description copied from interface: ActivityStream
Get a feed from the given events.

Specified by:
getFeed in interface ActivityStream
Parameters:
events - events to create the feed from
context - the XWiki context
Returns:
the feed entry corresponding to the given events

getFeed

public com.sun.syndication.feed.synd.SyndFeed getFeed(List<ActivityEvent> events,
                                                      String suffix,
                                                      com.xpn.xwiki.XWikiContext context)
Description copied from interface: ActivityStream
Get a feed from the given events.

Specified by:
getFeed in interface ActivityStream
Parameters:
events - events to create the feed from
suffix - suffix to add to entries title and body strings
context - the XWiki context
Returns:
the feed entry corresponding to the given events

getFeed

public com.sun.syndication.feed.synd.SyndFeed getFeed(List<ActivityEvent> events,
                                                      String author,
                                                      String title,
                                                      String description,
                                                      String copyright,
                                                      String encoding,
                                                      String url,
                                                      com.xpn.xwiki.XWikiContext context)
Description copied from interface: ActivityStream
Get a feed from the given events.

Specified by:
getFeed in interface ActivityStream
Parameters:
events - events to create the feed from
author - author to set in the feed metadata
title - title to set in the feed metadata
description - description to set in the feed metadata
copyright - copyright to set in the feed metadata
encoding - encoding to set in the feed metadata
url - URL to set in the feed metadata
context - the XWiki context
Returns:
the feed entry corresponding to the given events

getFeed

public com.sun.syndication.feed.synd.SyndFeed getFeed(List<ActivityEvent> events,
                                                      String author,
                                                      String title,
                                                      String description,
                                                      String copyright,
                                                      String encoding,
                                                      String url,
                                                      String suffix,
                                                      com.xpn.xwiki.XWikiContext context)
Description copied from interface: ActivityStream
Get a feed from the given events.

Specified by:
getFeed in interface ActivityStream
Parameters:
events - events to create the feed from
author - author to set in the feed metadata
title - title to set in the feed metadata
description - description to set in the feed metadata
copyright - copyright to set in the feed metadata
encoding - encoding to set in the feed metadata
url - URL to set in the feed metadata
suffix - suffix to add to entries title and body strings
context - the XWiki context
Returns:
the feed entry corresponding to the given events

getFeedOutput

public String getFeedOutput(List<ActivityEvent> events,
                            String author,
                            String title,
                            String description,
                            String copyright,
                            String encoding,
                            String url,
                            String type,
                            com.xpn.xwiki.XWikiContext context)
Description copied from interface: ActivityStream
Get the string representation of a feed from the given events.

Specified by:
getFeedOutput in interface ActivityStream
Parameters:
events - events to create the feed from
author - author to set in the feed metadata
title - title to set in the feed metadata
description - description to set in the feed metadata
copyright - copyright to set in the feed metadata
encoding - encoding to set in the feed metadata
url - URL to set in the feed metadata
type - 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 context
Returns:
the feed entry corresponding to the given events

getFeedOutput

public String getFeedOutput(List<ActivityEvent> events,
                            String author,
                            String title,
                            String description,
                            String copyright,
                            String encoding,
                            String url,
                            String type,
                            String suffix,
                            com.xpn.xwiki.XWikiContext context)
Description copied from interface: ActivityStream
Get the string representation of a feed from the given events.

Specified by:
getFeedOutput in interface ActivityStream
Parameters:
events - events to create the feed from
author - author to set in the feed metadata
title - title to set in the feed metadata
description - description to set in the feed metadata
copyright - copyright to set in the feed metadata
encoding - encoding to set in the feed metadata
url - URL to set in the feed metadata
type - 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 strings
context - the XWiki context
Returns:
the feed entry corresponding to the given events

getFeedOutput

public String getFeedOutput(com.sun.syndication.feed.synd.SyndFeed feed,
                            String type)
Specified by:
getFeedOutput in interface ActivityStream
Parameters:
feed - the feed to get the string representation for
type - 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"
Returns:
the string representation of the given feed.

getEvents

public List<org.xwiki.observation.event.Event> getEvents()
Specified by:
getEvents in interface org.xwiki.observation.EventListener

getName

public String getName()
Specified by:
getName in interface org.xwiki.observation.EventListener

onEvent

public void onEvent(org.xwiki.observation.event.Event event,
                    Object source,
                    Object data)
Specified by:
onEvent in interface org.xwiki.observation.EventListener

getRelatedEvents

public List<ActivityEvent> getRelatedEvents(ActivityEvent event,
                                            com.xpn.xwiki.XWikiContext context)
                                     throws ActivityStreamException
Description copied from interface: ActivityStream
Get events that have the same requestId as the event passed as parameter. The provided event is also included in the returned list.

Specified by:
getRelatedEvents in interface ActivityStream
Parameters:
event - the event for which to look for related events
context - the XWiki context
Returns:
a list of events
Throws:
ActivityStreamException - if the retrieval fails

searchUniquePages

public List<Object[]> searchUniquePages(String optionalWhereClause,
                                        int maxItems,
                                        int startAt,
                                        com.xpn.xwiki.XWikiContext context)
                                 throws ActivityStreamException
Description copied from interface: ActivityStream
Get unique pages with events sorted by date. A document is returned at most once, regardless of the number of events.

Specified by:
searchUniquePages in interface ActivityStream
Parameters:
optionalWhereClause - optional HQL where query statement
maxItems - maximum number of documents to retrieve
startAt - query offset
context - the XWiki context
Returns:
pairs of [document name, last event date], in descending order of the last event date
Throws:
ActivityStreamException - if the search fails

searchUniquePages

public List<Object[]> searchUniquePages(String optionalWhereClause,
                                        List<Object> parametersValues,
                                        int maxItems,
                                        int startAt,
                                        com.xpn.xwiki.XWikiContext context)
                                 throws ActivityStreamException
Description copied from interface: ActivityStream
Get unique pages with events sorted by date. A document is returned at most once, regardless of the number of events.

Specified by:
searchUniquePages in interface ActivityStream
Parameters:
optionalWhereClause - optional HQL where query statement
parametersValues - values for the query parameters
maxItems - maximum number of documents to retrieve
startAt - query offset
context - the XWiki context
Returns:
pairs of [document name, last event date], in descending order of the last event date
Throws:
ActivityStreamException - if the search fails

searchDailyPages

public List<Object[]> searchDailyPages(String optionalWhereClause,
                                       int maxItems,
                                       int startAt,
                                       com.xpn.xwiki.XWikiContext context)
                                throws ActivityStreamException
Description copied from interface: ActivityStream
Get unique pages with events sorted by date, grouped by days. A document is returned at most once per day, but might appear more than once if it has associated events in different days.

Specified by:
searchDailyPages in interface ActivityStream
Parameters:
optionalWhereClause - optional HQL where query statement
maxItems - maximum number of documents to retrieve
startAt - query offset
context - the XWiki context
Returns:
pairs of [document name, event date], in descending order of the last event date
Throws:
ActivityStreamException - if the search fails

searchDailyPages

public List<Object[]> searchDailyPages(String optionalWhereClause,
                                       List<Object> parametersValues,
                                       int maxItems,
                                       int startAt,
                                       com.xpn.xwiki.XWikiContext context)
                                throws ActivityStreamException
Description copied from interface: ActivityStream
Get unique pages with events sorted by date, grouped by days. A document is returned at most once per day, but might appear more than once if it has associated events in different days.

Specified by:
searchDailyPages in interface ActivityStream
Parameters:
optionalWhereClause - optional HQL where query statement
parametersValues - values for the query parameters
maxItems - maximum number of documents to retrieve
startAt - query offset
context - the XWiki context
Returns:
pairs of [document name, event date], in descending order of the last event date
Throws:
ActivityStreamException - if the search fails


Copyright © 2004-2013 XWiki. All Rights Reserved.