/** * {@inheritDoc} */ public void addActivityEvent(String streamName, String type, String title, List<String> params, XWikiContext context) throws ActivityStreamException { ActivityEvent event = newActivityEvent(); event.setStream(streamName); event.setType(type); event.setTitle(title); event.setBody(title); event.setParams(params); addActivityEvent(event, context); }
/** * Set fields related to the document which fired the event in the given event object. * * @param event the event to prepare * @param doc document which fired the event * @param context the XWiki context */ private void setEventDocumentRelatedInformation(ActivityEvent event, XWikiDocument doc, XWikiContext context) { if (doc != null) { if (event.getStream() == null) { event.setStream(getStreamName(doc.getSpace(), context)); } if (event.getSpace() == null) { event.setSpace(doc.getSpace()); } if (event.getPage() == null) { event.setPage(doc.getFullName()); } if (event.getUrl() == null) { // Protection against NPEs, events can happen before the URL factory gets created. if (context.getURLFactory() != null) { event.setUrl(doc.getURL("view", context)); } } } }
/** * {@inheritDoc} */ public void addDocumentActivityEvent(String streamName, XWikiDocument doc, String type, int priority, String title, List<String> params, XWikiContext context) throws ActivityStreamException { ActivityEvent event = newActivityEvent(); event.setStream(streamName); event.setPage(doc.getFullName()); if (doc.getDatabase() != null) { event.setWiki(doc.getDatabase()); } event.setDate(doc.getDate()); event.setPriority(priority); event.setType(type); event.setTitle(title); event.setBody(title); event.setVersion(doc.getVersion()); event.setParams(params); // This might be wrong once non-altering events will be logged. event.setUser(doc.getAuthor()); addActivityEvent(event, doc, context); }
result.setStream(e.getStream()); result.setTitle(e.getTitle()); result.setType(e.getType());