com.xpn.xwiki.plugin.activitystream.plugin
Class ActivityStreamPluginApi

java.lang.Object
  extended by com.xpn.xwiki.api.Api
      extended by com.xpn.xwiki.plugin.PluginApi<ActivityStreamPlugin>
          extended by com.xpn.xwiki.plugin.activitystream.plugin.ActivityStreamPluginApi

public class ActivityStreamPluginApi
extends com.xpn.xwiki.plugin.PluginApi<ActivityStreamPlugin>

API for ActivityStreamPlugin

Version:
$Id: $

Field Summary
 
Fields inherited from class com.xpn.xwiki.api.Api
context
 
Constructor Summary
ActivityStreamPluginApi(ActivityStreamPlugin plugin, com.xpn.xwiki.XWikiContext context)
           
 
Method Summary
 void addActivityEvent(ActivityEvent event)
          Record in database the given ActivityEvent event
 void addActivityEvent(java.lang.String streamName, java.lang.String type, java.lang.String title)
          Records in database the a event built upon the passed parameters
 void addActivityEvent(java.lang.String streamName, java.lang.String type, java.lang.String title, java.util.List params)
           
 void addDocumentActivityEvent(java.lang.String streamName, com.xpn.xwiki.api.Document doc, java.lang.String type, int priority, java.lang.String title)
           
 void addDocumentActivityEvent(java.lang.String streamName, com.xpn.xwiki.api.Document doc, java.lang.String type, int priority, java.lang.String title, java.util.List params)
           
 void addDocumentActivityEvent(java.lang.String streamName, com.xpn.xwiki.api.Document doc, java.lang.String type, java.lang.String title)
          Records in database an event built upon the passed document and other parameters.
 void addDocumentActivityEvent(java.lang.String streamName, com.xpn.xwiki.api.Document doc, java.lang.String type, java.lang.String title, java.util.List params)
           
 void deleteActivityEvent(ActivityEvent event)
          Delete the passed event form the database.
 void deleteActivityEvents(java.util.List<ActivityEvent> evs)
          Delete the passed events from the database.
protected  ActivityStream getActivityStream()
           
 java.util.List<ActivityEvent> getEvents(boolean filter, int nb, int start)
          Return the latest recorded events
 java.util.List<ActivityEvent> getEvents(java.lang.String streamName, boolean filter, int nb, int start)
          Return the latest events recorded for the given stream name
 java.util.List<ActivityEvent> getEventsForSpace(java.lang.String space, boolean filter, int nb, int start)
          Return the latest recorded events for the given wiki space
 java.util.List<ActivityEvent> getEventsForSpace(java.lang.String streamName, java.lang.String space, boolean filter, int nb, int start)
          Returns the latest events recorded for the given stream name and wiki space name
 java.util.List<ActivityEvent> getEventsForUser(java.lang.String user, boolean filter, int nb, int start)
          Return the latest recorded events triggered by the given user.
 java.util.List<ActivityEvent> getEventsForUser(java.lang.String streamName, java.lang.String user, boolean filter, int nb, int start)
          Returns the latest events recorded for the given stream name and user name
 com.sun.syndication.feed.synd.SyndFeed getFeed(java.util.List<ActivityEvent> events)
           
 com.sun.syndication.feed.synd.SyndFeed getFeed(java.util.List<ActivityEvent> events, java.lang.String suffix)
           
 com.sun.syndication.feed.synd.SyndFeed getFeed(java.util.List<ActivityEvent> events, java.lang.String author, java.lang.String title, java.lang.String description, java.lang.String copyright, java.lang.String encoding, java.lang.String url)
           
 com.sun.syndication.feed.synd.SyndFeed getFeed(java.util.List<ActivityEvent> events, java.lang.String author, java.lang.String title, java.lang.String description, java.lang.String copyright, java.lang.String encoding, java.lang.String url, java.lang.String suffix)
           
 com.sun.syndication.feed.synd.SyndEntry getFeedEntry(ActivityEvent event)
           
 com.sun.syndication.feed.synd.SyndEntry getFeedEntry(ActivityEvent event, java.lang.String suffix)
           
 java.lang.String getFeedOutput(java.util.List<ActivityEvent> events, java.lang.String author, java.lang.String title, java.lang.String description, java.lang.String copyright, java.lang.String encoding, java.lang.String url, java.lang.String type)
           
 java.lang.String getFeedOutput(java.util.List<ActivityEvent> events, java.lang.String author, java.lang.String title, java.lang.String description, java.lang.String copyright, java.lang.String encoding, java.lang.String url, java.lang.String type, java.lang.String suffix)
           
 java.lang.String getFeedOutput(com.sun.syndication.feed.synd.SyndFeed feed, java.lang.String type)
           
 java.lang.String getStreamName(java.lang.String spaceName)
           
 java.util.List<ActivityEvent> searchEvents(java.lang.String hql, boolean filter, int nb, int start)
          Search in database activity events matching the given hql query.
 java.util.List<ActivityEvent> searchEvents(java.lang.String hql, boolean filter, int nb, int start, java.util.List<java.lang.Object> parameterValues)
          Search in database activity events matching the given hql query.
 java.util.List<ActivityEvent> searchEvents(java.lang.String fromHql, java.lang.String hql, boolean filter, int nb, int start)
          Search in database activity events matching the given hql query.
 java.util.List<ActivityEvent> searchEvents(java.lang.String fromHql, java.lang.String hql, boolean filter, int nb, int start, java.util.List<java.lang.Object> parameterValues)
          Search in database activity events matching the given hql query.
protected  java.util.List<ActivityEvent> unwrapEvents(java.util.List<ActivityEvent> events)
           
protected  java.util.List<ActivityEvent> wrapEvents(java.util.List<ActivityEvent> events)
           
 
Methods inherited from class com.xpn.xwiki.plugin.PluginApi
getInternalPlugin, getPlugin, getProtectedPlugin, setPlugin
 
Methods inherited from class com.xpn.xwiki.api.Api
checkProgrammingRights, convert, convert, getXWikiContext, hasAccessLevel, hasAdminRights, hasProgrammingRights
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActivityStreamPluginApi

public ActivityStreamPluginApi(ActivityStreamPlugin plugin,
                               com.xpn.xwiki.XWikiContext context)
See Also:
PluginApi.PluginApi(XWikiPluginInterface, XWikiContext)
Method Detail

getActivityStream

protected ActivityStream getActivityStream()
Returns:
The ActivityStream component to use inside the API

addActivityEvent

public void addActivityEvent(ActivityEvent event)
                      throws ActivityStreamException
Record in database the given ActivityEvent event

Parameters:
event - the event to record in databases
Throws:
ActivityStreamException

addActivityEvent

public void addActivityEvent(java.lang.String streamName,
                             java.lang.String type,
                             java.lang.String title)
                      throws ActivityStreamException
Records in database the a event built upon the passed parameters

Parameters:
streamName - the name of the stream to record the event for
type - the type of event. The type can be a value picked from the list of values defined in ActivityEventType or any other String
title - the event title
Throws:
ActivityStreamException

addActivityEvent

public void addActivityEvent(java.lang.String streamName,
                             java.lang.String type,
                             java.lang.String title,
                             java.util.List params)
                      throws ActivityStreamException
Parameters:
params - a list of up to 5 "free" String parameters that will be associated with the event
Throws:
ActivityStreamException
See Also:
addActivityEvent(String, String, String)

addDocumentActivityEvent

public void addDocumentActivityEvent(java.lang.String streamName,
                                     com.xpn.xwiki.api.Document doc,
                                     java.lang.String type,
                                     java.lang.String title)
                              throws ActivityStreamException
Records in database an event built upon the passed document and other parameters. The passed document is used to retrieve document-related data for the event : date, page name, database.

Parameters:
streamName - the name of the stream to add the event to
doc - the document from which to retrieve document data for the event
type - the type of event. (see addActivityEvent(String, String, String)
title - the title of the event
Throws:
ActivityStreamException

addDocumentActivityEvent

public void addDocumentActivityEvent(java.lang.String streamName,
                                     com.xpn.xwiki.api.Document doc,
                                     java.lang.String type,
                                     int priority,
                                     java.lang.String title)
                              throws ActivityStreamException
Parameters:
priority - the priority for this event. see ActivityEventPriority
Throws:
ActivityStreamException
See Also:
addDocumentActivityEvent(String, Document, String, String)

deleteActivityEvents

public void deleteActivityEvents(java.util.List<ActivityEvent> evs)
                          throws ActivityStreamException
Delete the passed events from the database.

Parameters:
evs - the events to be deleted
Throws:
ActivityStreamException

deleteActivityEvent

public void deleteActivityEvent(ActivityEvent event)
                         throws ActivityStreamException
Delete the passed event form the database.

Parameters:
event - the event to delete from database
Throws:
ActivityStreamException

addDocumentActivityEvent

public void addDocumentActivityEvent(java.lang.String streamName,
                                     com.xpn.xwiki.api.Document doc,
                                     java.lang.String type,
                                     java.lang.String title,
                                     java.util.List params)
                              throws ActivityStreamException
Parameters:
params - a list of up to 5 "free" String parameters that will be associated with the event
Throws:
ActivityStreamException
See Also:
addDocumentActivityEvent(String, Document, String, String)

addDocumentActivityEvent

public void addDocumentActivityEvent(java.lang.String streamName,
                                     com.xpn.xwiki.api.Document doc,
                                     java.lang.String type,
                                     int priority,
                                     java.lang.String title,
                                     java.util.List params)
                              throws ActivityStreamException
Throws:
ActivityStreamException
See Also:
addDocumentActivityEvent(String, Document, String, int, String), addDocumentActivityEvent(String, Document, String, String, List)

searchEvents

public java.util.List<ActivityEvent> searchEvents(java.lang.String hql,
                                                  boolean filter,
                                                  int nb,
                                                  int start)
                                           throws ActivityStreamException
Search in database activity events matching the given hql query. Retrieved events are ordered by date descending.

Parameters:
hql - the "where" clause of the hql query to look events for
filter - if true, group the matched events by priority
nb - the number of events to retrieve
start - the offset to start retrieving event at
Returns:
a list of matching events, wrapped as ActivityEvent objects.
Throws:
ActivityStreamException

searchEvents

public java.util.List<ActivityEvent> searchEvents(java.lang.String hql,
                                                  boolean filter,
                                                  int nb,
                                                  int start,
                                                  java.util.List<java.lang.Object> parameterValues)
                                           throws ActivityStreamException
Search in database activity events matching the given hql query. Retrieved events are ordered by date descending.

Parameters:
hql - the "where" clause of the hql query to look events for
filter - if true, group the matched events by priority
nb - the number of events to retrieve
start - the offset to start retrieving event at
parameterValues - list of parameters to insert in the query
Returns:
a list of matching events, wrapped as ActivityEvent objects.
Throws:
ActivityStreamException

searchEvents

public java.util.List<ActivityEvent> searchEvents(java.lang.String fromHql,
                                                  java.lang.String hql,
                                                  boolean filter,
                                                  int nb,
                                                  int start)
                                           throws ActivityStreamException
Search in database activity events matching the given hql query. Retrieved events are ordered by date descending.

Parameters:
fromHql - the "from" clause of the hql query to look events for
hql - the "where" clause of the hql query to look events for
filter - if true, group the matched events by priority
nb - the number of events to retrieve
start - the offset to start retrieving event at
Returns:
a list of matching events, wrapped as ActivityEvent objects.
Throws:
ActivityStreamException

searchEvents

public java.util.List<ActivityEvent> searchEvents(java.lang.String fromHql,
                                                  java.lang.String hql,
                                                  boolean filter,
                                                  int nb,
                                                  int start,
                                                  java.util.List<java.lang.Object> parameterValues)
                                           throws ActivityStreamException
Search in database activity events matching the given hql query. Retrieved events are ordered by date descending.

Parameters:
fromHql - the "from" clause of the hql query to look events for
hql - the "where" clause of the hql query to look events for
filter - if true, group the matched events by priority
nb - the number of events to retrieve
start - the offset to start retrieving event at
parameterValues - list of parameters to insert in the query
Returns:
a list of matching events, wrapped as ActivityEvent objects.
Throws:
ActivityStreamException

getEvents

public java.util.List<ActivityEvent> getEvents(boolean filter,
                                               int nb,
                                               int start)
                                        throws ActivityStreamException
Return the latest recorded events

Parameters:
filter - if true, group the matched events by priority
nb - the number of events to retrieve
start - the offset to start retrieving event at
Throws:
ActivityStreamException

getEventsForSpace

public java.util.List<ActivityEvent> getEventsForSpace(java.lang.String space,
                                                       boolean filter,
                                                       int nb,
                                                       int start)
                                                throws ActivityStreamException
Return the latest recorded events for the given wiki space

Parameters:
space - the space to retrieve latest events for
Throws:
ActivityStreamException
See Also:
getEvents(boolean, int, int)

getEventsForUser

public java.util.List<ActivityEvent> getEventsForUser(java.lang.String user,
                                                      boolean filter,
                                                      int nb,
                                                      int start)
                                               throws ActivityStreamException
Return the latest recorded events triggered by the given user.

Parameters:
user - the user to retrieve latest events for
Throws:
ActivityStreamException
See Also:
getEvents(boolean, int, int)

getEvents

public java.util.List<ActivityEvent> getEvents(java.lang.String streamName,
                                               boolean filter,
                                               int nb,
                                               int start)
                                        throws ActivityStreamException
Return the latest events recorded for the given stream name

Parameters:
streamName - the name of the stream to retrieve latest events for
Throws:
ActivityStreamException
See Also:
getEvents(boolean, int, int)

getEventsForSpace

public java.util.List<ActivityEvent> getEventsForSpace(java.lang.String streamName,
                                                       java.lang.String space,
                                                       boolean filter,
                                                       int nb,
                                                       int start)
                                                throws ActivityStreamException
Returns the latest events recorded for the given stream name and wiki space name

Throws:
ActivityStreamException
See Also:
getEventsForSpace(String, boolean, int, int), getEvents(String, boolean, int, int)

getEventsForUser

public java.util.List<ActivityEvent> getEventsForUser(java.lang.String streamName,
                                                      java.lang.String user,
                                                      boolean filter,
                                                      int nb,
                                                      int start)
                                               throws ActivityStreamException
Returns the latest events recorded for the given stream name and user name

Throws:
ActivityStreamException
See Also:
getEventsForUser(String, boolean, int, int), getEvents(String, boolean, int, int)

wrapEvents

protected java.util.List<ActivityEvent> wrapEvents(java.util.List<ActivityEvent> events)

unwrapEvents

protected java.util.List<ActivityEvent> unwrapEvents(java.util.List<ActivityEvent> events)

getFeedEntry

public com.sun.syndication.feed.synd.SyndEntry getFeedEntry(ActivityEvent event)

getFeedEntry

public com.sun.syndication.feed.synd.SyndEntry getFeedEntry(ActivityEvent event,
                                                            java.lang.String suffix)

getFeed

public com.sun.syndication.feed.synd.SyndFeed getFeed(java.util.List<ActivityEvent> events)

getFeed

public com.sun.syndication.feed.synd.SyndFeed getFeed(java.util.List<ActivityEvent> events,
                                                      java.lang.String suffix)

getFeed

public com.sun.syndication.feed.synd.SyndFeed getFeed(java.util.List<ActivityEvent> events,
                                                      java.lang.String author,
                                                      java.lang.String title,
                                                      java.lang.String description,
                                                      java.lang.String copyright,
                                                      java.lang.String encoding,
                                                      java.lang.String url)

getFeed

public com.sun.syndication.feed.synd.SyndFeed getFeed(java.util.List<ActivityEvent> events,
                                                      java.lang.String author,
                                                      java.lang.String title,
                                                      java.lang.String description,
                                                      java.lang.String copyright,
                                                      java.lang.String encoding,
                                                      java.lang.String url,
                                                      java.lang.String suffix)

getFeedOutput

public java.lang.String getFeedOutput(java.util.List<ActivityEvent> events,
                                      java.lang.String author,
                                      java.lang.String title,
                                      java.lang.String description,
                                      java.lang.String copyright,
                                      java.lang.String encoding,
                                      java.lang.String url,
                                      java.lang.String type)

getFeedOutput

public java.lang.String getFeedOutput(java.util.List<ActivityEvent> events,
                                      java.lang.String author,
                                      java.lang.String title,
                                      java.lang.String description,
                                      java.lang.String copyright,
                                      java.lang.String encoding,
                                      java.lang.String url,
                                      java.lang.String type,
                                      java.lang.String suffix)

getFeedOutput

public java.lang.String getFeedOutput(com.sun.syndication.feed.synd.SyndFeed feed,
                                      java.lang.String type)

getStreamName

public java.lang.String getStreamName(java.lang.String spaceName)
Returns:
The name of the event stream associated with the given space


Copyright © 2004-2009 XWiki. All Rights Reserved.