On Oct 26, 2010, at 6:01 PM, sdumitriu (SVN) wrote:
Author: sdumitriu Date: 2010-10-26 18:01:43 +0200 (Tue, 26 Oct 2010) New Revision: 32194
Modified: platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/XWiki.java Log: XWIKI-5624: Send observation events for adding/editing/deleting comments, annotations, and attachments Done.
[snip]
+ for (AttachmentDiff diff : doc.getAttachmentDiff(originalDoc, doc, context)) { + if (StringUtils.isEmpty(diff.getOrigVersion())) { + om.notify(new AttachmentAddEvent(reference, diff.getFileName()), source, data); + } else if (StringUtils.isEmpty(diff.getNewVersion())) { + om.notify(new AttachmentDeleteEvent(reference, diff.getFileName()), source, data); + } else { + om.notify(new AttachmentUpdateEvent(reference, diff.getFileName()), source, data); + } + } + } catch (XWikiException ex) { + // TODO Auto-generated catch block + ex.printStackTrace();
This is definitely wrong and needs to be fixed.
+ } + } + + private static final List<Event> LISTENER_EVENTS = new ArrayList<Event>() + { + { + add(new DocumentSaveEvent()); + add(new DocumentUpdateEvent()); + add(new DocumentDeleteEvent()); + } + }; + + public List<Event> getEvents() + { + return LISTENER_EVENTS; + } + + public String getName() + { + return "xwiki-core";
I don't think this is a good name, at least it's not following current practices. Thanks -Vincent