Search in sources :

Example 11 with WatchListEvent

use of org.xwiki.watchlist.internal.api.WatchListEvent in project xwiki-platform by xwiki.

the class ActivityEventWatchListEventConverter method convert.

@Override
public WatchListEvent convert(ActivityEvent from, Object... parameters) {
    DocumentReference documentReference = new DocumentReference(resolver.resolve(from.getPage(), EntityType.DOCUMENT, new WikiReference(from.getWiki())));
    String type = from.getType();
    DocumentReference userReference = null;
    // Watch out for unregistered user events since they have a null user.
    if (from.getUser() != null) {
        userReference = new DocumentReference(resolver.resolve(from.getUser(), EntityType.DOCUMENT, new WikiReference(from.getWiki())));
    }
    return new WatchListEvent(documentReference, type, userReference, from.getVersion(), from.getDate());
}
Also used : WatchListEvent(org.xwiki.watchlist.internal.api.WatchListEvent) WikiReference(org.xwiki.model.reference.WikiReference) DocumentReference(org.xwiki.model.reference.DocumentReference)

Aggregations

WatchListEvent (org.xwiki.watchlist.internal.api.WatchListEvent)11 DocumentReference (org.xwiki.model.reference.DocumentReference)6 ArrayList (java.util.ArrayList)4 XWikiContext (com.xpn.xwiki.XWikiContext)3 Date (java.util.Date)3 Attachment (com.xpn.xwiki.api.Attachment)2 XWikiDocument (com.xpn.xwiki.doc.XWikiDocument)2 BaseObject (com.xpn.xwiki.objects.BaseObject)2 ActivityEvent (com.xpn.xwiki.plugin.activitystream.api.ActivityEvent)2 HashMap (java.util.HashMap)2 WikiReference (org.xwiki.model.reference.WikiReference)2 WatchListEventMatcher (org.xwiki.watchlist.internal.WatchListEventMatcher)2 XWiki (com.xpn.xwiki.XWiki)1 XWikiException (com.xpn.xwiki.XWikiException)1 ActivityStream (com.xpn.xwiki.plugin.activitystream.api.ActivityStream)1 ActivityEventImpl (com.xpn.xwiki.plugin.activitystream.impl.ActivityEventImpl)1 ActivityStreamPlugin (com.xpn.xwiki.plugin.activitystream.plugin.ActivityStreamPlugin)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 Address (javax.mail.Address)1