use of org.xwiki.template.event.TemplateUpdatedEvent in project xwiki-platform by xwiki.
the class TemplateListener method onEvent.
@Override
public void onEvent(Event event, Object source, Object data) {
XWikiDocument document = (XWikiDocument) source;
// Is this a skin document
if (document.getXObject(WikiSkinUtils.SKINCLASS_REFERENCE) != null) {
if (event instanceof AbstractAttachmentEvent) {
AttachmentReference attachment = new AttachmentReference(((AbstractAttachmentEvent) event).getName(), document.getDocumentReference());
String id = this.referenceSerializer.serialize(attachment);
if (event instanceof AttachmentDeletedEvent) {
this.observation.notify(new TemplateDeletedEvent(id), this);
} else if (event instanceof AttachmentUpdatedEvent) {
this.observation.notify(new TemplateUpdatedEvent(id), this);
}
} else if (event instanceof XObjectPropertyEvent) {
String id = this.referenceSerializer.serialize(((XObjectPropertyEvent) event).getReference());
if (event instanceof XObjectPropertyDeletedEvent) {
this.observation.notify(new TemplateDeletedEvent(id), this);
} else if (event instanceof XObjectPropertyUpdatedEvent) {
this.observation.notify(new TemplateUpdatedEvent(id), this);
}
}
}
}
Aggregations