Changes for page Local Observation Module

Last modified by Manuel Leduc on 2023/10/10 13:59

<
From version < 6.1 >
edited by Thomas Mortagne
on 2014/02/13 14:40
To version < 7.1 >
edited by Thomas Mortagne
on 2014/02/13 16:37
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -42,6 +42,9 @@
42 42  import javax.inject.Inject;
43 43  import javax.inject.Named;
44 44  
45 +import org.xwiki.bridge.event.DocumentCreatedEvent;
46 +import org.xwiki.bridge.event.DocumentDeletedEvent;
47 +import org.xwiki.bridge.event.DocumentUpdatedEvent;
45 45  import org.xwiki.component.annotation.Component;
46 46  import org.xwiki.component.manager.ComponentLookupException;
47 47  import org.xwiki.component.manager.ComponentManager;
... ... @@ -48,7 +48,6 @@
48 48  import org.xwiki.model.reference.DocumentReference;
49 49  import org.xwiki.observation.EventListener;
50 50  import org.xwiki.observation.ObservationManager;
51 -import org.xwiki.observation.event.DocumentSaveEvent;
52 52  import org.xwiki.observation.event.Event;
53 53  
54 54  import com.xpn.xwiki.doc.XWikiDocument;
... ... @@ -71,7 +71,7 @@
71 71  
72 72   public UserCreationEventListener()
73 73   {
74 - super("usercreation", new DocumentSaveEvent());
76 + super("usercreation", new DocumentCreatedEvent());
75 75   }
76 76  
77 77   /**
... ... @@ -99,8 +99,7 @@
99 99   {
100 100   if (this.observationManager == null) {
101 101   try {
102 - this.observationManager = componentManager.lookup(ObservationManager.class);
103 -
104 + this.observationManager = componentManager.getInstance(ObservationManager.class);
104 104   } catch (ComponentLookupException e) {
105 105   throw new RuntimeException("Cound not retrieve an Observation Manager against the component manager");
106 106   }
... ... @@ -124,6 +124,9 @@
124 124  import javax.inject.Inject;
125 125  import javax.inject.Named;
126 126  
128 +import org.xwiki.bridge.event.DocumentCreatedEvent;
129 +import org.xwiki.bridge.event.DocumentDeletedEvent;
130 +import org.xwiki.bridge.event.DocumentUpdatedEvent;
127 127  import org.xwiki.component.annotation.Component;
128 128  import org.xwiki.component.manager.ComponentLookupException;
129 129  import org.xwiki.component.manager.ComponentManager;
... ... @@ -130,7 +130,6 @@
130 130  import org.xwiki.model.reference.DocumentReference;
131 131  import org.xwiki.observation.EventListener;
132 132  import org.xwiki.observation.ObservationManager;
133 -import org.xwiki.observation.event.DocumentSaveEvent;
134 134  import org.xwiki.observation.event.Event;
135 135  
136 136  import com.xpn.xwiki.doc.XWikiDocument;
... ... @@ -156,7 +156,7 @@
156 156   */
157 157   public List<Event> getEvents()
158 158   {
159 - return Arrays.<Event>asList(new DocumentSaveEvent());
162 + return Arrays.<Event>asList(new DocumentCreatedEvent());
160 160   }
161 161  
162 162   /**
... ... @@ -192,7 +192,7 @@
192 192   {
193 193   if (this.observationManager == null) {
194 194   try {
195 - this.observationManager = componentManager.lookup(ObservationManager.class);
198 + this.observationManager = componentManager.getInstance(ObservationManager.class);
196 196  
197 197   } catch (ComponentLookupException e) {
198 198   throw new RuntimeException("Cound not retrieve an Observation Manager against the component manager");
... ... @@ -209,7 +209,7 @@
209 209  {{code language="java"}}
210 210  package com.example.event;
211 211  
212 -import org.xwiki.observation.event.AbstractDocumentEvent;
215 +import org.xwiki.bridge.event.AbstractDocumentEvent;
213 213  import org.xwiki.observation.event.Event;
214 214  import org.xwiki.observation.event.filter.EventFilter;
215 215  

Get Connected